annotate plugins/icq/udp.c @ 2025:1bfef3e8ba63

[gaim-migrate @ 2035] woo committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 16 Jun 2001 01:14:43 +0000
parents 7b3f1eb1ef7d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
3 /*
1977
7b3f1eb1ef7d [gaim-migrate @ 1987]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1912
diff changeset
4 * $Id: udp.c 1987 2001-06-09 14:46:51Z warmenhoven $
7b3f1eb1ef7d [gaim-migrate @ 1987]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1912
diff changeset
5 *
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
6 * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
7 * Bill Soudan <soudan@kde.org>
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
8 *
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
9 * This program is free software; you can redistribute it and/or modify
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
10 * it under the terms of the GNU General Public License as published by
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
12 * (at your option) any later version.
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
13 *
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
14 * This program is distributed in the hope that it will be useful,
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
17 * GNU General Public License for more details.
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
18 *
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
19 * You should have received a copy of the GNU General Public License
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
20 * along with this program; if not, write to the Free Software
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
22 *
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
23 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 #ifdef _WIN32
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 #include <winsock.h>
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 #endif
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 #include <stdlib.h>
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 #include "icqlib.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 #include "udp.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33 #include "queue.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 #include "stdpackets.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 #include "icqbyteorder.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
38 #include "contacts.h"
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
39
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 static const BYTE icq_UDPTable[] = {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 0x59, 0x60, 0x37, 0x6B, 0x65, 0x62, 0x46, 0x48, 0x53, 0x61, 0x4C, 0x59, 0x60, 0x57, 0x5B, 0x3D,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 0x5E, 0x34, 0x6D, 0x36, 0x50, 0x3F, 0x6F, 0x67, 0x53, 0x61, 0x4C, 0x59, 0x40, 0x47, 0x63, 0x39,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 0x50, 0x5F, 0x5F, 0x3F, 0x6F, 0x47, 0x43, 0x69, 0x48, 0x33, 0x31, 0x64, 0x35, 0x5A, 0x4A, 0x42,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 0x56, 0x40, 0x67, 0x53, 0x41, 0x07, 0x6C, 0x49, 0x58, 0x3B, 0x4D, 0x46, 0x68, 0x43, 0x69, 0x48,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 0x33, 0x31, 0x44, 0x65, 0x62, 0x46, 0x48, 0x53, 0x41, 0x07, 0x6C, 0x69, 0x48, 0x33, 0x51, 0x54,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 0x5D, 0x4E, 0x6C, 0x49, 0x38, 0x4B, 0x55, 0x4A, 0x62, 0x46, 0x48, 0x33, 0x51, 0x34, 0x6D, 0x36,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 0x50, 0x5F, 0x5F, 0x5F, 0x3F, 0x6F, 0x47, 0x63, 0x59, 0x40, 0x67, 0x33, 0x31, 0x64, 0x35, 0x5A,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 0x6A, 0x52, 0x6E, 0x3C, 0x51, 0x34, 0x6D, 0x36, 0x50, 0x5F, 0x5F, 0x3F, 0x4F, 0x37, 0x4B, 0x35,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 0x5A, 0x4A, 0x62, 0x66, 0x58, 0x3B, 0x4D, 0x66, 0x58, 0x5B, 0x5D, 0x4E, 0x6C, 0x49, 0x58, 0x3B,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 0x4D, 0x66, 0x58, 0x3B, 0x4D, 0x46, 0x48, 0x53, 0x61, 0x4C, 0x59, 0x40, 0x67, 0x33, 0x31, 0x64,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 0x55, 0x6A, 0x32, 0x3E, 0x44, 0x45, 0x52, 0x6E, 0x3C, 0x31, 0x64, 0x55, 0x6A, 0x52, 0x4E, 0x6C,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 0x69, 0x48, 0x53, 0x61, 0x4C, 0x39, 0x30, 0x6F, 0x47, 0x63, 0x59, 0x60, 0x57, 0x5B, 0x3D, 0x3E,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 0x64, 0x35, 0x3A, 0x3A, 0x5A, 0x6A, 0x52, 0x4E, 0x6C, 0x69, 0x48, 0x53, 0x61, 0x6C, 0x49, 0x58,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 0x3B, 0x4D, 0x46, 0x68, 0x63, 0x39, 0x50, 0x5F, 0x5F, 0x3F, 0x6F, 0x67, 0x53, 0x41, 0x25, 0x41,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 0x3C, 0x51, 0x54, 0x3D, 0x5E, 0x54, 0x5D, 0x4E, 0x4C, 0x39, 0x50, 0x5F, 0x5F, 0x5F, 0x3F, 0x6F,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 0x47, 0x43, 0x69, 0x48, 0x33, 0x51, 0x54, 0x5D, 0x6E, 0x3C, 0x31, 0x64, 0x35, 0x5A, 0x00, 0x00,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57 };
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1498
diff changeset
59 DWORD icq_UDPCalculateCheckCode(icq_Packet *p)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61 DWORD num1, num2;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 DWORD r1,r2;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64 num1 = p->data[8];
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 num1 <<= 8;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66 num1 += p->data[4];
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 num1 <<= 8;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68 num1 += p->data[2];
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69 num1 <<= 8;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 num1 += p->data[6];
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 r1 = 0x18 + (rand() % (p->length - 0x18));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 r2 = rand() & 0xff;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 num2 = r1;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76 num2 <<= 8;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77 num2 += p->data[r1];
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78 num2 <<= 8;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79 num2 += r2;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 num2 <<= 8;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81 num2 += icq_UDPTable[r2];
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82 num2 ^= 0xFF00FF;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1498
diff changeset
84 return num1 ^ num2;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87 DWORD icq_UDPScramble(DWORD cc)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 DWORD a[5];
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91 a[0] = cc & 0x0000001F;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92 a[1] = cc & 0x03E003E0;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93 a[2] = cc & 0xF8000400;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94 a[3] = cc & 0x0000F800;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95 a[4] = cc & 0x041F0000;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97 a[0] <<= 0x0C;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98 a[1] <<= 0x01;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99 a[2] >>= 0x0A;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100 a[3] <<= 0x10;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101 a[4] >>= 0x0F;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103 return a[0] + a[1] + a[2] + a[3] + a[4];
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
106 void icq_UDPEncode(icq_Packet *p, char *buffer)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107 {
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1498
diff changeset
108 DWORD checkcode = icq_UDPCalculateCheckCode(p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
109 DWORD code1, code2, code3;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110 DWORD pos;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1498
diff changeset
112 memcpy(buffer, p->data, p->length);
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1498
diff changeset
113
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1498
diff changeset
114 *(DWORD *)(buffer+0x14)=htoicql(checkcode);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
115 code1 = p->length * 0x68656c6cL;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
116 code2 = code1 + checkcode;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117 pos = 0x0A;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
118
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
119 for(; pos < p->length; pos+=4)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120 {
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1498
diff changeset
121 DWORD data = icqtohl(*(DWORD *)((p->data)+pos));
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122 code3 = code2 + icq_UDPTable[pos & 0xFF];
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
123 data ^= code3;
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1498
diff changeset
124 *(DWORD*)(buffer+pos)=htoicql(data);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
125 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
126 checkcode = icq_UDPScramble(checkcode);
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1498
diff changeset
127 *(DWORD *)(buffer+0x14)=htoicql(checkcode);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
128 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
129
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130 /*********************************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
131 icq_UDPSockWrite and icq_UDPSockRead are for _UDP_ packets
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
132 proxy support for TCP sockets is different!
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133 *********************************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
134 int icq_UDPSockWriteDirect(icq_Link *icqlink, icq_Packet *p)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135 {
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1498
diff changeset
136 char tmpbuf[ICQ_PACKET_DATA_SIZE+10];
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
138 if(icqlink->icq_UDPSok <= 3)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
140 icq_FmtLog(icqlink, ICQ_LOG_ERROR, "Bad socket!\n");
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
141 return -1;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
142 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1498
diff changeset
144 icq_UDPEncode(p, tmpbuf+10);
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1498
diff changeset
145
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
146 if(!icqlink->icq_UseProxy)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148 #ifdef _WIN32
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
149 return send(icqlink->icq_UDPSok, tmpbuf+10, p->length, 0);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150 #else
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
151 return write(icqlink->icq_UDPSok, tmpbuf+10, p->length);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
152 #endif
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
154 else
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
155 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
156 tmpbuf[0] = 0; /* reserved */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
157 tmpbuf[1] = 0; /* reserved */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 tmpbuf[2] = 0; /* standalone packet */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159 tmpbuf[3] = 1; /* address type IP v4 */
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
160 *(unsigned long*)&tmpbuf[4] = htonl(icqlink->icq_ProxyDestIP);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
161 *(unsigned short*)&tmpbuf[8] = htons(icqlink->icq_ProxyDestPort);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 #ifdef _WIN32
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
163 return send(icqlink->icq_UDPSok, tmpbuf, p->length+10, 0)-10;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 #else
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
165 return write(icqlink->icq_UDPSok, tmpbuf, p->length+10)-10;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
166 #endif
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
167 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
169
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
170 int icq_UDPSockWrite(icq_Link *icqlink, icq_Packet *p)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
171 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
172 icq_UDPQueuePut(icqlink, p);
1498
0ef6603d986e [gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1432
diff changeset
173
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
174 return icq_UDPSockWriteDirect(icqlink, p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
175 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
176
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
177 int icq_UDPSockRead(icq_Link *icqlink, icq_Packet *p)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
178 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179 int res;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180 char tmpbuf[ICQ_PACKET_DATA_SIZE];
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
181
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
182 if(!icqlink->icq_UseProxy)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184 #ifdef _WIN32
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
185 res = recv(icqlink->icq_UDPSok, p->data, ICQ_PACKET_DATA_SIZE, 0);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186 #else
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
187 res = read(icqlink->icq_UDPSok, p->data, ICQ_PACKET_DATA_SIZE);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188 #endif
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189 p->length = res;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 return res;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192 else
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
194 #ifdef _WIN32
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
195 res = recv(icqlink->icq_UDPSok, tmpbuf, ICQ_PACKET_DATA_SIZE, 0);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196 #else
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
197 res = read(icqlink->icq_UDPSok, tmpbuf, ICQ_PACKET_DATA_SIZE);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 #endif
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
199 if(res<0)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200 return res;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201 memcpy(p->data, &tmpbuf[10], res-10);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202 p->length = res-10;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203 return res-10;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
205 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207 /****************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208 This must be called every 2 min.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
209 so the server knows we're still alive.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210 JAVA client sends two different commands
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211 so we do also :)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212 *****************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
213 WORD icq_KeepAlive(icq_Link *icqlink) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
215 icq_Packet *p = icq_UDPCreateStdSeqPacket(icqlink, UDP_CMD_KEEP_ALIVE, icqlink->d->icq_UDPSeqNum1++);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216 icq_PacketAppend32(p, rand());
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
217 icq_UDPSockWriteDirect(icqlink, p); /* don't queue keep alive packets! */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
218 icq_PacketDelete(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
220 icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Send Keep Alive packet to the server\n");
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
221
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
222 return icqlink->d->icq_UDPSeqNum1-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225 /**********************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 This must be called to remove
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227 messages from the server
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228 ***********************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
229 void icq_SendGotMessages(icq_Link *icqlink) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
230 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
231 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_ACK_MESSAGES);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
232 icq_PacketAppend32(p, rand());
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
233 icq_UDPSockWrite(icqlink, p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
234 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236 /*************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
237 this sends over the contact list
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
238 *************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
239 void icq_SendContactList(icq_Link *icqlink) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
240 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
241 char num_used;
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
242 icq_ContactItem *ptr = icq_ContactGetFirst(icqlink);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
243
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
244 while(ptr)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
245 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
246 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_CONT_LIST);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
247
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
248 num_used = 0;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
249 icq_PacketAdvance(p,1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250 while(ptr && num_used<64)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
251 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
252 icq_PacketAppend32(p, ptr->uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
253 num_used++;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
254 ptr = icq_ContactGetNext(ptr);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
255 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256 icq_PacketGotoUDPOutData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
257 icq_PacketAppend8(p, num_used);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
258 icq_UDPSockWrite(icqlink, p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
259 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
262 void icq_SendNewUser(icq_Link *icqlink, unsigned long uin) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
264 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_ADD_TO_LIST);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
265 icq_PacketAppend32(p, uin);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
266 icq_UDPSockWrite(icqlink, p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
267 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269 /*************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270 this sends over the visible list
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271 that allows certain users to see you
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272 if you're invisible.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273 *************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
274 void icq_SendVisibleList(icq_Link *icqlink) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 char num_used;
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
277 icq_ContactItem *ptr = icq_ContactGetFirst(icqlink);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
278 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_VIS_LIST);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280 num_used = 0;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281 icq_PacketAdvance(p,1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
282 while(ptr)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
284 if(ptr->vis_list)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286 icq_PacketAppend32(p, ptr->uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
287 num_used++;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
288 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289 ptr = icq_ContactGetNext(ptr);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
290 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
291 if(num_used != 0)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
292 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
293 icq_PacketGotoUDPOutData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
294 icq_PacketAppend8(p, num_used);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
295 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
296 }
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
297 else
1498
0ef6603d986e [gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1432
diff changeset
298 icq_PacketDelete(p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
299 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
300
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
301 void icq_SendInvisibleList(icq_Link *icqlink) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
302 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303 char num_used;
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
304 icq_ContactItem *ptr = icq_ContactGetFirst(icqlink);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
305 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_INVIS_LIST);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
306
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
307 num_used = 0;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
308 icq_PacketAdvance(p,1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
309 while(ptr)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
310 {
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
311 if(ptr->invis_list)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
312 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
313 icq_PacketAppend32(p, ptr->uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314 num_used++;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
315 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316 ptr = icq_ContactGetNext(ptr);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
318 if(num_used != 0)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
319 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
320 icq_PacketGotoUDPOutData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
321 icq_PacketAppend8(p, num_used);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
322 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
323 }
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
324 else
1498
0ef6603d986e [gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1432
diff changeset
325 icq_PacketDelete(p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
326 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
327
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328 /**************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
329 This sends the second login command
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330 this is necessary to finish logging in.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
331 ***************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
332 void icq_SendLogin1(icq_Link *icqlink) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
333 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
334 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_LOGIN_1);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335 icq_PacketAppend32(p, rand());
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
336 icq_UDPSockWrite(icqlink, p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
337 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
338
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
339 /************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
340 This procedure logins into the server with icq_Uin and pass
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
341 on the socket icq_Sok and gives our ip and port.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
342 It does NOT wait for any kind of a response.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
343 *************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
344 void icq_Login(icq_Link *icqlink, DWORD status) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
345 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346 icq_Packet *p;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
347
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
348 memset(icqlink->d->icq_UDPServMess, FALSE, sizeof(icqlink->d->icq_UDPServMess));
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
349 icqlink->d->icq_UDPSession = rand() & 0x3FFFFFFF;
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
350 icqlink->d->icq_UDPSeqNum1 = rand() & 0x7FFF;
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
351 icqlink->d->icq_UDPSeqNum2 = 1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
352
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
353 p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_LOGIN);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
354 icq_PacketAppend32(p, time(0L));
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
355 icq_PacketAppend32n(p, icqlink->icq_TCPSrvPort);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
356 /*icq_PacketAppend16(p, 0);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
357 icq_PacketAppend16n(p, htons(icqlink->icq_OurPort));*/
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
358 icq_PacketAppendString(p, icqlink->icq_Password);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359 icq_PacketAppend32(p, LOGIN_X1_DEF);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
360 if(icqlink->icq_UseTCP)
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
361 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
362 if(icqlink->icq_UseProxy)
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
363 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
364 icq_PacketAppend32n(p, htonl(icqlink->icq_ProxyIP));
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
365 icq_PacketAppend8(p, LOGIN_SNDONLY_TCP);
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
366 }
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
367 else
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
368 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
369 icq_PacketAppend32n(p, htonl(icqlink->icq_OurIP));
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
370 icq_PacketAppend8(p, LOGIN_SNDRCV_TCP);
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
371 }
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
372 }
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373 else
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
374 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
375 icq_PacketAppend32n(p, htonl(icqlink->icq_ProxyIP));
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
376 icq_PacketAppend8(p, LOGIN_NO_TCP);
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
377 }
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
378 icq_PacketAppend32(p, status);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
379 icq_PacketAppend32(p, LOGIN_X3_DEF);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
380 icq_PacketAppend32(p, LOGIN_X4_DEF);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
381 icq_PacketAppend32(p, LOGIN_X5_DEF);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
382
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
383 icq_UDPSockWrite(icqlink, p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
384 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
385
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
386 /**********************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
387 Logs off ICQ
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
388 ***********************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
389 void icq_Logout(icq_Link *icqlink) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
390 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
391 icq_Packet *p = icq_UDPCreateStdSeqPacket(icqlink, UDP_CMD_SEND_TEXT_CODE, icqlink->d->icq_UDPSeqNum1++);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
392 icq_PacketAppendString(p, "B_USER_DISCONNECTED");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
393 icq_PacketAppend8(p, 5);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
394 icq_PacketAppend8(p, 0);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
395 icq_UDPSockWriteDirect(icqlink, p); /* don't queue */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
396 icq_PacketDelete(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
397 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
398
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
399 /*******************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
400 This routine sends the aknowlegement cmd to the
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401 server it appears that this must be done after
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
402 everything the server sends us
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
403 *******************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
404 void icq_UDPAck(icq_Link *icqlink, int seq) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
405 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
406 icq_Packet *p = icq_UDPCreateStdSeqPacket(icqlink, UDP_CMD_ACK, seq);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
407 icq_PacketAppend32(p, rand());
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
408
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
409 icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Acking\n");
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
410 icq_UDPSockWriteDirect(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
411 icq_PacketDelete(p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
412 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
413
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
414 /***************************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
415 Sends a message thru the server to uin. Text is the
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
416 message to send.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
417 ***************************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
418 WORD icq_UDPSendMessage(icq_Link *icqlink, DWORD uin, const char *text) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
419 {
1977
7b3f1eb1ef7d [gaim-migrate @ 1987]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1912
diff changeset
420 char buf[ICQ_MAX_UDP_MESSAGE_SIZE];
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
421 icq_Packet *p;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
422
1977
7b3f1eb1ef7d [gaim-migrate @ 1987]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1912
diff changeset
423 strncpy(buf, text, sizeof(buf));
7b3f1eb1ef7d [gaim-migrate @ 1987]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1912
diff changeset
424 buf[sizeof(buf)-1] = 0;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
425 icq_RusConv("kw", buf);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
426
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
427 p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_SEND_THRU_SRV);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
428 icq_PacketAppend32(p, uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
429 icq_PacketAppend16(p, TYPE_MSG);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
430 icq_PacketAppendString(p, buf);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
431
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
432 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
433 return icqlink->d->icq_UDPSeqNum1-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
434 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
435
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
436 WORD icq_UDPSendURL(icq_Link *icqlink, DWORD uin, const char *url, const char *descr) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
437 {
1977
7b3f1eb1ef7d [gaim-migrate @ 1987]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1912
diff changeset
438 char buf1[ICQ_MAX_UDP_MESSAGE_SIZE], buf2[ICQ_MAX_UDP_MESSAGE_SIZE];
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
439 icq_Packet *p;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
440
1977
7b3f1eb1ef7d [gaim-migrate @ 1987]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1912
diff changeset
441 strncpy(buf1, descr, sizeof(buf1));
7b3f1eb1ef7d [gaim-migrate @ 1987]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1912
diff changeset
442 buf1[sizeof(buf1)-1] = 0;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
443 icq_RusConv("kw", buf1);
1977
7b3f1eb1ef7d [gaim-migrate @ 1987]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1912
diff changeset
444 strncpy(buf2, url, sizeof(buf2));
7b3f1eb1ef7d [gaim-migrate @ 1987]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1912
diff changeset
445 buf2[sizeof(buf2)-1] = 0;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
446
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
447 p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_SEND_THRU_SRV);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
448 icq_PacketAppend32(p, uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
449 icq_PacketAppend16(p, TYPE_URL);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
450 icq_PacketAppend16(p, strlen(buf1)+strlen(buf2)+2); /* length + the NULL + 0xFE delimiter */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
451 icq_PacketAppendStringFE(p, buf1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
452 icq_PacketAppendString0(p, buf2);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
453
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
454 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
455 return icqlink->d->icq_UDPSeqNum1-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
456 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
457
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
458 /**************************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
459 Sends a authorization to the server so the Mirabilis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
460 client can add the user.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
461 ***************************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
462 WORD icq_SendAuthMsg(icq_Link *icqlink, DWORD uin) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
463 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
464 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_SEND_THRU_SRV);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
465 icq_PacketAppend32(p, uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
466 icq_PacketAppend32(p, TYPE_AUTH);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
467 icq_PacketAppend16(p, 0);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
468 icq_UDPSockWrite(icqlink, p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
469
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
470 return icqlink->d->icq_UDPSeqNum1-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
471 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
472
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
473 /**************************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
474 Changes the users status on the server
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
475 ***************************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
476 void icq_ChangeStatus(icq_Link *icqlink, DWORD status) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
477 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
478 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_STATUS_CHANGE);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
479 icq_PacketAppend32(p, status);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
480 icqlink->icq_Status = status;
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
481 icq_UDPSockWrite(icqlink, p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
482 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
483
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
484 /********************************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
485 Sends a request to the server for info on a specific user
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
486 *********************************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
487 WORD icq_SendInfoReq(icq_Link *icqlink, DWORD uin) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
488 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
489 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_INFO_REQ);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
490 icq_PacketAppend32(p, uin);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
491 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
492 return icqlink->d->icq_UDPSeqNum1-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
493 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
494
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
495 /********************************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
496 Sends a request to the server for info on a specific user
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
497 *********************************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
498 WORD icq_SendExtInfoReq(icq_Link *icqlink, DWORD uin) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
499 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
500 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_EXT_INFO_REQ);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
501 icq_PacketAppend32(p, uin);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
502 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
503 return icqlink->d->icq_UDPSeqNum1-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
504 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
505
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
506 /**************************************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
507 Initializes a server search for the information specified
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
508 ***************************************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
509 void icq_SendSearchReq(icq_Link *icqlink, const char *email, const char *nick, const char *first,
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
510 const char *last) /* V5 */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
511 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
512 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_SEARCH_USER);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
513 icq_PacketAppendString(p, nick);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
514 icq_PacketAppendString(p, first);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
515 icq_PacketAppendString(p, last);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
516 icq_PacketAppendString(p, email);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
517 icq_UDPSockWrite(icqlink, p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
518 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
519
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
520 /**************************************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
521 Initializes a server search for the information specified
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
522 ***************************************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
523 void icq_SendSearchUINReq(icq_Link *icqlink, DWORD uin) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
524 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
525 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_SEARCH_UIN);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
526 icq_PacketAppend32(p, uin);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
527 icq_UDPSockWrite(icqlink, p);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
528 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
529
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
530 /**************************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
531 Registers a new uin in the ICQ network
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
532 ***************************************************/
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
533 void icq_RegNewUser(icq_Link *icqlink, const char *pass) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
534 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
535 char pass8[9];
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
536 icq_Packet *p = icq_UDPCreateStdSeqPacket(icqlink, UDP_CMD_REG_NEW_USER, icqlink->d->icq_UDPSeqNum1++);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
537 strncpy(pass8, pass, 8);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
538 icq_PacketAppendString(p, pass8);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
539 icq_PacketAppend32(p, 0xA0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
540 icq_PacketAppend32(p, 0x2461);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
541 icq_PacketAppend32(p, 0xA00000);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
542 icq_PacketAppend32(p, 0x00);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
543 icq_PacketGoto(p, 6);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
544 icq_PacketAppend32(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
545 icq_PacketAppend32(p, rand());
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
546 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
547 icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Send RegNewUser packet to the server\n");
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
548 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
549
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
550 WORD icq_UpdateUserInfo(icq_Link *icqlink, const char *nick, const char *first, const char *last,
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
551 const char *email) /* V5 */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
552 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
553 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_UPDATE_INFO);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
554 icq_PacketAppendString(p, nick);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
555 icq_PacketAppendString(p, first);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
556 icq_PacketAppendString(p, last);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
557 icq_PacketAppendString(p, email);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
558 /* auth (byte)? */
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
559 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
560 return icqlink->d->icq_UDPSeqNum1-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
561 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
562
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
563 WORD icq_UpdateAuthInfo(icq_Link *icqlink, DWORD auth) /* V5 */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
564 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
565 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_UPDATE_AUTH);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
566 icq_PacketAppend32(p, auth); /* NOT auth? */
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
567 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
568 return icqlink->d->icq_UDPSeqNum1-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
569 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
570
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
571 WORD icq_UpdateMetaInfoSet(icq_Link *icqlink, const char *nick, const char *first, const char *last,
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
572 const char *email, const char *email2, const char *email3,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
573 const char *city, const char *state, const char *phone, const char *fax,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
574 const char *street, const char *cellular, unsigned long zip,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
575 unsigned short cnt_code, unsigned char cnt_stat, unsigned char emailhide)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
576 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
577 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_META_USER);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
578 icq_PacketAppend16(p, META_CMD_SET_INFO);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
579 icq_PacketAppendString(p, nick);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
580 icq_PacketAppendString(p, first);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
581 icq_PacketAppendString(p, last);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
582 icq_PacketAppendString(p, email);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
583 icq_PacketAppendString(p, email2);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
584 icq_PacketAppendString(p, email3);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
585 icq_PacketAppendString(p, city);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
586 icq_PacketAppendString(p, state);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
587 icq_PacketAppendString(p, phone);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
588 icq_PacketAppendString(p, fax);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
589 icq_PacketAppendString(p, street);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
590 icq_PacketAppendString(p, cellular);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
591 icq_PacketAppend32(p, zip);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
592 icq_PacketAppend16(p, cnt_code);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
593 icq_PacketAppend8(p, cnt_stat);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
594 icq_PacketAppend8(p, emailhide);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
595 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
596 return icqlink->d->icq_UDPSeqNum2-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
597 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
598
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
599 WORD icq_UpdateMetaInfoHomepage(icq_Link *icqlink, unsigned char age, const char *homepage,
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
600 unsigned char year, unsigned char month, unsigned char day,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
601 unsigned char lang1, unsigned char lang2, unsigned char lang3)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
602 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
603 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_META_USER);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
604 (void)lang1;
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
605 (void)lang2;
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
606 (void)lang3;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
607 icq_PacketAppend16(p, META_CMD_SET_HOMEPAGE);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
608 icq_PacketAppend8(p, age);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
609 icq_PacketAppend16(p, 0x0200);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
610 icq_PacketAppendString(p, homepage);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
611 icq_PacketAppend8(p, year);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
612 icq_PacketAppend8(p, month);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
613 icq_PacketAppend8(p, day);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
614 icq_PacketAppend8(p, 0xFF /* lang1 */);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
615 icq_PacketAppend8(p, 0xFF /* lang2 */);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
616 icq_PacketAppend8(p, 0xFF /* lang3 */);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
617 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
618 return icqlink->d->icq_UDPSeqNum2-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
619 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
620
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
621 WORD icq_UpdateMetaInfoAbout(icq_Link *icqlink, const char *about)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
622 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
623 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_META_USER);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
624 icq_PacketAppend16(p, META_CMD_SET_ABOUT);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
625 icq_PacketAppendString(p, about);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
626 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
627 return icqlink->d->icq_UDPSeqNum2-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
628 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
629
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
630 WORD icq_UpdateMetaInfoSecurity(icq_Link *icqlink, unsigned char reqauth, unsigned char webpresence,
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
631 unsigned char pubip)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
632 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
633 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_META_USER);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
634 icq_PacketAppend16(p, META_CMD_SET_SECURE);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
635 icq_PacketAppend8(p, !reqauth);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
636 icq_PacketAppend8(p, webpresence);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
637 icq_PacketAppend8(p, pubip);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
638 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
639 return icqlink->d->icq_UDPSeqNum2-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
640 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
641
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
642 WORD icq_UpdateNewUserInfo(icq_Link *icqlink, const char *nick, const char *first, const char *last,
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
643 const char *email) /* V5 */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
644 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
645 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_NEW_USER_INFO);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
646 icq_PacketAppendString(p, nick);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
647 icq_PacketAppendString(p, first);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
648 icq_PacketAppendString(p, last);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
649 icq_PacketAppendString(p, email);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
650 icq_PacketAppend8(p, 1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
651 icq_PacketAppend8(p, 1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
652 icq_PacketAppend8(p, 1);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
653 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
654 return icqlink->d->icq_UDPSeqNum1-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
655 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
656
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
657 WORD icq_SendMetaInfoReq(icq_Link *icqlink, unsigned long uin)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
658 {
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
659 icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_META_USER);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
660 icq_PacketAppend16(p, META_CMD_REQ_INFO);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
661 icq_PacketAppend32(p, uin);
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
662 icq_UDPSockWrite(icqlink, p);
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
663 return icqlink->d->icq_UDPSeqNum2-1;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
664 }