annotate plugins/icq/udphandle.c @ 1760:c55038f061dd

[gaim-migrate @ 1770] maybe if i put these things in here, they'll magically get done.... committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 27 Apr 2001 20:09:11 +0000
parents 0ef6603d986e
children 7ec37e31e5eb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 /*
1498
0ef6603d986e [gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1432
diff changeset
3 $Id: udphandle.c 1508 2001-02-22 23:07:34Z warmenhoven $
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 $Log$
1498
0ef6603d986e [gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1432
diff changeset
5 Revision 1.4 2001/02/22 23:07:34 warmenhoven
0ef6603d986e [gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1432
diff changeset
6 updating icqlib
0ef6603d986e [gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1432
diff changeset
7
0ef6603d986e [gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1432
diff changeset
8 Revision 1.31 2001/02/22 05:40:04 bills
0ef6603d986e [gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1432
diff changeset
9 port tcp connect timeout code and UDP queue to new timeout manager
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
10
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
11 Revision 1.30 2001/01/15 06:17:35 denis
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
12 Applied patch from Andrey Chernomyrdin <andrey@excom.spb.su> to
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
13 handle icq2000 specific "You've been added" packet.
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
14
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
15 Revision 1.29 2000/11/02 07:28:30 denis
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
16 Do not ack unhandled protocol version.
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 Revision 1.28 2000/06/25 17:25:52 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 icq_HandleMetaUserInfo() handles all (!) available in original icq2k
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 Meta User Info packets along with other useful Meta* packets. (WOW! ;)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 Revision 1.27 2000/05/10 18:54:43 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 icq_Disconnect() now called before icq_Disconnected callback to
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 prevent high CPU usage in kicq's "reconnect on disconnect" code.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 Revision 1.26 2000/05/03 18:29:15 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 Callbacks have been moved to the ICQLINK structure.
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 Revision 1.25 2000/02/07 02:48:15 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 changed log message in HandleUserOnline
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 Revision 1.24 2000/01/16 03:59:10 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33 reworked list code so list_nodes don't need to be inside item structures,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 removed strlist code and replaced with generic list calls
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 Revision 1.23 1999/12/27 11:12:37 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 icq_UpdateMetaInfoSecurity() added for setting "My authorization is
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 required", "Web Aware" and "IP Publishing".
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 Revision 1.22 1999/12/14 03:37:06 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 removed old real_ip->ip masq hack, added store to remote_real_ip in
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 icq_ContactItem
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 Revision 1.21 1999/12/12 18:03:58 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 Authorization Request packet handling fixed.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 Revision 1.20 1999/11/29 17:18:31 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 icq_DoMsg() redone using string lists.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 Revision 1.18 1999/11/11 15:10:32 guruz
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 - Added Base for Webpager Messages. Please type "make fixme"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 - Removed Segfault when kicq is started the first time
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 Revision 1.17 1999/10/14 11:44:04 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 Cleanups.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57 Revision 1.16 1999/09/29 17:16:08 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 MailExpress message handler started.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 Revision 1.15 1999/07/18 20:23:54 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61 fixed tcp port bug in icq_HandleUserOnline, changed to use new byte-order
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 & contact list functions
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 Revision 1.14 1999/07/16 15:46:02 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 Cleaned up.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 Revision 1.13 1999/07/16 12:40:55 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68 ICQ UDP v5 implemented.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69 Encription for ICQ UDP v5 implemented.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 icq_Packet* unified interface for UDP packets implemented.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71 Multipacket support of ICQ UDP v5 support added.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 Revision 1.12 1999/07/12 15:13:45 cproch
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 - added definition of ICQLINK to hold session-specific global variabled
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 applications which have more than one connection are now possible
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76 - changed nearly every function defintion to support ICQLINK parameter
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78 Revision 1.11 1999/07/03 06:46:54 lord
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79 converting icq_userOnline callback parameters to correct
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 byte order.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82 Revision 1.10 1999/07/03 02:29:46 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 added code to HandleUserOnline to update tcp_flag
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 Revision 1.9 1999/04/29 09:40:54 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 Unsuccessful attempt to implement web presence (webaware) feature
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88 Revision 1.8 1999/04/18 01:58:37 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 changed icq_SrvAck call to icq_RequestNotify
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 Revision 1.7 1999/04/17 19:26:49 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92 removed *_link entries from icq_ContactItem, including cleaup/init code
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94 Revision 1.6 1999/04/14 15:05:39 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95 Cleanups for "strict" compiling (-ansi -pedantic)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96 Switched from icq_Log callback to icq_Fmt function.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98 Revision 1.5 1999/04/05 18:47:23 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99 initial chat support implemented
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101 Revision 1.4 1999/03/31 01:39:50 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102 added handling of tcp_flag in HandleLogin
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104 Revision 1.3 1999/03/28 03:35:17 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105 fixed function names so icqlib compiles, fixed bug in HandleUserOnline
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106 (remote_ip and remote_real_ip were not evaluating correctly), added
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107 hack so I can test using local network
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
108
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
109 Revision 1.2 1999/03/25 22:25:02 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110 modified icq_HandleUserOnline & Offline for new message_link
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
112 Revision 1.1 1999/03/24 11:37:38 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
113 Underscored files with TCP stuff renamed.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
114 TCP stuff cleaned up
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
115 Function names changed to corresponding names.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
116 icqlib.c splitted to many small files by subject.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117 C++ comments changed to ANSI C comments.
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 */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121 #include <stdlib.h>
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
123 #include "icqtypes.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
124 #include "icq.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
125 #include "icqlib.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
126 #include "udp.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
127 #include "icqpacket.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
128 #include "queue.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
129 #include "icqbyteorder.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130 #include "list.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
131
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
132 int icq_SplitFields(list *strList, const char *str)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
134 char *tmpBuf, *tmp, *ptr;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135 int count = 0;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
136
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137 tmpBuf = (char*)malloc(strlen(str)+1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
138 strcpy(tmpBuf, str);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139 ptr = tmpBuf;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
141 while(ptr)
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 char *p;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144 tmp = strchr(ptr, 0xFE);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 if(tmp != 0L)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 *tmp = 0;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148 tmp++;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150 count++;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151 p = (char *)malloc(strlen(ptr)+1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
152 strcpy(p, ptr);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153 list_enqueue(strList, p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
154 ptr = tmp;
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
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
157 free(tmpBuf);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 return count;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161 void icq_DoMsg(ICQLINK *link, DWORD type, WORD len, char *data, DWORD uin, BYTE hour,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 BYTE minute, BYTE day, BYTE month, WORD year)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
163 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 list *strList;
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
165 int fieldCount;
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
166
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
167 strList = list_new();
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168 switch(type)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
169 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
170 case TYPE_ADDED:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
171 /* Format: Nick, 0xFE, FName, 0xFE, LName, 0xFE, EMail */
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
172 fieldCount = icq_SplitFields(strList, data);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
173 if(fieldCount != 4 && fieldCount != 5)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
174 {
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
175 icq_FmtLog(link, ICQ_LOG_ERROR, "Bad TYPE_ADDED packet (expected 4/5 args, received %i)!\n",
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
176 fieldCount);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
177 return;
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 icq_RusConv("wk", list_at(strList, 0)); /* Nick */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180 icq_RusConv("wk", list_at(strList, 1)); /* FName */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
181 icq_RusConv("wk", list_at(strList, 2)); /* LName */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
182 icq_RusConv("wk", list_at(strList, 3)); /* EMail */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 icq_FmtLog(link, ICQ_LOG_MESSAGE, "%lu has added you to their contact list, "
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184 "Nick: %s, First Name: %s, Last Name: %s, EMail: %s\n",
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185 uin, list_at(strList, 0), list_at(strList, 1),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186 list_at(strList, 2), list_at(strList, 3));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
187 if(link->icq_RecvAdded)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188 (*link->icq_RecvAdded)(link, uin, hour, minute, day, month, year,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189 list_at(strList, 0), list_at(strList, 1),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 list_at(strList, 2), list_at(strList, 3));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192 case TYPE_AUTH_REQ:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193 /* Format: Nick, 0xFE, FName, 0xFE, LName, 0xFE, EMail, 0xFE, 0, 0xFE, Reason */
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
194 fieldCount = icq_SplitFields(strList, data);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
195 if(fieldCount != 6)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196 {
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
197 icq_FmtLog(link, ICQ_LOG_ERROR, "Bad TYPE_AUTH_REQ packet (expected 6 args, received %i)!\n",
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
198 fieldCount);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
199 return;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201 icq_RusConv("wk", list_at(strList, 0)); /* Nick */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202 icq_RusConv("wk", list_at(strList, 1)); /* FName */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203 icq_RusConv("wk", list_at(strList, 2)); /* LName */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204 icq_RusConv("wk", list_at(strList, 3)); /* EMail */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
205 icq_RusConv("wk", list_at(strList, 5)); /* Reason */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206 icq_FmtLog(link, ICQ_LOG_MESSAGE, "%lu has requested your authorization to be added to "
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207 "their contact list, Nick: %s, First Name: %s, Last Name: %s, "
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208 "EMail: %s, Reason: %s\n", uin, list_at(strList, 0), list_at(strList, 1),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
209 list_at(strList, 2), list_at(strList, 3), list_at(strList, 4));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210 if(link->icq_RecvAuthReq)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211 (*link->icq_RecvAuthReq)(link, uin, hour, minute, day, month, year, list_at(strList, 0),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212 list_at(strList, 1), list_at(strList, 2),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213 list_at(strList, 3), list_at(strList, 5));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 case TYPE_URL:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216 /* Format: Description, 0xFE, URL */
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
217 fieldCount = icq_SplitFields(strList, data);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
218 if(fieldCount != 2)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219 {
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
220 icq_FmtLog(link, ICQ_LOG_ERROR, "Bad TYPE_URL packet (expected 2 args, recived %i)!\n", fieldCount);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
221 return;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
222 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 icq_RusConv("wk", list_at(strList, 0)); /* Description */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224 icq_FmtLog(link, ICQ_LOG_MESSAGE, "URL received from %lu, URL: %s, Description: %s\n",
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225 uin, list_at(strList, 1), list_at(strList, 0));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 if(link->icq_RecvURL)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227 (*link->icq_RecvURL)(link, uin, hour, minute, day, month, year, list_at(strList, 1),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228 list_at(strList, 0));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
229 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
230 case TYPE_WEBPAGER:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
231 /* Format: Nick, 0xFE, Empty-FName, 0xFE, Empty-LName, 0xFE, EMail, 0xFE,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
232 * Reason(3), 0xFE, Message with IP & Subject */
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
233 fieldCount = icq_SplitFields(strList, data);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
234 if(fieldCount != 6)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235 {
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
236 icq_FmtLog(link, ICQ_LOG_ERROR, "Bad TYPE_WEBPAGER packet (expected 6 args, received %i)!\n",
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
237 fieldCount);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
238 return;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
239 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
240 icq_RusConv("wk", list_at(strList, 0)); /* Nick */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
241 icq_RusConv("wk", list_at(strList, 5)); /* Message */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
242 icq_FmtLog(link, ICQ_LOG_MESSAGE, "WebPager message received, Nick: %s, EMail: %s, "
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
243 "Message:\n%s\n", list_at(strList, 0), list_at(strList, 3),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
244 list_at(strList, 5));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
245 if(link->icq_RecvWebPager)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
246 (*link->icq_RecvWebPager)(link, hour, minute, day, month, year, list_at(strList, 0),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
247 list_at(strList, 3), list_at(strList, 5));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
248 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
249 case TYPE_EXPRESS:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250 /* Format: Nick, 0xFE, Empty-FName, 0xFE, Empty-LName, 0xFE, EMail, 0xFE,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
251 * Reason(3), 0xFE, Message Subject */
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
252 fieldCount = icq_SplitFields(strList, data);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
253 if(fieldCount != 6)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
254 {
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
255 icq_FmtLog(link, ICQ_LOG_ERROR, "Bad TYPE_EXPRESS packet (expected 6 args, received %i)!\n",
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
256 fieldCount);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
257 return;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
258 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
259 icq_RusConv("wk", list_at(strList, 0)); /* Nick */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 icq_RusConv("wk", list_at(strList, 5)); /* Message */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261 icq_FmtLog(link, ICQ_LOG_MESSAGE, "MailExpress message received, Nick: %s, EMail: %s, "
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 "Message:\n%s\n", list_at(strList, 0), list_at(strList, 3),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263 list_at(strList, 5));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
264 if(link->icq_RecvMailExpress)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
265 (*link->icq_RecvMailExpress)(link, hour, minute, day, month, year, list_at(strList, 0),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266 list_at(strList, 3), list_at(strList, 5));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
267 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268 default:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269 icq_RusConv("wk", data); /* Entire message */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270 icq_FmtLog(link, ICQ_LOG_MESSAGE, "Instant message type %i from %lu:\n%s\n", type, uin, data);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271 if(link->icq_RecvMessage)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272 (*link->icq_RecvMessage)(link, uin, hour, minute, day, month, year, data);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 list_delete(strList, free);
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
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277 void icq_HandleInfoReply(ICQLINK *link, icq_Packet *p)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 char *ptr1, *ptr2, *ptr3, *ptr4;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280 DWORD uin;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281 icq_PacketGotoUDPInData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
282 uin = icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283 ptr1 = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
284 ptr2 = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285 ptr3 = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286 ptr4 = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
287 icq_RusConv("wk", ptr1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
288 icq_RusConv("wk", ptr2);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289 icq_RusConv("wk", ptr3);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
290 icq_RusConv("wk", ptr4);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
291 icq_FmtLog(link, ICQ_LOG_MESSAGE, "Info reply for %lu\n", uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
292 if(link->icq_InfoReply)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
293 (*link->icq_InfoReply)(link, uin, ptr1, ptr2, ptr3, ptr4, icq_PacketRead8(p));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
294 icq_UDPAck(link, icq_PacketReadUDPInSeq1(p));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
295 free(ptr1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
296 free(ptr2);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
297 free(ptr3);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298 free(ptr4);
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
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
301 void icq_HandleExtInfoReply(ICQLINK *link, icq_Packet *p)
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 *ptr1, *ptr2, *ptr3, *ptr4, *ptr5;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
304 DWORD uin;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
305 WORD cnt_code, age;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
306 char cnt_stat, gender;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
307
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
308 icq_PacketGotoUDPInData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
309 uin = icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
310 ptr1 = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
311 cnt_code = icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
312 cnt_stat = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
313 ptr2 = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314 age = icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
315 gender = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316 ptr3 = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317 ptr4 = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
318 ptr5 = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
319 icq_RusConv("wk", ptr1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
320 icq_RusConv("wk", ptr2);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
321 icq_RusConv("wk", ptr3);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
322 icq_RusConv("wk", ptr4);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
323 icq_RusConv("wk", ptr5);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
324 icq_FmtLog(link, ICQ_LOG_MESSAGE, "Extended info reply for %lu\n", uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
325 if(link->icq_ExtInfoReply)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
326 (*link->icq_ExtInfoReply)(link, uin, (char*)ptr1, cnt_code, cnt_stat, (char*)ptr2, age,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
327 gender, (char*)ptr3, (char*)ptr4, (char*)ptr5);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328 icq_UDPAck(link, icq_PacketReadUDPInSeq1(p));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
329 free(ptr1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330 free(ptr2);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
331 free(ptr3);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
332 free(ptr4);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
333 free(ptr5);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
334 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336 void icq_HandleSearchReply(ICQLINK *link, icq_Packet *p)
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 char *ptr1, *ptr2, *ptr3, *ptr4, auth;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
339 DWORD uin;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
340 icq_PacketGotoUDPInData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
341 uin = icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
342 ptr1 = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
343 ptr2 = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
344 ptr3 = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
345 ptr4 = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346 icq_RusConv("wk", ptr1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
347 icq_RusConv("wk", ptr2);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
348 icq_RusConv("wk", ptr3);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
349 icq_RusConv("wk", ptr4);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
350 auth = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
351 icq_FmtLog(link, ICQ_LOG_MESSAGE, "User found %lu, Nick: %s, First Name: %s, Last Name: %s, "
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
352 "EMail: %s, Auth: %s\n", uin, ptr1, ptr2, ptr3, ptr4, auth==1?"no":"yes");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
353 if(link->icq_UserFound)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
354 (*link->icq_UserFound)(link, uin, (char*)ptr1, (char*)ptr2, (char*)ptr3, (char*)ptr4, auth);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
355 icq_UDPAck(link, icq_PacketReadUDPInSeq1(p));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
356 free(ptr1);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
357 free(ptr2);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
358 free(ptr3);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359 free(ptr4);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
360 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
361
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
362 /************************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
363 This is called when a user goes offline
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
364 *************************************************/
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
365 void icq_HandleUserOffline(ICQLINK *link, icq_Packet *p)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
366 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
367 DWORD remote_uin;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
368 icq_ContactItem *ptr;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
369
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
370 icq_PacketGotoUDPInData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
371 remote_uin = icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
372 icq_FmtLog(link, ICQ_LOG_MESSAGE, "User %lu logged off\n", remote_uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373 if(link->icq_UserOffline)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
374 (*link->icq_UserOffline)(link, remote_uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
375
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
376 ptr=icq_ContactFind(link, remote_uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
377 if(ptr)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
378 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
379 ptr->remote_ip = 0;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
380 ptr->remote_port = 0;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
381 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
382 icq_UDPAck(link, icq_PacketReadUDPInSeq1(p));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
383 }
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 void icq_HandleUserOnline(ICQLINK *link, icq_Packet *p)
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 DWORD remote_uin, new_status, remote_ip, remote_real_ip;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
388 DWORD remote_port; /* Why Mirabilis used 4 bytes for port? */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
389 BYTE tcp_flag;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
390 icq_ContactItem *ptr;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
391
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
392 icq_PacketGotoUDPInData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
393 remote_uin = icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
394 remote_ip = ntohl(icq_PacketRead32n(p)); /* icqtohl() */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
395 remote_port = icqtohl(icq_PacketRead32n(p));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
396 remote_real_ip = ntohl(icq_PacketRead32n(p)); /* icqtohl() */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
397 tcp_flag = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
398 new_status = icq_PacketRead32(p);
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 icq_FmtLog(link, ICQ_LOG_MESSAGE,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401 "User %lu (%s = 0x%X) logged on. tcp_flag=0x%X IP=%08X, real IP=%08X, port=%d\n",
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
402 remote_uin, icq_ConvertStatus2Str(new_status), new_status, tcp_flag, remote_ip,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
403 remote_real_ip, remote_port);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
404 if(link->icq_UserOnline)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
405 (*link->icq_UserOnline)(link, remote_uin, new_status, remote_ip, remote_port, remote_real_ip, tcp_flag);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
406
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
407 ptr=icq_ContactFind(link, remote_uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
408 if(ptr)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
409 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
410 ptr->remote_ip=remote_ip;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
411 ptr->remote_real_ip=remote_real_ip;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
412 ptr->remote_port = remote_port;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
413 ptr->tcp_flag = tcp_flag;
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 icq_UDPAck(link, icq_PacketReadUDPInSeq1(p));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
416 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
417
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
418 void icq_HandleStatusChange(ICQLINK *link, icq_Packet *p)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
419 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
420 unsigned long remote_uin, new_status;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
421
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
422 icq_PacketGotoUDPInData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
423 remote_uin = icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
424 new_status = icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
425 icq_FmtLog(link, ICQ_LOG_MESSAGE, "%lu changed status to %s (0x%X)\n", remote_uin,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
426 icq_ConvertStatus2Str(new_status), new_status);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
427 if(link->icq_UserStatusUpdate)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
428 (*link->icq_UserStatusUpdate)(link, remote_uin, new_status);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
429 icq_UDPAck(link, icq_PacketReadUDPInSeq1(p));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
430 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
431
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
432 void icq_HandleMetaUserInfo(ICQLINK *link, icq_Packet *p)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
433 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
434 unsigned short subcmd, country, seq2, age, occupation, wcountry;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
435 unsigned char res, auth, timezone, webaware, hideip, gender;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
436 unsigned char *nick, *first, *last, *email, *about, *city;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
437 unsigned char *pri_eml, *sec_eml, *old_eml;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
438 unsigned char *phone, *fax, *street, *cellular, *state;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
439 unsigned char *wcity, *wstate, *wphone, *wfax, *waddress;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
440 unsigned char *company, *department, *job, *whomepage;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
441 unsigned char *homepage;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
442 unsigned char byear, bmonth, bday, lang1, lang2, lang3, inum, i;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
443 unsigned char anum, bnum, hnum;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
444 unsigned long uin, zip, wzip;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
445 unsigned char *empty = "";
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
446 unsigned char *interests[4] = {0, 0, 0, 0};
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
447 unsigned short icategory[4] = {0, 0, 0, 0};
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
448 unsigned char *affiliations[4] = {0, 0, 0, 0};
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
449 unsigned short acategory[4] = {0, 0, 0, 0};
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
450 unsigned char *backgrounds[4] = {0, 0, 0, 0};
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
451 unsigned short bcategory[4] = {0, 0, 0, 0};
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
452 unsigned char *hpcat[4] = {0, 0, 0, 0};
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
453 unsigned short hcategory[4] = {0, 0, 0, 0};
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
454
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
455 seq2 = icq_PacketReadUDPInSeq2(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
456 icq_PacketGotoUDPInData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
457 subcmd = icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
458 res = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
459 if(res == META_SRV_FAILURE)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
460 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
461 icq_FmtLog(link, ICQ_LOG_WARNING, "META failure\n");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
462 if(link->icq_RequestNotify)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
463 (*link->icq_RequestNotify)(link, seq2, ICQ_NOTIFY_FAILED, sizeof(subcmd), &subcmd);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
464 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
465 else
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
466 switch(subcmd)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
467 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
468 case META_SRV_USER_FOUND:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
469 uin = icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
470 nick = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
471 first = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
472 last = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
473 email = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
474 auth = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
475 icq_PacketRead16(p); // ???
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
476 icq_PacketRead32(p); // ???
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
477 icq_RusConv("wk", nick);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
478 icq_RusConv("wk", first);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
479 icq_RusConv("wk", last);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
480 icq_RusConv("wk", email);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
481 icq_FmtLog(link, ICQ_LOG_MESSAGE, "META User Found %lu, Nick: %s, First Name: %s, "\
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
482 "Last Name: %s, EMail: %s, Auth: %s\n", seq2, uin, nick, first, last,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
483 email, auth==1?"no":"yes");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
484 if(link->icq_MetaUserFound)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
485 (*link->icq_MetaUserFound)(link, seq2, uin, nick, first, last, email, auth);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
486 free(nick);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
487 free(first);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
488 free(last);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
489 free(email);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
490 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
491 case META_SRV_USER_INFO: // finished!
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
492 nick = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
493 first = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
494 last = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
495 pri_eml = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
496 sec_eml = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
497 old_eml = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
498 city = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
499 state = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
500 phone = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
501 fax = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
502 street = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
503 cellular = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
504 zip = icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
505 country = icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
506 timezone = icq_PacketRead8(p); // +1 = -30min, -1 = +30min (-4 = GMT+0200)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
507 auth = icq_PacketRead8(p); // 1 - no auth required, 0 - required
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
508 webaware = icq_PacketRead8(p); // 1 - yes, 0 - no
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
509 hideip = icq_PacketRead8(p); // 1 - yes, 0 - no
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
510 icq_RusConv("wk", nick);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
511 icq_RusConv("wk", first);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
512 icq_RusConv("wk", last);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
513 icq_RusConv("wk", pri_eml);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
514 icq_RusConv("wk", sec_eml);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
515 icq_RusConv("wk", old_eml);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
516 icq_RusConv("wk", city);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
517 icq_RusConv("wk", state);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
518 icq_RusConv("wk", phone);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
519 icq_RusConv("wk", fax);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
520 icq_RusConv("wk", street);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
521 icq_RusConv("wk", cellular);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
522 icq_FmtLog(link, ICQ_LOG_MESSAGE, "META User Info: %s, %s, %s, "\
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
523 "%s, %s, %s, %s, %s, %s, %s, %s, %s, %lu, %s, %i, %s, %s, %s\n",
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
524 nick, first, last, pri_eml, sec_eml, old_eml, city, state, phone,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
525 fax, street, cellular, zip, icq_GetCountryName(country), timezone,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
526 auth?"false":"true", webaware?"true":"false", hideip?"true":"false");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
527 if(link->icq_MetaUserInfo)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
528 (*link->icq_MetaUserInfo)(link, seq2, nick, first, last, pri_eml, sec_eml,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
529 old_eml, city, state, phone, fax, street, cellular,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
530 zip, country, timezone, auth, webaware, hideip);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
531 free(nick);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
532 free(first);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
533 free(last);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
534 free(pri_eml);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
535 free(sec_eml);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
536 free(old_eml);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
537 free(city);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
538 free(state);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
539 free(phone);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
540 free(fax);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
541 free(street);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
542 free(cellular);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
543 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
544 case META_SRV_USER_WORK: // finished!
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
545 wcity = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
546 wstate = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
547 wphone = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
548 wfax = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
549 waddress = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
550 wzip = icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
551 wcountry = icq_PacketRead16(p); // icq_GetCountryName()
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
552 company = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
553 department = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
554 job = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
555 occupation = icq_PacketRead16(p); // icq_GetMetaOccupationName()
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
556 whomepage = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
557 icq_RusConv("wk", wcity);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
558 icq_RusConv("wk", wstate);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
559 icq_RusConv("wk", wphone);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
560 icq_RusConv("wk", wfax);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
561 icq_RusConv("wk", waddress);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
562 icq_RusConv("wk", company);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
563 icq_RusConv("wk", department);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
564 icq_RusConv("wk", job);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
565 icq_RusConv("wk", whomepage);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
566 icq_FmtLog(link, ICQ_LOG_MESSAGE, "META User Work: %s, %s, %s, "\
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
567 "%s, %s, %lu, %s, %s, %s, %s, %s, %s\n", wcity, wstate,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
568 wphone, wfax, waddress, wzip, icq_GetCountryName(wcountry),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
569 company, department, job, icq_GetMetaOccupationName(occupation),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
570 whomepage);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
571 if(link->icq_MetaUserWork)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
572 (*link->icq_MetaUserWork)(link, seq2, wcity, wstate, wphone, wfax,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
573 waddress, wzip, wcountry, company, department,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
574 job, occupation, whomepage);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
575 free(wcity);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
576 free(wstate);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
577 free(wphone);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
578 free(wfax);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
579 free(waddress);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
580 free(company);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
581 free(department);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
582 free(job);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
583 free(whomepage);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
584 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
585 case META_SRV_USER_MORE: // finished!
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
586 age = icq_PacketRead16(p); // 0xFFFF - not entered
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
587 gender = icq_PacketRead8(p); // 1 - female, 2 - male
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
588 homepage = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
589 byear = icq_PacketRead8(p); // starting from 1900
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
590 bmonth = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
591 bday = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
592 lang1 = icq_PacketRead8(p); // icq_GetMetaLanguageName()
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
593 lang2 = icq_PacketRead8(p); // icq_GetMetaLanguageName()
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
594 lang3 = icq_PacketRead8(p); // icq_GetMetaLanguageName()
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
595 icq_RusConv("wk", homepage);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
596 icq_FmtLog(link, ICQ_LOG_MESSAGE, "META User More: %i, %s, %s, "\
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
597 "%02i/%02i/%04i, %s, %s, %s\n", age,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
598 gender==1?"female":gender==2?"male":"not entered",
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
599 homepage, bday, bmonth, byear+1900, icq_GetMetaLanguageName(lang1),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
600 icq_GetMetaLanguageName(lang2), icq_GetMetaLanguageName(lang3));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
601 if(link->icq_MetaUserMore)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
602 (*link->icq_MetaUserMore)(link, seq2, age, gender, homepage, byear,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
603 bmonth, bday, lang1, lang2, lang3);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
604 free(homepage);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
605 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
606 case META_SRV_USER_ABOUT: // finished!
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
607 about = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
608 icq_RusConv("wk", about);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
609 icq_FmtLog(link, ICQ_LOG_MESSAGE, "META User About: %s\n", about);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
610 if(link->icq_MetaUserAbout)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
611 (*link->icq_MetaUserAbout)(link, seq2, about);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
612 free(about);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
613 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
614 case META_SRV_USER_INTERESTS: // finished!
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
615 inum = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
616 for(i=0; i<inum && i<4; i++)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
617 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
618 icategory[i] = icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
619 interests[i] = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
620 icq_RusConv("wk", interests[i]);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
621 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
622 icq_FmtLog(link, ICQ_LOG_MESSAGE, "META User Interests: %i, %i - %s, "\
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
623 "%i - %s, %i - %s, %i - %s\n", inum, icategory[0],
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
624 interests[0]?interests[0]:empty, icategory[1], interests[1]?interests[1]:empty,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
625 icategory[2], interests[2]?interests[2]:empty, icategory[3],
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
626 interests[3]?interests[3]:empty);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
627 if(link->icq_MetaUserInterests)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
628 (*link->icq_MetaUserInterests)(link, seq2, inum, icategory[0], interests[0],
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
629 icategory[1], interests[1], icategory[2],
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
630 interests[2], icategory[3], interests[3]);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
631 for(i=0; i<inum && i<4; i++)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
632 free(interests[i]);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
633 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
634 case META_SRV_USER_AFFILIATIONS: // finished!
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
635 bnum = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
636 for(i=0; i<bnum && i<4; i++)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
637 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
638 bcategory[i] = icq_PacketRead16(p); // icq_GetMetaBackgroundName()
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
639 backgrounds[i] = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
640 icq_RusConv("wk", backgrounds[i]);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
641 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
642 anum = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
643 for(i=0; i<anum && i<4; i++)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
644 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
645 acategory[i] = icq_PacketRead16(p); // icq_GetMetaAffiliationName()
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
646 affiliations[i] = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
647 icq_RusConv("wk", affiliations[i]);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
648 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
649 icq_FmtLog(link, ICQ_LOG_MESSAGE, "META User Affiliations: %i, %s - %s, "\
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
650 "%s - %s, %s - %s, %s - %s; Backgrounds: %i, %s - %s, %s - %s, "\
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
651 "%s - %s, %s - %s\n", anum,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
652 icq_GetMetaAffiliationName(acategory[0]), affiliations[0]?affiliations[0]:empty,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
653 icq_GetMetaAffiliationName(acategory[1]), affiliations[1]?affiliations[1]:empty,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
654 icq_GetMetaAffiliationName(acategory[2]), affiliations[2]?affiliations[2]:empty,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
655 icq_GetMetaAffiliationName(acategory[3]), affiliations[3]?affiliations[3]:empty,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
656 bnum, icq_GetMetaBackgroundName(bcategory[0]), backgrounds[0]?backgrounds[0]:empty,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
657 icq_GetMetaBackgroundName(bcategory[1]), backgrounds[1]?backgrounds[1]:empty,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
658 icq_GetMetaBackgroundName(bcategory[2]), backgrounds[2]?backgrounds[2]:empty,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
659 icq_GetMetaBackgroundName(bcategory[3]), backgrounds[3]?backgrounds[3]:empty);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
660 if(link->icq_MetaUserAffiliations)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
661 (*link->icq_MetaUserAffiliations)(link, seq2, anum, acategory[0],
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
662 affiliations[0], acategory[1], affiliations[1], acategory[2],
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
663 affiliations[2], acategory[3], affiliations[3], bnum,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
664 bcategory[0], backgrounds[0], bcategory[1], backgrounds[1],
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
665 bcategory[2], backgrounds[2], bcategory[3], backgrounds[3]);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
666 for(i=0; i<bnum && i<4; i++)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
667 free(backgrounds[i]);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
668 for(i=0; i<anum && i<4; i++)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
669 free(affiliations[i]);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
670 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
671 case META_SRV_USER_HPCATEGORY: // finished!
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
672 hnum = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
673 for(i=0; i<hnum && i<1; i++)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
674 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
675 hcategory[i] = icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
676 hpcat[i] = icq_PacketReadStringNew(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
677 icq_RusConv("wk", hpcat[i]);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
678 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
679 icq_FmtLog(link, ICQ_LOG_MESSAGE, "META User Homepage Category: %i, %i - %s\n",
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
680 hnum, hcategory[0], hpcat[0]);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
681 if(link->icq_MetaUserHomePageCategory)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
682 (*link->icq_MetaUserHomePageCategory)(link, seq2, hnum, hcategory[0], hpcat[0]?hpcat[0]:empty);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
683 for(i=0; i<hnum && i<1; i++)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
684 free(hpcat[i]);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
685 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
686 case META_SRV_RES_INFO:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
687 case META_SRV_RES_HOMEPAGE:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
688 case META_SRV_RES_ABOUT:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
689 case META_SRV_RES_SECURE:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
690 case META_SRV_RES_PASS:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
691 icq_FmtLog(link, ICQ_LOG_MESSAGE, "META success\n");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
692 if(link->icq_RequestNotify)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
693 (*link->icq_RequestNotify)(link, seq2, ICQ_NOTIFY_SUCCESS, sizeof(subcmd), &subcmd);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
694 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
695 default:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
696 icq_FmtLog(link, ICQ_LOG_MESSAGE, "META User - 0x%04X\n", subcmd);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
697 icq_PacketUDPDump(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
698 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
699 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
700 icq_UDPAck(link, icq_PacketReadUDPInSeq1(p));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
701 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
702
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
703 void icq_HandleMultiPacket(ICQLINK *link, icq_Packet *p)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
704 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
705 icq_Packet *tmp;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
706 int num, i;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
707 icq_PacketGotoUDPInData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
708 num = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
709
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
710 icq_FmtLog(link, ICQ_LOG_MESSAGE, "MultiPacket: %i packets\n", num);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
711
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
712 for(i = 0; i < num; i++)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
713 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
714 tmp = icq_PacketNew();
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
715 tmp->length = icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
716 memcpy(tmp->data, &(p->data[p->cursor]), tmp->length);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
717 icq_PacketAdvance(p, tmp->length);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
718 icq_ServerResponse(link, tmp);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
719 icq_PacketDelete(tmp);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
720 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
721 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
722
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
723 void icq_ServerResponse(ICQLINK *link, icq_Packet *p)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
724 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
725 time_t cur_time;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
726 struct tm *tm_str;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
727 int len;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
728 struct in_addr in_a;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
729 DWORD uin;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
730 WORD year, type, seq, cmd;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
731 BYTE month, day, hour, minute;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
732
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
733 seq = icq_PacketReadUDPInSeq1(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
734 cmd = icq_PacketReadUDPInCmd(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
735
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
736 if(icq_PacketReadUDPInVer(p) == 5) /* We understand only V5 packets! */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
737 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
738 switch(cmd)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
739 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
740 case UDP_SRV_ACK:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
741 icq_FmtLog(link, ICQ_LOG_MESSAGE, "The server acknowledged the command\n");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
742 if(link->icq_RequestNotify)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
743 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
744 (*link->icq_RequestNotify)(link, seq, ICQ_NOTIFY_ACK, 0, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
745 (*link->icq_RequestNotify)(link, seq, ICQ_NOTIFY_SUCCESS, 0, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
746 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
747 icq_UDPQueueDelSeq(link, seq);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
748 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
749 case UDP_SRV_MULTI_PACKET:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
750 icq_HandleMultiPacket(link, p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
751 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
752 case UDP_SRV_NEW_UIN:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
753 uin = icq_PacketReadUDPInUIN(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
754 icq_FmtLog(link, ICQ_LOG_MESSAGE, "The new uin is %lu\n", uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
755 icq_UDPAck(link, seq);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
756 if(link->icq_NewUIN)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
757 (*link->icq_NewUIN)(link, uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
758 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
759 case UDP_SRV_LOGIN_REPLY:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
760 icq_PacketGotoUDPInData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
761 link->icq_OurIP = ntohl(icq_PacketRead32n(p));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
762 /* icq_OurIp = icq_PacketRead32(p); */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
763 in_a.s_addr = htonl(link->icq_OurIP);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
764 icq_FmtLog(link, ICQ_LOG_MESSAGE, "Login successful, UIN: %lu, IP: %s\n",
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
765 link->icq_Uin, inet_ntoa(in_a));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
766 icq_UDPAck(link, seq);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
767 icq_SendLogin1(link);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
768 icq_SendContactList(link);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
769 icq_SendVisibleList(link);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
770 if(link->icq_Logged)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
771 (*link->icq_Logged)(link);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
772 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
773 case UDP_SRV_OFFLINE_MESSAGE: /* Offline message through the server */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
774 icq_PacketGotoUDPInData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
775 uin = icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
776 year = icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
777 month = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
778 day = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
779 hour = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
780 minute = icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
781 type = icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
782 len = icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
783 icq_DoMsg(link, type, len, (char*)&p->data[p->cursor], uin, hour, minute, day, month, year);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
784 icq_UDPAck(link, seq);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
785 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
786 case UDP_SRV_X1: /* unknown message sent after login*/
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
787 icq_FmtLog(link, ICQ_LOG_MESSAGE, "Acknowleged UDP_SRV_X1 (Begin messages)\n");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
788 icq_UDPAck(link, seq);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
789 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
790 case UDP_SRV_X2: /* unknown message sent after login*/
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
791 icq_FmtLog(link, ICQ_LOG_MESSAGE, "Acknowleged UDP_SRV_X2 (Done old messages)\n");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
792 icq_UDPAck(link, seq);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
793 icq_SendGotMessages(link);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
794 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
795 case UDP_SRV_INFO_REPLY:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
796 icq_HandleInfoReply(link, p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
797 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
798 case UDP_SRV_EXT_INFO_REPLY:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
799 icq_HandleExtInfoReply(link, p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
800 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
801 case UDP_SRV_USER_ONLINE:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
802 icq_HandleUserOnline(link, p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
803 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
804 case UDP_SRV_USER_OFFLINE:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
805 icq_HandleUserOffline(link, p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
806 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
807 case UDP_SRV_TRY_AGAIN:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
808 icq_FmtLog(link, ICQ_LOG_WARNING, "Server is busy, please try again\n");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
809 icq_Login(link, link->icq_Status);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
810 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
811 case UDP_SRV_STATUS_UPDATE:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
812 icq_HandleStatusChange(link, p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
813 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
814 case UDP_SRV_GO_AWAY:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
815 icq_FmtLog(link, ICQ_LOG_ERROR, "Server has forced us to disconnect\n");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
816 if(link->icq_Disconnected)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
817 (*link->icq_Disconnected)(link);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
818 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
819 case UDP_SRV_END_OF_SEARCH:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
820 icq_FmtLog(link, ICQ_LOG_MESSAGE, "Search done\n");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
821 if(link->icq_SearchDone)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
822 (*link->icq_SearchDone)(link);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
823 icq_UDPAck(link, seq);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
824 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
825 case UDP_SRV_USER_FOUND:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
826 icq_HandleSearchReply(link, p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
827 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
828 case UDP_SRV_ONLINE_MESSAGE: /* Online message through the server */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
829 cur_time = time(0L);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
830 tm_str = localtime(&cur_time);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
831 icq_PacketGotoUDPInData(p, 0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
832 uin = icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
833 type = icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
834 len = icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
835 icq_DoMsg(link, type, len, (char*)&p->data[p->cursor], uin, tm_str->tm_hour,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
836 tm_str->tm_min, tm_str->tm_mday, tm_str->tm_mon+1, tm_str->tm_year+1900);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
837 icq_UDPAck(link, seq);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
838 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
839 case UDP_SRV_WRONG_PASSWORD:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
840 icq_FmtLog(link, ICQ_LOG_ERROR, "Wrong password\n");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
841 if(link->icq_WrongPassword)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
842 (*link->icq_WrongPassword)(link);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
843 icq_UDPAck(link, seq);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
844 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
845 case UDP_SRV_INVALID_UIN:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
846 icq_FmtLog(link, ICQ_LOG_WARNING, "Invalid UIN\n");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
847 if(link->icq_InvalidUIN)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
848 (*link->icq_InvalidUIN)(link);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
849 icq_UDPAck(link, seq);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
850 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
851 case UDP_SRV_META_USER:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
852 icq_HandleMetaUserInfo(link, p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
853 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
854 default: /* commands we dont handle yet */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
855 icq_FmtLog(link, ICQ_LOG_WARNING, "Unhandled message %04x, Version: %x, "
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
856 "Sequence: %04x, Size: %d\n", cmd, icq_PacketReadUDPInVer(p),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
857 seq, p->length);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
858 icq_UDPAck(link, seq); /* fake like we know what we're doing */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
859 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
860 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
861 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
862 else
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
863 {
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
864 icq_FmtLog(link, ICQ_LOG_WARNING, "Unhandled protocol version! Message %04x, Version: %x, "
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
865 "Sequence: %04x, Size: %d\n", cmd, icq_PacketReadUDPInVer(p),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
866 seq, p->length);
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
867 /* icq_UDPAck(link, seq); DO NOT ACK unhandled protocol version! */
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
868 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
869 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
870
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
871 /******************************************
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
872 Handles packets that the server sends to us.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
873 *******************************************/
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
874 void icq_HandleServerResponse(ICQLINK *link)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
875 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
876 WORD seq, cmd;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
877 int s;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
878 icq_Packet *p;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
879
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
880 p = icq_PacketNew();
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
881 s = icq_UDPSockRead(link, p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
882 p->length = s;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
883 if(s<=0)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
884 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
885 icq_FmtLog(link, ICQ_LOG_FATAL, "Connection terminated\n");
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
886 icq_Disconnect(link);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
887 if(link->icq_Disconnected)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
888 (*link->icq_Disconnected)(link);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
889 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
890 seq = icq_PacketReadUDPInSeq1(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
891 cmd = icq_PacketReadUDPInCmd(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
892 if(icq_GetServMess(link, seq) && cmd != UDP_SRV_NEW_UIN && cmd != UDP_SRV_GO_AWAY && cmd != UDP_SRV_ACK)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
893 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
894 icq_FmtLog(link, ICQ_LOG_WARNING, "Ignored a message cmd %04x, seq %04x\n", cmd, seq);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
895 icq_UDPAck(link, seq); /* LAGGGGG!! */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
896 icq_PacketDelete(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
897 return;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
898 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
899 if(cmd != UDP_SRV_ACK)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
900 icq_SetServMess(link, seq);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
901
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
902 icq_ServerResponse(link, p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
903
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
904 icq_PacketDelete(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
905 }