annotate plugins/icq/tcphandle.c @ 1564:aa69b15d9403

[gaim-migrate @ 1574] you may want to make distclean after updating, it'll save you some disk space committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 11 Mar 2001 12:38:59 +0000
parents 4c510ca3563f
children 8ed70631ed15
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 /*
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
3 $Id: tcphandle.c 1442 2001-01-28 01:52:27Z warmenhoven $
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 $Log$
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
5 Revision 1.3 2001/01/28 01:52:27 warmenhoven
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
6 icqlib 1.1.5
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
7
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
8 Revision 1.16 2001/01/24 05:11:14 bills
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
9 applied patch from Robin Ericsson <lobbin@localhost.nu> which implements
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
10 receiving contact lists. See new icq_RecvContactList callback.
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
11
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
12 Revision 1.15 2001/01/17 01:31:47 bills
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
13 Rework chat and file interfaces; implement socket notifications.
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.14 2000/12/06 05:15:45 denis
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
16 Handling for mass TCP messages has been added based on patch by
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
17 Konstantin Klyagin <konst@konst.org.ua>
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
18
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
19 Revision 1.13 2000/08/13 19:44:41 denis
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
20 Cyrillic recoding on received URL description added.
1152
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.12 2000/07/09 22:19:35 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 added new *Close functions, use *Close functions instead of *Delete
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 where correct, and misc cleanup
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.11 2000/06/25 16:36:16 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 '\n' was added at the end of log messages.
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.10 2000/05/04 15:57:20 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 Reworked file transfer notification, small bugfixes, and cleanups.
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.9 2000/05/03 18:29:15 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33 Callbacks have been moved to the ICQLINK structure.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 Revision 1.8 2000/04/05 14:37:02 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 Applied patch from "Guillaume R." <grs@mail.com> for basic Win32
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 compatibility.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39 Revision 1.7 2000/01/20 20:06:00 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 removed debugging printfs
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 Revision 1.6 2000/01/20 19:59:15 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 first implementation of sending file requests
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 Revision 1.5 1999/11/30 09:51:42 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 more file xfer logic added
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 Revision 1.4 1999/11/11 15:10:30 guruz
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 - Added Base for Webpager Messages. Please type "make fixme"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 - Removed Segfault when kicq is started the first time
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 Revision 1.3 1999/10/01 02:28:51 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 icq_TCPProcessHello returns something now :)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 Revision 1.2 1999/10/01 00:49:20 lord
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 some compilation problems are fixed.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 Revision 1.1 1999/09/29 19:47:21 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59 reworked chat/file handling. fixed chat. (it's been broke since I put
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 non-blocking connects in)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 Revision 1.15 1999/07/16 15:45:59 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63 Cleaned up.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 Revision 1.14 1999/07/16 12:10:10 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66 tcp_packet* functions renamed to icq_Packet*
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 Cleaned up.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69 Revision 1.13 1999/07/12 15:13:41 cproch
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 - added definition of ICQLINK to hold session-specific global variabled
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71 applications which have more than one connection are now possible
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 - changed nearly every function defintion to support ICQLINK parameter
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 Revision 1.12 1999/06/30 13:51:25 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 cleanups
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77 Revision 1.11 1999/05/03 21:41:30 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78 initial file xfer support added- untested
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 Revision 1.10 1999/04/29 09:36:06 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81 Cleanups, warning removed
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 Revision 1.9 1999/04/17 19:40:33 bills
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84 reworked code to use icq_TCPLinks instead of icq_ContactItem entries.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 modified ProcessChatPacket to negotiate both sending and receiving chat
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 requests properly.
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/14 15:12:02 denis
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 Cleanups for "strict" compiling (-ansi -pedantic)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90 icq_ContactItem parameter added to function icq_TCPOnMessageReceived()
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91 Segfault fixed on spoofed messages.
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92
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
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
95 #include <stdlib.h>
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96 #include <time.h>
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 #ifndef _WIN32
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99 #include <unistd.h>
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100 #endif
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102 #include "icqtypes.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103 #include "icq.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104 #include "icqlib.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106 #include "tcp.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107 #include "stdpackets.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
108 #include "tcplink.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
109
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110 void icq_TCPOnMessageReceived(ICQLINK *link, DWORD uin, const char *message, DWORD id, icq_TCPLink *plink);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111 void icq_TCPOnURLReceived(ICQLINK *link, DWORD uin, const char *message, DWORD id);
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
112 void icq_TCPOnContactListReceived(ICQLINK *link, DWORD uin, const char *message, DWORD id);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
113 void icq_TCPOnChatReqReceived(ICQLINK *link, DWORD uin, const char *message, DWORD id);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
114 void icq_TCPOnFileReqReceived(ICQLINK *link, DWORD uin, const char *message,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
115 const char *filename, unsigned long filesize, DWORD id);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
116 void icq_TCPProcessAck(ICQLINK *link, icq_Packet *p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117 void icq_HandleChatAck(icq_TCPLink *plink, icq_Packet *p, int port);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
118 void icq_HandleChatHello(icq_TCPLink *plink);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
119 void icq_HandleFileHello(icq_TCPLink *plink);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120 void icq_HandleFileAck(icq_TCPLink *plink, icq_Packet *p, int port);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122 void icq_TCPProcessPacket(icq_Packet *p, icq_TCPLink *plink)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
123 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
124 DWORD uin;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
125 WORD version;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
126 WORD command;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
127 WORD type;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
128 WORD status;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
129 DWORD command_type;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130 DWORD filesize = 0;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
131 DWORD port = 0;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
132
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133 const char *message;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
134 const char *filename = 0;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
136 icq_PacketBegin(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137 (void)icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
138 version=icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139 command=icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140 (void)icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
141
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
142 uin=icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143 type=icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144 message=icq_PacketReadString(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 (void)icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146 (void)icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 (void)icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148 (void)icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149 status=icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150 command_type=icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
152 switch(type & ~ICQ_TCP_MASS_MASK)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
154 case ICQ_TCP_MSG_MSG:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
155 case ICQ_TCP_MSG_URL:
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
156 case ICQ_TCP_MSG_CONTACTLIST:
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
157 p->id=icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 break;
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 case ICQ_TCP_MSG_CHAT:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161 (void)icq_PacketReadString(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 (void)icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
163 (void)icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 port=icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
165 p->id=icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
166 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
167
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168 case ICQ_TCP_MSG_FILE:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
169 (void)icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
170 (void)icq_PacketRead16(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
171 filename=icq_PacketReadString(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
172 filesize=icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
173 port=icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
174 p->id=icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
175 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
176
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
177 default:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
178 icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING, "unknown message packet, type %x\n", type);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
181 #ifdef TCP_PROCESS_TRACE
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
182 printf("packet processed from uin: %lu:\n", uin);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 printf(" command: %x\ttype: %x\n", command, type);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184 printf(" status: %x\tcommand_type: %x\n", status, (int)command_type);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185 printf(" message %s\n", message);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186 printf(" id: %x\n", (int)p->id);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
187 #endif
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189 switch(command)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191 case ICQ_TCP_MESSAGE:
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
192 switch(type & ~ICQ_TCP_MASS_MASK)
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
194 case ICQ_TCP_MSG_MSG:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
195 icq_TCPOnMessageReceived(plink->icqlink, uin, message, p->id, plink);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
197
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 case ICQ_TCP_MSG_URL:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
199 icq_TCPOnURLReceived(plink->icqlink, uin, message, p->id);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202 case ICQ_TCP_MSG_CHAT:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203 icq_TCPOnChatReqReceived(plink->icqlink, uin, message, p->id);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
205
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206 case ICQ_TCP_MSG_FILE:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207 icq_TCPOnFileReqReceived(plink->icqlink, uin, message, filename, filesize, p->id);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
209
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
210 case ICQ_TCP_MSG_CONTACTLIST:
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
211 icq_TCPOnContactListReceived(plink->icqlink, uin, message, p->id);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
212 break;
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
213
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214 default:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING, "unknown message type %d!\n", type);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
218 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
220 case ICQ_TCP_ACK:
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
221 switch(type)
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
222 {
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 case ICQ_TCP_MSG_CHAT:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224 icq_HandleChatAck(plink, p, port);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227 case ICQ_TCP_MSG_FILE:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228 icq_HandleFileAck(plink, p, port);
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
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
231 case ICQ_TCP_MSG_MSG:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
232 case ICQ_TCP_MSG_URL:
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
233 if(plink->icqlink->icq_RequestNotify)
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
234 {
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235 icq_FmtLog(plink->icqlink, ICQ_LOG_MESSAGE, "received ack %d\n", p->id);
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
236 invoke_callback(plink->icqlink, icq_RequestNotify)
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
237 (plink->icqlink, p->id, ICQ_NOTIFY_ACK, status, (void *)message);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
238 invoke_callback(plink->icqlink, icq_RequestNotify)
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
239 (plink->icqlink, p->id, ICQ_NOTIFY_SUCCESS, 0, NULL);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
240 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
241 break;
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
242 }
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
243 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
244
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
245 case ICQ_TCP_CANCEL:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
246 /* icq_TCPProcessCancel(p); */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
247 break;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
248
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
249 default:
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250 icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING,
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
251 "unknown packet command %d!\n", command);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
252 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
253 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
254
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
255 void icq_TCPProcessCancel(icq_Packet *p)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
257 (void)p;
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 /*
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 find packet in queue
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261 call notification function
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 remove packet from queue
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263 */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
264 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
265
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266 int icq_TCPProcessHello(icq_Packet *p, icq_TCPLink *plink)
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
267 {
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268 /* TCP Hello packet */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269 BYTE code; /* 0xFF - init packet code */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270 DWORD version; /* tcp version */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271 DWORD remote_port; /* remote message listen port */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272 DWORD remote_uin; /* remote uin */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273 DWORD remote_ip; /* remote IP as seen by ICQ server */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 DWORD remote_real_ip; /* remote IP as seen by client */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275 BYTE flags; /* tcp flags */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 DWORD remote_other_port; /* remote chat or file listen port */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278 icq_PacketBegin(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280 code=icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281 version=icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
282
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283 if (!(p->length>=26 && code==ICQ_TCP_HELLO))
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
284 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285 icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286 "malformed hello packet received from %s:%d, closing link\n",
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
287 inet_ntoa(*((struct in_addr *)(&(plink->remote_address.sin_addr)))),
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
288 ntohs(plink->remote_address.sin_port));
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
290 icq_TCPLinkClose(plink);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
291 return 0;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
292 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
293 remote_port=icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
294 remote_uin=icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
295 remote_ip=icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
296 remote_real_ip=icq_PacketRead32(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
297 flags=icq_PacketRead8(p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298 remote_other_port=icq_PacketRead32(p);
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 icq_FmtLog(plink->icqlink, ICQ_LOG_MESSAGE,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
301 "hello packet received from %lu { version=%d }\n", remote_uin, version);
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 plink->remote_version=version;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
304 plink->remote_uin=remote_uin;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
305 plink->flags=flags;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
306 plink->mode&=~TCP_LINK_MODE_HELLOWAIT;
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 /* file and chat sessions require additional handling */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
309 if(plink->type==TCP_LINK_CHAT) icq_HandleChatHello(plink);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
310 if(plink->type==TCP_LINK_FILE) icq_HandleFileHello(plink);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
311
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
312 return 1;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
313 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
315 void icq_TCPOnMessageReceived(ICQLINK *link, DWORD uin, const char *message, DWORD id, icq_TCPLink *plink)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317 char data[512] ;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
318 #ifdef TCP_PACKET_TRACE
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
319 printf("tcp message packet received from %lu { sequence=%x }\n",
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
320 uin, (int)id);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
321 #endif
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
322
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
323 if(link->icq_RecvMessage)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
324 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
325 /* use the current system time for time received */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
326 time_t t=time(0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
327 struct tm *ptime=localtime(&t);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328 icq_Packet *pack;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
329 icq_TCPLink *preallink=icq_FindTCPLink(link, uin, TCP_LINK_MESSAGE);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
331 strncpy(data,message,512) ;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
332 icq_RusConv("wk",data) ;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
333
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
334 (*link->icq_RecvMessage)(link, uin, ptime->tm_hour, ptime->tm_min,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335 ptime->tm_mday, ptime->tm_mon+1, ptime->tm_year+1900, data);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
337 if(plink != preallink)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
338 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
339 /* if(icq_SpoofedMessage)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
340 (*icq_SpoofedMessage(uin, ...));*/
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
341 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
342
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
343 if(plink)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
344 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
345 /* send an acknowledgement to the remote client */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346 pack=icq_TCPCreateMessageAck(plink,0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
347 icq_PacketAppend32(pack, id);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
348 icq_PacketSend(pack, plink->socket);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
349 #ifdef TCP_PACKET_TRACE
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
350 printf("tcp message ack sent to uin %lu { sequence=%lx }\n", uin, id);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
351 #endif
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
352 icq_PacketDelete(pack);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
353 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
354 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
355 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
356
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
357 void icq_TCPOnURLReceived(ICQLINK *link, DWORD uin, const char *message, DWORD id)
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
358 {
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359 #ifdef TCP_PACKET_TRACE
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
360 printf("tcp url packet received from %lu { sequence=%lx }\n",
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
361 uin, id);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
362 #endif /*TCP_PACKET_TRACE*/
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
363
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
364 if(link->icq_RecvURL)
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
365 {
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
366 /* use the current system time for time received */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
367 time_t t=time(0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
368 struct tm *ptime=localtime(&t);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
369 icq_Packet *pack;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
370 char *pfe;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
371 icq_TCPLink *plink=icq_FindTCPLink(link, uin, TCP_LINK_MESSAGE);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
372
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373 /* the URL is split from the description by 0xFE */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
374 pfe=strchr(message, '\xFE');
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
375 *pfe=0;
1309
0a766047b4fd [gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
376 icq_RusConv("wk", (char*)message);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
377 (*link->icq_RecvURL)(link, uin, ptime->tm_hour, ptime->tm_min,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
378 ptime->tm_mday, ptime->tm_mon+1, ptime->tm_year+1900, pfe+1, message);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
379
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
380 /* send an acknowledgement to the remote client */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
381 pack=icq_TCPCreateURLAck(plink,0);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
382 icq_PacketAppend32(pack, id);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
383 icq_PacketSend(pack, plink->socket);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
384 #ifdef TCP_PACKET_TRACE
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
385 printf("tcp message ack sent to %lu { sequence=%lx }\n", uin, id);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
386 #endif
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
387 icq_PacketDelete(pack);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
388 }
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
389 }
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
390
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
391 void icq_TCPOnContactListReceived(ICQLINK *link, DWORD uin, const char *message, DWORD id)
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
392 {
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
393 #ifdef TCP_PACKET_TRACE
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
394 printf("tcp contactlist packet received from %lu { sequence=%lx }\n", uin, id);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
395 #endif /* TCP_PACKET_TRACE */
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
396
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
397 if (link->icq_RecvContactList) {
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
398 /* use the current system time for time received */
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
399 time_t t=time(0);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
400 struct tm *ptime=localtime(&t);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
401 icq_Packet *pack;
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
402 list *strList = list_new();
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
403 int i, k, nr = icq_SplitFields(strList, message);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
404 char *contact_uin[(nr - 2) /2], *contact_nick[(nr - 2) /2];
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
405 icq_TCPLink *plink=icq_FindTCPLink(link, uin, TCP_LINK_MESSAGE);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
406
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
407 /* split message */
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
408 for (i = 1, k = 0; i < (nr - 1); k++)
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
409 {
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
410 contact_uin[k] = list_at(strList, i);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
411 contact_nick[k] = list_at(strList, i + 1);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
412 i += 2;
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
413 }
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
414
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
415 (*link->icq_RecvContactList)(link, uin, k, (const char **)
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
416 contact_uin, (const char **) contact_nick);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
417 /* send an acknowledement to the remote client */
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
418 pack=icq_TCPCreateContactListAck(plink, 0);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
419 icq_PacketAppend32(pack, id);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
420 icq_PacketSend(pack, plink->socket);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
421 #ifdef TCP_PACKET_TRACE
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
422 printf("tcp message ack sent to %lu { sequence=%lx }\n", uin, id);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
423 #endif /* TCP_PACKE_TRACE */
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
424 icq_PacketDelete(pack);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
425
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
426 list_delete(strList, free);
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
427 }
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1309
diff changeset
428 }