comparison plugins/icq/icqlib.c @ 1498:0ef6603d986e

[gaim-migrate @ 1508] updating icqlib committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 22 Feb 2001 23:07:34 +0000
parents 7f7857c5036e
children ba8e6e211af5
comparison
equal deleted inserted replaced
1497:c3a40af2b0c4 1498:0ef6603d986e
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* 2 /*
3 $Id: icqlib.c 1477 2001-02-04 07:34:46Z warmenhoven $ 3 $Id: icqlib.c 1508 2001-02-22 23:07:34Z warmenhoven $
4 $Log$ 4 $Log$
5 Revision 1.4 2001/02/04 07:34:46 warmenhoven 5 Revision 1.5 2001/02/22 23:07:34 warmenhoven
6 updates to icqlib and gtkspell. also added catch case for when BYTE_ORDER wasn't defined. 6 updating icqlib
7
8 Revision 1.51 2001/02/22 05:37:39 bills
9 new timeout manager code, correct compilation warnings
7 10
8 Revision 1.50 2001/02/03 17:04:16 mwh 11 Revision 1.50 2001/02/03 17:04:16 mwh
9 Add an icq_UserData field to the ICQLINK struct. 12 Add an icq_UserData field to the ICQLINK struct.
10 13
11 Revision 1.49 2001/01/17 01:29:17 bills 14 Revision 1.49 2001/01/17 01:29:17 bills
64 #include "socketmanager.h" 67 #include "socketmanager.h"
65 68
66 int icq_Russian = FALSE; 69 int icq_Russian = FALSE;
67 BYTE icq_LogLevel = 0; 70 BYTE icq_LogLevel = 0;
68 71
69 void (*icq_SocketNotify)(int socket, int type, int status);
70
71 DWORD icq_SendMessage(ICQLINK *link, DWORD uin, const char *text, BYTE thruSrv) 72 DWORD icq_SendMessage(ICQLINK *link, DWORD uin, const char *text, BYTE thruSrv)
72 { 73 {
73 if(thruSrv==ICQ_SEND_THRUSERVER) 74 if(thruSrv==ICQ_SEND_THRUSERVER)
74 return icq_UDPSendMessage(link, uin, text); 75 return icq_UDPSendMessage(link, uin, text);
75 else if(thruSrv==ICQ_SEND_DIRECT) 76 else if(thruSrv==ICQ_SEND_DIRECT)
121 { 122 {
122 ICQLINK *link = (ICQLINK*)malloc(sizeof(ICQLINK)); 123 ICQLINK *link = (ICQLINK*)malloc(sizeof(ICQLINK));
123 link->d = (ICQLINK_private*)malloc(sizeof(ICQLINK_private)); 124 link->d = (ICQLINK_private*)malloc(sizeof(ICQLINK_private));
124 125
125 srand(time(0L)); 126 srand(time(0L));
126 /* initialize icq_SocketList on first call */ 127
128 /* initialize internal lists, if necessary */
127 if (!icq_SocketList) 129 if (!icq_SocketList)
128 icq_SocketList = list_new(); 130 icq_SocketList = list_new();
131
132 if (!icq_TimeoutList)
133 {
134 icq_TimeoutList = list_new();
135 icq_TimeoutList->compare_function =
136 (icq_ListCompareFunc)icq_TimeoutCompare;
137 }
129 138
130 /* Initialize all callbacks */ 139 /* Initialize all callbacks */
131 link->icq_Logged = 0L; 140 link->icq_Logged = 0L;
132 link->icq_Disconnected = 0L; 141 link->icq_Disconnected = 0L;
133 link->icq_RecvMessage = 0L; 142 link->icq_RecvMessage = 0L;
149 link->icq_InvalidUIN = 0L; 158 link->icq_InvalidUIN = 0L;
150 link->icq_Log = 0L; 159 link->icq_Log = 0L;
151 link->icq_SrvAck = 0L; 160 link->icq_SrvAck = 0L;
152 link->icq_RequestNotify = 0L; 161 link->icq_RequestNotify = 0L;
153 link->icq_NewUIN = 0L; 162 link->icq_NewUIN = 0L;
154 link->icq_SetTimeout = 0L;
155 link->icq_MetaUserFound = 0L; 163 link->icq_MetaUserFound = 0L;
156 link->icq_MetaUserInfo = 0L; 164 link->icq_MetaUserInfo = 0L;
157 link->icq_MetaUserWork = 0L; 165 link->icq_MetaUserWork = 0L;
158 link->icq_MetaUserMore = 0L; 166 link->icq_MetaUserMore = 0L;
159 link->icq_MetaUserAbout = 0L; 167 link->icq_MetaUserAbout = 0L;
437 link->icq_OurIP = ntohl(sin.sin_addr.s_addr); 445 link->icq_OurIP = ntohl(sin.sin_addr.s_addr);
438 link->icq_OurPort = ntohs(sin.sin_port); 446 link->icq_OurPort = ntohs(sin.sin_port);
439 447
440 /* sockets are ready to receive data - install handlers */ 448 /* sockets are ready to receive data - install handlers */
441 icq_SocketSetHandler(link->icq_UDPSok, ICQ_SOCKET_READ, 449 icq_SocketSetHandler(link->icq_UDPSok, ICQ_SOCKET_READ,
442 icq_HandleServerResponse, link); 450 (icq_SocketHandler)icq_HandleServerResponse, link);
443 if (link->icq_UseProxy) 451 if (link->icq_UseProxy)
444 icq_SocketSetHandler(link->icq_ProxySok, ICQ_SOCKET_READ, 452 icq_SocketSetHandler(link->icq_ProxySok, ICQ_SOCKET_READ,
445 icq_HandleProxyResponse, link); 453 (icq_SocketHandler)icq_HandleProxyResponse, link);
446 return link->icq_UDPSok; 454 return link->icq_UDPSok;
447 } 455 }
448 456
449 void icq_Disconnect(ICQLINK *link) 457 void icq_Disconnect(ICQLINK *link)
450 { 458 {