13234
|
1 /*
|
|
2 * Gaim's oscar protocol plugin
|
|
3 * This file is the legal property of its developers.
|
|
4 * Please see the AUTHORS file distributed alongside this file.
|
|
5 *
|
|
6 * This library is free software; you can redistribute it and/or
|
|
7 * modify it under the terms of the GNU Lesser General Public
|
|
8 * License as published by the Free Software Foundation; either
|
|
9 * version 2 of the License, or (at your option) any later version.
|
|
10 *
|
|
11 * This library is distributed in the hope that it will be useful,
|
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 * Lesser General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU Lesser General Public
|
|
17 * License along with this library; if not, write to the Free Software
|
|
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19 */
|
|
20
|
|
21 /*
|
|
22 * Main libfaim header. Must be included in client for prototypes/macros.
|
|
23 *
|
|
24 * "come on, i turned a chick lesbian; i think this is the hackish equivalent"
|
|
25 * -- Josh Myer
|
|
26 *
|
|
27 */
|
|
28
|
|
29 #ifndef _OSCAR_H_
|
|
30 #define _OSCAR_H_
|
|
31
|
13951
|
32 #include "circbuffer.h"
|
13234
|
33 #include "debug.h"
|
13592
|
34 #include "eventloop.h"
|
13234
|
35 #include "internal.h"
|
14109
|
36 #include "proxy.h"
|
13234
|
37
|
|
38 #include <stdio.h>
|
|
39 #include <string.h>
|
|
40 #include <fcntl.h>
|
|
41 #include <sys/types.h>
|
|
42 #include <stdlib.h>
|
|
43 #include <stdarg.h>
|
|
44 #include <errno.h>
|
|
45 #include <time.h>
|
|
46
|
|
47 #ifndef _WIN32
|
|
48 #include <sys/time.h>
|
|
49 #include <unistd.h>
|
|
50 #include <netdb.h>
|
|
51 #include <netinet/in.h>
|
|
52 #include <sys/socket.h>
|
|
53 #else
|
|
54 #include "libc_interface.h"
|
|
55 #endif
|
|
56
|
13239
|
57 typedef struct _ByteStream ByteStream;
|
|
58 typedef struct _ClientInfo ClientInfo;
|
|
59 typedef struct _FlapFrame FlapFrame;
|
|
60 typedef struct _IcbmCookie IcbmCookie;
|
13592
|
61 typedef struct _FlapConnection FlapConnection;
|
|
62 typedef struct _OscarData OscarData;
|
|
63 typedef struct _IcbmArgsCh2 IcbmArgsCh2;
|
13239
|
64
|
|
65 typedef guint32 aim_snacid_t;
|
|
66 typedef guint16 flap_seqnum_t;
|
|
67
|
|
68 #include "snactypes.h"
|
|
69
|
13234
|
70 #ifdef __cplusplus
|
|
71 extern "C" {
|
|
72 #endif
|
|
73
|
|
74 #define FAIM_SNAC_HASH_SIZE 16
|
|
75
|
|
76 /*
|
|
77 * Current Maximum Length for Screen Names (not including NULL)
|
|
78 *
|
|
79 * Currently only names up to 16 characters can be registered
|
|
80 * however it is apparently legal for them to be larger.
|
|
81 */
|
|
82 #define MAXSNLEN 97
|
|
83
|
|
84 /*
|
|
85 * Current Maximum Length for Instant Messages
|
|
86 *
|
|
87 * This was found basically by experiment, but not wholly
|
|
88 * accurate experiment. It should not be regarded
|
|
89 * as completely correct. But its a decent approximation.
|
|
90 *
|
|
91 * Note that although we can send this much, its impossible
|
|
92 * for WinAIM clients (up through the latest (4.0.1957)) to
|
|
93 * send any more than 1kb. Amaze all your windows friends
|
|
94 * with utterly oversized instant messages!
|
|
95 *
|
13592
|
96 * TODO: the real limit is the total SNAC size at 8192. Fix this.
|
13234
|
97 *
|
|
98 */
|
|
99 #define MAXMSGLEN 7987
|
|
100
|
|
101 /*
|
|
102 * Maximum size of a Buddy Icon.
|
|
103 */
|
|
104 #define MAXICONLEN 7168
|
|
105 #define AIM_ICONIDENT "AVT1picture.id"
|
|
106
|
|
107 /*
|
|
108 * Current Maximum Length for Chat Room Messages
|
|
109 *
|
|
110 * This is actually defined by the protocol to be
|
13239
|
111 * dynamic, but I have yet to see due cause to
|
13234
|
112 * define it dynamically here. Maybe later.
|
|
113 *
|
|
114 */
|
|
115 #define MAXCHATMSGLEN 512
|
|
116
|
|
117 /**
|
|
118 * Maximum length for the password of an ICQ account
|
|
119 */
|
|
120 #define MAXICQPASSLEN 8
|
|
121
|
|
122 #define AIM_MD5_STRING "AOL Instant Messenger (SM)"
|
|
123
|
|
124 /*
|
13239
|
125 * Client info. Filled in by the client and passed in to
|
13234
|
126 * aim_send_login(). The information ends up getting passed to OSCAR
|
|
127 * through the initial login command.
|
|
128 *
|
|
129 */
|
13239
|
130 struct _ClientInfo
|
|
131 {
|
13234
|
132 const char *clientstring;
|
|
133 guint16 clientid;
|
|
134 guint16 major;
|
|
135 guint16 minor;
|
|
136 guint16 point;
|
|
137 guint16 build;
|
|
138 guint32 distrib;
|
|
139 const char *country; /* two-letter abbrev */
|
|
140 const char *lang; /* two-letter abbrev */
|
|
141 };
|
|
142
|
|
143 /* Needs to be checked */
|
|
144 #define CLIENTINFO_AIM_3_5_1670 { \
|
|
145 "AOL Instant Messenger (SM), version 3.5.1670/WIN32", \
|
|
146 0x0004, \
|
|
147 0x0003, 0x0005, \
|
|
148 0x0000, 0x0686, \
|
|
149 0x0000002a, \
|
|
150 "us", "en", \
|
|
151 }
|
|
152
|
|
153 /* Needs to be checked */
|
|
154 /* Latest winaim without ssi */
|
|
155 #define CLIENTINFO_AIM_4_1_2010 { \
|
|
156 "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \
|
|
157 0x0004, \
|
|
158 0x0004, 0x0001, \
|
|
159 0x0000, 0x07da, \
|
|
160 0x0000004b, \
|
|
161 "us", "en", \
|
|
162 }
|
|
163
|
|
164 /* Needs to be checked */
|
|
165 #define CLIENTINFO_AIM_4_3_2188 { \
|
|
166 "AOL Instant Messenger (SM), version 4.3.2188/WIN32", \
|
|
167 0x0109, \
|
|
168 0x0400, 0x0003, \
|
|
169 0x0000, 0x088c, \
|
|
170 0x00000086, \
|
|
171 "us", "en", \
|
|
172 }
|
|
173
|
|
174 /* Needs to be checked */
|
|
175 #define CLIENTINFO_AIM_4_8_2540 { \
|
|
176 "AOL Instant Messenger (SM), version 4.8.2540/WIN32", \
|
|
177 0x0109, \
|
|
178 0x0004, 0x0008, \
|
|
179 0x0000, 0x09ec, \
|
|
180 0x000000af, \
|
|
181 "us", "en", \
|
|
182 }
|
|
183
|
|
184 /* Needs to be checked */
|
|
185 #define CLIENTINFO_AIM_5_0_2938 { \
|
|
186 "AOL Instant Messenger, version 5.0.2938/WIN32", \
|
|
187 0x0109, \
|
|
188 0x0005, 0x0000, \
|
|
189 0x0000, 0x0b7a, \
|
|
190 0x00000000, \
|
|
191 "us", "en", \
|
|
192 }
|
|
193
|
|
194 #define CLIENTINFO_AIM_5_1_3036 { \
|
|
195 "AOL Instant Messenger, version 5.1.3036/WIN32", \
|
|
196 0x0109, \
|
|
197 0x0005, 0x0001, \
|
|
198 0x0000, 0x0bdc, \
|
|
199 0x000000d2, \
|
|
200 "us", "en", \
|
|
201 }
|
|
202
|
|
203 #define CLIENTINFO_AIM_5_5_3415 { \
|
|
204 "AOL Instant Messenger, version 5.5.3415/WIN32", \
|
|
205 0x0109, \
|
|
206 0x0005, 0x0005, \
|
|
207 0x0000, 0x0057, \
|
|
208 0x000000ef, \
|
|
209 "us", "en", \
|
|
210 }
|
|
211
|
|
212 #define CLIENTINFO_AIM_5_9_3702 { \
|
|
213 "AOL Instant Messenger, version 5.9.3702/WIN32", \
|
|
214 0x0109, \
|
|
215 0x0005, 0x0009, \
|
|
216 0x0000, 0x0e76, \
|
|
217 0x00000111, \
|
|
218 "us", "en", \
|
|
219 }
|
|
220
|
|
221 #define CLIENTINFO_ICHAT_1_0 { \
|
|
222 "Apple iChat", \
|
|
223 0x311a, \
|
|
224 0x0001, 0x0000, \
|
|
225 0x0000, 0x003c, \
|
|
226 0x000000c6, \
|
|
227 "us", "en", \
|
|
228 }
|
|
229
|
|
230 /* Needs to be checked */
|
|
231 #define CLIENTINFO_ICQ_4_65_3281 { \
|
|
232 "ICQ Inc. - Product of ICQ (TM) 2000b.4.65.1.3281.85", \
|
|
233 0x010a, \
|
|
234 0x0004, 0x0041, \
|
|
235 0x0001, 0x0cd1, \
|
|
236 0x00000055, \
|
|
237 "us", "en", \
|
|
238 }
|
|
239
|
|
240 /* Needs to be checked */
|
|
241 #define CLIENTINFO_ICQ_5_34_3728 { \
|
|
242 "ICQ Inc. - Product of ICQ (TM).2002a.5.34.1.3728.85", \
|
|
243 0x010a, \
|
|
244 0x0005, 0x0022, \
|
|
245 0x0001, 0x0e8f, \
|
|
246 0x00000055, \
|
|
247 "us", "en", \
|
|
248 }
|
|
249
|
|
250 #define CLIENTINFO_ICQ_5_45_3777 { \
|
|
251 "ICQ Inc. - Product of ICQ (TM).2003a.5.45.1.3777.85", \
|
|
252 0x010a, \
|
|
253 0x0005, 0x002d, \
|
|
254 0x0001, 0x0ec1, \
|
|
255 0x00000055, \
|
|
256 "us", "en", \
|
|
257 }
|
|
258
|
|
259 #define CLIENTINFO_ICQBASIC_14_3_1068 { \
|
|
260 "ICQBasic", \
|
|
261 0x010a, \
|
|
262 0x0014, 0x0003, \
|
|
263 0x0000, 0x042c, \
|
|
264 0x0000043d, \
|
|
265 "us", "en", \
|
|
266 }
|
|
267
|
|
268 #define CLIENTINFO_NETSCAPE_7_0_1 { \
|
|
269 "Netscape 2000 an approved user of AOL Instant Messenger (SM)", \
|
|
270 0x1d0d, \
|
|
271 0x0007, 0x0000, \
|
|
272 0x0001, 0x0000, \
|
|
273 0x00000058, \
|
|
274 "us", "en", \
|
|
275 }
|
|
276
|
|
277 #define CLIENTINFO_GAIM { \
|
|
278 "Gaim/" VERSION, \
|
|
279 0x0109, \
|
|
280 0x0005, 0x0001, \
|
|
281 0x0000, 0x0bdc, \
|
|
282 0x000000d2, \
|
|
283 "us", "en", \
|
|
284 }
|
|
285
|
|
286 #define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_5_1_3036
|
|
287 #define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQ_5_45_3777
|
|
288
|
13592
|
289 typedef enum
|
13239
|
290 {
|
13986
|
291 OSCAR_DISCONNECT_DONE, /* not considered an error */
|
|
292 OSCAR_DISCONNECT_LOCAL_CLOSED, /* peer connections only, not considered an error */
|
13608
|
293 OSCAR_DISCONNECT_REMOTE_CLOSED,
|
13986
|
294 OSCAR_DISCONNECT_REMOTE_REFUSED, /* peer connections only */
|
13608
|
295 OSCAR_DISCONNECT_LOST_CONNECTION,
|
|
296 OSCAR_DISCONNECT_INVALID_DATA,
|
|
297 OSCAR_DISCONNECT_COULD_NOT_CONNECT,
|
13986
|
298 OSCAR_DISCONNECT_RETRYING /* peer connections only */
|
13608
|
299 } OscarDisconnectReason;
|
|
300
|
|
301 typedef enum
|
|
302 {
|
13592
|
303 OSCAR_CAPABILITY_BUDDYICON = 0x00000001,
|
|
304 OSCAR_CAPABILITY_TALK = 0x00000002,
|
|
305 OSCAR_CAPABILITY_DIRECTIM = 0x00000004,
|
|
306 OSCAR_CAPABILITY_CHAT = 0x00000008,
|
|
307 OSCAR_CAPABILITY_GETFILE = 0x00000010,
|
|
308 OSCAR_CAPABILITY_SENDFILE = 0x00000020,
|
|
309 OSCAR_CAPABILITY_GAMES = 0x00000040,
|
|
310 OSCAR_CAPABILITY_ADDINS = 0x00000080,
|
|
311 OSCAR_CAPABILITY_SENDBUDDYLIST = 0x00000100,
|
|
312 OSCAR_CAPABILITY_GAMES2 = 0x00000200,
|
|
313 OSCAR_CAPABILITY_ICQ_DIRECT = 0x00000400,
|
|
314 OSCAR_CAPABILITY_APINFO = 0x00000800,
|
|
315 OSCAR_CAPABILITY_ICQRTF = 0x00001000,
|
|
316 OSCAR_CAPABILITY_EMPTY = 0x00002000,
|
|
317 OSCAR_CAPABILITY_ICQSERVERRELAY = 0x00004000,
|
|
318 OSCAR_CAPABILITY_ICQUTF8OLD = 0x00008000,
|
|
319 OSCAR_CAPABILITY_TRILLIANCRYPT = 0x00010000,
|
|
320 OSCAR_CAPABILITY_ICQUTF8 = 0x00020000,
|
|
321 OSCAR_CAPABILITY_INTEROPERATE = 0x00040000,
|
|
322 OSCAR_CAPABILITY_ICHAT = 0x00080000,
|
|
323 OSCAR_CAPABILITY_HIPTOP = 0x00100000,
|
|
324 OSCAR_CAPABILITY_SECUREIM = 0x00200000,
|
|
325 OSCAR_CAPABILITY_SMS = 0x00400000,
|
|
326 OSCAR_CAPABILITY_GENERICUNKNOWN = 0x00800000,
|
|
327 OSCAR_CAPABILITY_VIDEO = 0x01000000,
|
|
328 OSCAR_CAPABILITY_ICHATAV = 0x02000000,
|
|
329 OSCAR_CAPABILITY_LIVEVIDEO = 0x04000000,
|
|
330 OSCAR_CAPABILITY_CAMERA = 0x08000000,
|
|
331 OSCAR_CAPABILITY_LAST = 0x10000000
|
|
332 } OscarCapability;
|
13234
|
333
|
|
334 /*
|
|
335 * Byte Stream type. Sort of.
|
|
336 *
|
|
337 * Use of this type serves a couple purposes:
|
|
338 * - Buffer/buflen pairs are passed all around everywhere. This turns
|
|
339 * that into one value, as well as abstracting it slightly.
|
|
340 * - Through the abstraction, it is possible to enable bounds checking
|
|
341 * for robustness at the cost of performance. But a clean failure on
|
|
342 * weird packets is much better than a segfault.
|
|
343 * - I like having variables named "bs".
|
|
344 *
|
|
345 * Don't touch the insides of this struct. Or I'll have to kill you.
|
|
346 *
|
|
347 */
|
13239
|
348 struct _ByteStream
|
|
349 {
|
13234
|
350 guint8 *data;
|
|
351 guint32 len;
|
|
352 guint32 offset;
|
13239
|
353 };
|
13234
|
354
|
13239
|
355 struct _FlapFrame
|
|
356 {
|
13592
|
357 guint8 channel;
|
|
358 flap_seqnum_t seqnum;
|
|
359 ByteStream data; /* payload stream */
|
|
360 };
|
|
361
|
|
362 struct _FlapConnection
|
|
363 {
|
|
364 OscarData *od; /**< Pointer to parent session. */
|
13608
|
365 gboolean connected;
|
13592
|
366 time_t lastactivity; /**< Time of last transmit. */
|
|
367 guint destroy_timeout;
|
13608
|
368 OscarDisconnectReason disconnect_reason;
|
13592
|
369
|
14109
|
370 /* A few variables that are only used when connecting */
|
|
371 GaimProxyConnectInfo *connect_info;
|
|
372 guint16 cookielen;
|
|
373 guint8 *cookie;
|
|
374 gpointer connect_data;
|
|
375
|
13608
|
376 int fd;
|
13592
|
377 FlapFrame buffer_incoming;
|
|
378 GaimCircBuffer *buffer_outgoing;
|
|
379 guint watcher_incoming;
|
|
380 guint watcher_outgoing;
|
|
381
|
|
382 guint16 type;
|
|
383 guint16 subtype;
|
|
384 flap_seqnum_t seqnum;
|
|
385 guint32 status;
|
13611
|
386 GList *groups;
|
13609
|
387 struct rateclass *rates;
|
|
388
|
13592
|
389 void *internal; /* internal conn-specific libfaim data */
|
13239
|
390 };
|
13234
|
391
|
13239
|
392 struct _IcbmCookie
|
|
393 {
|
13234
|
394 guchar cookie[8];
|
|
395 int type;
|
|
396 void *data;
|
|
397 time_t addtime;
|
13239
|
398 struct _IcbmCookie *next;
|
|
399 };
|
13234
|
400
|
13592
|
401 #include "peer.h"
|
|
402
|
13234
|
403 /*
|
|
404 * AIM Session: The main client-data interface.
|
|
405 *
|
|
406 */
|
13592
|
407 struct _OscarData
|
13239
|
408 {
|
13592
|
409 gboolean iconconnecting;
|
|
410 gboolean set_icon;
|
|
411
|
|
412 GSList *create_rooms;
|
|
413
|
|
414 gboolean conf;
|
|
415 gboolean reqemail;
|
|
416 gboolean setemail;
|
|
417 char *email;
|
|
418 gboolean setnick;
|
|
419 char *newsn;
|
|
420 gboolean chpass;
|
|
421 char *oldp;
|
|
422 char *newp;
|
|
423
|
|
424 GSList *oscar_chats;
|
|
425 GHashTable *buddyinfo;
|
|
426 GSList *requesticon;
|
|
427
|
|
428 gboolean killme;
|
|
429 gboolean icq;
|
|
430 guint icontimer;
|
|
431 guint getblisttimer;
|
|
432 guint getinfotimer;
|
|
433 gint timeoffset;
|
|
434
|
|
435 struct {
|
|
436 guint maxwatchers; /* max users who can watch you */
|
|
437 guint maxbuddies; /* max users you can watch */
|
|
438 guint maxgroups; /* max groups in server list */
|
|
439 guint maxpermits; /* max users on permit list */
|
|
440 guint maxdenies; /* max users on deny list */
|
|
441 guint maxsiglen; /* max size (bytes) of profile */
|
|
442 guint maxawaymsglen; /* max size (bytes) of posted away message */
|
|
443 } rights;
|
13234
|
444
|
|
445 /* ---- Client Accessible ------------------------ */
|
|
446
|
|
447 /* Our screen name. */
|
13592
|
448 /* TODO: Get rid of this and use gaim_account_get_username() everywhere? */
|
13234
|
449 char sn[MAXSNLEN+1];
|
|
450
|
13592
|
451 GaimConnection *gc;
|
13234
|
452
|
|
453 /* ---- Internal Use Only ------------------------ */
|
|
454
|
|
455 void *modlistv;
|
|
456
|
|
457 /*
|
|
458 * Outstanding snac handling
|
|
459 *
|
13592
|
460 * TODO: Should these be per-connection? -mid
|
13234
|
461 */
|
|
462 void *snac_hash[FAIM_SNAC_HASH_SIZE];
|
|
463 aim_snacid_t snacid_next;
|
|
464
|
13592
|
465 /*
|
|
466 * TODO: Data specific to a certain family should go into a
|
|
467 * hashtable and the core parts of libfaim shouldn't
|
|
468 * need to know about them.
|
|
469 */
|
|
470
|
13239
|
471 IcbmCookie *msgcookies;
|
13234
|
472 struct aim_icq_info *icq_info;
|
|
473 struct aim_authresp_info *authinfo;
|
|
474 struct aim_emailinfo *emailinfo;
|
|
475
|
|
476 struct {
|
|
477 struct aim_userinfo_s *userinfo;
|
|
478 struct userinfo_node *torequest;
|
|
479 struct userinfo_node *requested;
|
|
480 int waiting_for_response;
|
|
481 } locate;
|
|
482
|
|
483 /* Server-stored information (ssi) */
|
|
484 struct {
|
|
485 int received_data;
|
|
486 guint16 numitems;
|
|
487 struct aim_ssi_item *official;
|
|
488 struct aim_ssi_item *local;
|
|
489 struct aim_ssi_tmp *pending;
|
|
490 time_t timestamp;
|
|
491 int waiting_for_ack;
|
|
492 } ssi;
|
13252
|
493
|
13592
|
494 /* TODO: Implement this as a HashTable for HUGE speed improvement! */
|
|
495 GList *handlerlist;
|
|
496
|
|
497 /** A linked list containing FlapConnections. */
|
13254
|
498 GList *oscar_connections;
|
|
499
|
13252
|
500 /** A linked list containing PeerConnections. */
|
|
501 GList *peer_connections;
|
13239
|
502 };
|
13234
|
503
|
|
504 /* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */
|
13592
|
505 #define AIM_ICQ_STATE_NORMAL 0x00000000
|
|
506 #define AIM_ICQ_STATE_AWAY 0x00000001
|
|
507 #define AIM_ICQ_STATE_DND 0x00000002
|
|
508 #define AIM_ICQ_STATE_OUT 0x00000004
|
|
509 #define AIM_ICQ_STATE_BUSY 0x00000010
|
|
510 #define AIM_ICQ_STATE_CHAT 0x00000020
|
|
511 #define AIM_ICQ_STATE_INVISIBLE 0x00000100
|
|
512 #define AIM_ICQ_STATE_WEBAWARE 0x00010000
|
|
513 #define AIM_ICQ_STATE_HIDEIP 0x00020000
|
|
514 #define AIM_ICQ_STATE_BIRTHDAY 0x00080000
|
|
515 #define AIM_ICQ_STATE_DIRECTDISABLED 0x00100000
|
|
516 #define AIM_ICQ_STATE_ICQHOMEPAGE 0x00200000
|
|
517 #define AIM_ICQ_STATE_DIRECTREQUIREAUTH 0x10000000
|
|
518 #define AIM_ICQ_STATE_DIRECTCONTACTLIST 0x20000000
|
13234
|
519
|
13592
|
520 typedef int (*aim_rxcallback_t)(OscarData *od, FlapConnection *conn, FlapFrame *frame, ...);
|
13234
|
521
|
|
522
|
13239
|
523 /* family_auth.c */
|
|
524 struct aim_clientrelease
|
|
525 {
|
13234
|
526 char *name;
|
|
527 guint32 build;
|
|
528 char *url;
|
|
529 char *info;
|
|
530 };
|
|
531
|
13239
|
532 struct aim_authresp_info
|
|
533 {
|
13234
|
534 char *sn;
|
|
535 guint16 errorcode;
|
|
536 char *errorurl;
|
|
537 guint16 regstatus;
|
|
538 char *email;
|
|
539 char *bosip;
|
|
540 guint16 cookielen;
|
|
541 guint8 *cookie;
|
|
542 char *chpassurl;
|
|
543 struct aim_clientrelease latestrelease;
|
|
544 struct aim_clientrelease latestbeta;
|
|
545 };
|
|
546
|
|
547 /* Callback data for redirect. */
|
13239
|
548 struct aim_redirect_data
|
|
549 {
|
13234
|
550 guint16 group;
|
|
551 const char *ip;
|
|
552 guint16 cookielen;
|
|
553 const guint8 *cookie;
|
13592
|
554 struct { /* group == SNAC_FAMILY_CHAT */
|
13234
|
555 guint16 exchange;
|
|
556 const char *room;
|
|
557 guint16 instance;
|
|
558 } chat;
|
|
559 };
|
|
560
|
13609
|
561 void aim_clientready(OscarData *od, FlapConnection *conn);
|
13592
|
562 int aim_request_login(OscarData *od, FlapConnection *conn, const char *sn);
|
|
563 int aim_send_login(OscarData *, FlapConnection *, const char *, const char *, ClientInfo *, const char *key);
|
|
564 /* 0x000b */ int aim_auth_securid_send(OscarData *od, const char *securid);
|
13234
|
565
|
13592
|
566 void aim_cleansnacs(OscarData *, int maxage);
|
13234
|
567
|
13592
|
568 int oscar_data_addhandler(OscarData *od, guint16 family, guint16 type, aim_rxcallback_t newhandler, guint16 flags);
|
|
569 void aim_clearhandlers(OscarData *od);
|
13234
|
570
|
13592
|
571 /* flap_connection.c */
|
|
572 FlapConnection *flap_connection_new(OscarData *, int type);
|
|
573 void flap_connection_close(OscarData *od, FlapConnection *conn);
|
13608
|
574 void flap_connection_destroy(FlapConnection *conn, OscarDisconnectReason reason);
|
|
575 void flap_connection_schedule_destroy(FlapConnection *conn, OscarDisconnectReason reason);
|
13592
|
576 FlapConnection *flap_connection_findbygroup(OscarData *od, guint16 group);
|
|
577 FlapConnection *flap_connection_getbytype(OscarData *, int type);
|
|
578 FlapConnection *flap_connection_getbytype_all(OscarData *, int type);
|
|
579 void flap_connection_recv_cb(gpointer data, gint source, GaimInputCondition cond);
|
|
580 void flap_connection_send(FlapConnection *conn, FlapFrame *frame);
|
|
581 void flap_connection_send_version(OscarData *od, FlapConnection *conn);
|
|
582 void flap_connection_send_version_with_cookie(OscarData *od, FlapConnection *conn, guint16 length, const guint8 *chipsahoy);
|
|
583 void flap_connection_send_keepalive(OscarData *od, FlapConnection *conn);
|
|
584 FlapFrame *flap_frame_new(OscarData *od, guint16 channel, int datalen);
|
13234
|
585
|
|
586
|
13592
|
587 OscarData *oscar_data_new(void);
|
|
588 void oscar_data_destroy(OscarData *);
|
13234
|
589
|
13239
|
590 /* 0x0001 - family_oservice.c */
|
13592
|
591 int aim_srv_setstatusmsg(OscarData *od, const char *msg);
|
|
592 int aim_srv_setidle(OscarData *od, guint32 idletime);
|
13234
|
593
|
|
594 /* misc.c */
|
|
595
|
|
596 #define AIM_VISIBILITYCHANGE_PERMITADD 0x05
|
|
597 #define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06
|
|
598 #define AIM_VISIBILITYCHANGE_DENYADD 0x07
|
|
599 #define AIM_VISIBILITYCHANGE_DENYREMOVE 0x08
|
|
600
|
|
601 #define AIM_PRIVFLAGS_ALLOWIDLE 0x01
|
|
602 #define AIM_PRIVFLAGS_ALLOWMEMBERSINCE 0x02
|
|
603
|
|
604 #define AIM_WARN_ANON 0x01
|
|
605
|
13592
|
606 int aim_nop(OscarData *, FlapConnection *);
|
|
607 int aim_bos_changevisibility(OscarData *, FlapConnection *, int, const char *);
|
|
608 int aim_bos_setgroupperm(OscarData *, FlapConnection *, guint32 mask);
|
|
609 int aim_bos_setprivacyflags(OscarData *, FlapConnection *, guint32);
|
13609
|
610 void aim_reqpersonalinfo(OscarData *, FlapConnection *);
|
13592
|
611 int aim_reqservice(OscarData *, guint16);
|
13609
|
612 void aim_bos_reqrights(OscarData *, FlapConnection *);
|
13592
|
613 int aim_setextstatus(OscarData *od, guint32 status);
|
13234
|
614
|
|
615 #define AIM_CLIENTTYPE_UNKNOWN 0x0000
|
|
616 #define AIM_CLIENTTYPE_MC 0x0001
|
|
617 #define AIM_CLIENTTYPE_WINAIM 0x0002
|
|
618 #define AIM_CLIENTTYPE_WINAIM41 0x0003
|
|
619 #define AIM_CLIENTTYPE_AOL_TOC 0x0004
|
13592
|
620 guint16 aim_im_fingerprint(const guint8 *msghdr, int len);
|
13234
|
621
|
|
622 #define AIM_RATE_CODE_CHANGE 0x0001
|
|
623 #define AIM_RATE_CODE_WARNING 0x0002
|
|
624 #define AIM_RATE_CODE_LIMIT 0x0003
|
|
625 #define AIM_RATE_CODE_CLEARLIMIT 0x0004
|
13592
|
626 int aim_ads_requestads(OscarData *od, FlapConnection *conn);
|
13234
|
627
|
|
628
|
|
629
|
13239
|
630 /* family_icbm.c */
|
13234
|
631 #define AIM_OFT_SUBTYPE_SEND_FILE 0x0001
|
|
632 #define AIM_OFT_SUBTYPE_SEND_DIR 0x0002
|
|
633 #define AIM_OFT_SUBTYPE_GET_FILE 0x0011
|
13608
|
634 #define AIM_OFT_SUBTYPE_GET_LIST 0x0012
|
13234
|
635
|
|
636 #define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000
|
|
637 #define AIM_TRANSFER_DENY_DECLINE 0x0001
|
|
638 #define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002
|
|
639
|
|
640 #define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED 0x00000001
|
|
641 #define AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED 0x00000002
|
|
642
|
|
643 /* This is what the server will give you if you don't set them yourself. */
|
|
644 #define AIM_IMPARAM_DEFAULTS { \
|
|
645 0, \
|
|
646 AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
|
|
647 512, /* !! Note how small this is. */ \
|
|
648 (99.9)*10, (99.9)*10, \
|
|
649 1000 /* !! And how large this is. */ \
|
|
650 }
|
|
651
|
|
652 /* This is what most AIM versions use. */
|
|
653 #define AIM_IMPARAM_REASONABLE { \
|
|
654 0, \
|
|
655 AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
|
|
656 8000, \
|
|
657 (99.9)*10, (99.9)*10, \
|
|
658 0 \
|
|
659 }
|
|
660
|
13239
|
661 struct aim_icbmparameters
|
|
662 {
|
13234
|
663 guint16 maxchan;
|
|
664 guint32 flags; /* AIM_IMPARAM_FLAG_ */
|
|
665 guint16 maxmsglen; /* message size that you will accept */
|
|
666 guint16 maxsenderwarn; /* this and below are *10 (999=99.9%) */
|
|
667 guint16 maxrecverwarn;
|
|
668 guint32 minmsginterval; /* in milliseconds? */
|
|
669 };
|
|
670
|
14109
|
671 /*
|
|
672 * TODO: Should probably combine this with struct chat_connection.
|
|
673 */
|
13239
|
674 struct aim_chat_roominfo
|
|
675 {
|
13234
|
676 guint16 exchange;
|
|
677 char *name;
|
|
678 guint16 instance;
|
|
679 };
|
|
680
|
14109
|
681 struct chat_connection
|
|
682 {
|
|
683 char *name;
|
|
684 char *show; /* AOL did something funny to us */
|
|
685 guint16 exchange;
|
|
686 guint16 instance;
|
|
687 FlapConnection *conn;
|
|
688 int id;
|
|
689 GaimConnection *gc;
|
|
690 GaimConversation *conv;
|
|
691 int maxlen;
|
|
692 int maxvis;
|
|
693 };
|
|
694
|
|
695 /*
|
|
696 * All this chat struct stuff should be in family_chat.c
|
|
697 */
|
|
698 void oscar_chat_destroy(struct chat_connection *cc);
|
|
699
|
13234
|
700 #define AIM_IMFLAGS_AWAY 0x0001 /* mark as an autoreply */
|
|
701 #define AIM_IMFLAGS_ACK 0x0002 /* request a receipt notice */
|
|
702 #define AIM_IMFLAGS_BUDDYREQ 0x0010 /* buddy icon requested */
|
|
703 #define AIM_IMFLAGS_HASICON 0x0020 /* already has icon */
|
|
704 #define AIM_IMFLAGS_SUBENC_MACINTOSH 0x0040 /* damn that Steve Jobs! */
|
|
705 #define AIM_IMFLAGS_CUSTOMFEATURES 0x0080 /* features field present */
|
|
706 #define AIM_IMFLAGS_EXTDATA 0x0100
|
|
707 #define AIM_IMFLAGS_X 0x0200
|
|
708 #define AIM_IMFLAGS_MULTIPART 0x0400 /* ->mpmsg section valid */
|
|
709 #define AIM_IMFLAGS_OFFLINE 0x0800 /* send to offline user */
|
|
710 #define AIM_IMFLAGS_TYPINGNOT 0x1000 /* typing notification */
|
|
711
|
|
712 #define AIM_CHARSET_ASCII 0x0000
|
|
713 #define AIM_CHARSET_UNICODE 0x0002 /* UCS-2BE */
|
|
714 #define AIM_CHARSET_CUSTOM 0x0003
|
|
715
|
|
716 /*
|
|
717 * Multipart message structures.
|
|
718 */
|
13239
|
719 typedef struct aim_mpmsg_section_s
|
|
720 {
|
13234
|
721 guint16 charset;
|
|
722 guint16 charsubset;
|
|
723 gchar *data;
|
|
724 guint16 datalen;
|
|
725 struct aim_mpmsg_section_s *next;
|
|
726 } aim_mpmsg_section_t;
|
|
727
|
13239
|
728 typedef struct aim_mpmsg_s
|
|
729 {
|
13234
|
730 unsigned int numparts;
|
|
731 aim_mpmsg_section_t *parts;
|
|
732 } aim_mpmsg_t;
|
|
733
|
13592
|
734 int aim_mpmsg_init(OscarData *od, aim_mpmsg_t *mpm);
|
|
735 int aim_mpmsg_addraw(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const gchar *data, guint16 datalen);
|
|
736 int aim_mpmsg_addascii(OscarData *od, aim_mpmsg_t *mpm, const char *ascii);
|
|
737 int aim_mpmsg_addunicode(OscarData *od, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen);
|
|
738 void aim_mpmsg_free(OscarData *od, aim_mpmsg_t *mpm);
|
13234
|
739
|
|
740 /*
|
|
741 * Arguments to aim_send_im_ext().
|
|
742 *
|
|
743 * This is really complicated. But immensely versatile.
|
|
744 *
|
|
745 */
|
13239
|
746 struct aim_sendimext_args
|
|
747 {
|
13234
|
748
|
|
749 /* These are _required_ */
|
|
750 const char *destsn;
|
|
751 guint32 flags; /* often 0 */
|
|
752
|
|
753 /* Only required if not using multipart messages */
|
|
754 const char *msg;
|
|
755 int msglen;
|
|
756
|
|
757 /* Required if ->msg is not provided */
|
|
758 aim_mpmsg_t *mpmsg;
|
|
759
|
|
760 /* Only used if AIM_IMFLAGS_HASICON is set */
|
|
761 guint32 iconlen;
|
|
762 time_t iconstamp;
|
|
763 guint32 iconsum;
|
|
764
|
|
765 /* Only used if AIM_IMFLAGS_CUSTOMFEATURES is set */
|
|
766 guint16 featureslen;
|
|
767 guint8 *features;
|
|
768
|
|
769 /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set and mpmsg not used */
|
|
770 guint16 charset;
|
|
771 guint16 charsubset;
|
|
772 };
|
|
773
|
|
774 /*
|
|
775 * Arguments to aim_send_rtfmsg().
|
|
776 */
|
13239
|
777 struct aim_sendrtfmsg_args
|
|
778 {
|
13234
|
779 const char *destsn;
|
|
780 guint32 fgcolor;
|
|
781 guint32 bgcolor;
|
|
782 const char *rtfmsg; /* must be in RTF */
|
|
783 };
|
|
784
|
|
785 /*
|
|
786 * This information is provided in the Incoming ICBM callback for
|
13239
|
787 * Channel 1 ICBM's.
|
13234
|
788 *
|
|
789 * Note that although CUSTOMFEATURES and CUSTOMCHARSET say they
|
|
790 * are optional, both are always set by the current libfaim code.
|
|
791 * That may or may not change in the future. It is mainly for
|
|
792 * consistency with aim_sendimext_args.
|
|
793 *
|
|
794 * Multipart messages require some explanation. If you want to use them,
|
13239
|
795 * I suggest you read all the comments in family_icbm.c.
|
13234
|
796 *
|
|
797 */
|
13239
|
798 struct aim_incomingim_ch1_args
|
|
799 {
|
13234
|
800
|
|
801 /* Always provided */
|
|
802 aim_mpmsg_t mpmsg;
|
|
803 guint32 icbmflags; /* some flags apply only to ->msg, not all mpmsg */
|
13239
|
804
|
13234
|
805 /* Only provided if message has a human-readable section */
|
|
806 gchar *msg;
|
|
807 int msglen;
|
|
808
|
|
809 /* Only provided if AIM_IMFLAGS_HASICON is set */
|
|
810 time_t iconstamp;
|
|
811 guint32 iconlen;
|
|
812 guint16 iconsum;
|
|
813
|
|
814 /* Only provided if AIM_IMFLAGS_CUSTOMFEATURES is set */
|
|
815 guint8 *features;
|
|
816 guint8 featureslen;
|
|
817
|
|
818 /* Only provided if AIM_IMFLAGS_EXTDATA is set */
|
|
819 guint8 extdatalen;
|
|
820 guint8 *extdata;
|
|
821
|
|
822 /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set */
|
|
823 guint16 charset;
|
|
824 guint16 charsubset;
|
|
825 };
|
|
826
|
|
827 /* Valid values for channel 2 args->status */
|
13592
|
828 #define AIM_RENDEZVOUS_PROPOSE 0x0000
|
|
829 #define AIM_RENDEZVOUS_CANCEL 0x0001
|
|
830 #define AIM_RENDEZVOUS_CONNECTED 0x0002
|
13234
|
831
|
13592
|
832 struct _IcbmArgsCh2
|
13239
|
833 {
|
13234
|
834 guint16 status;
|
|
835 guchar cookie[8];
|
13592
|
836 int type; /* One of the OSCAR_CAPABILITY_ constants */
|
13234
|
837 const char *proxyip;
|
|
838 const char *clientip;
|
|
839 const char *verifiedip;
|
|
840 guint16 port;
|
13592
|
841 gboolean use_proxy;
|
13234
|
842 guint16 errorcode;
|
|
843 const char *msg; /* invite message or file description */
|
|
844 guint16 msglen;
|
|
845 const char *encoding;
|
|
846 const char *language;
|
13592
|
847 guint16 requestnumber;
|
13234
|
848 union {
|
|
849 struct {
|
|
850 guint32 checksum;
|
|
851 guint32 length;
|
|
852 time_t timestamp;
|
|
853 guint8 *icon;
|
|
854 } icon;
|
|
855 struct {
|
|
856 struct aim_chat_roominfo roominfo;
|
|
857 } chat;
|
|
858 struct {
|
|
859 guint16 msgtype;
|
|
860 guint32 fgcolor;
|
|
861 guint32 bgcolor;
|
|
862 const char *rtfmsg;
|
|
863 } rtfmsg;
|
|
864 struct {
|
|
865 guint16 subtype;
|
|
866 guint16 totfiles;
|
|
867 guint32 totsize;
|
|
868 char *filename;
|
|
869 } sendfile;
|
|
870 } info;
|
|
871 void *destructor; /* used internally only */
|
|
872 };
|
|
873
|
|
874 /* Valid values for channel 4 args->type */
|
|
875 #define AIM_ICQMSG_AUTHREQUEST 0x0006
|
|
876 #define AIM_ICQMSG_AUTHDENIED 0x0007
|
|
877 #define AIM_ICQMSG_AUTHGRANTED 0x0008
|
|
878
|
13239
|
879 struct aim_incomingim_ch4_args
|
|
880 {
|
13234
|
881 guint32 uin; /* Of the sender of the ICBM */
|
|
882 guint8 type;
|
|
883 guint8 flags;
|
|
884 gchar *msg; /* Reason for auth request, deny, or accept */
|
|
885 int msglen;
|
|
886 };
|
|
887
|
|
888 /* SNAC sending functions */
|
13592
|
889 /* 0x0002 */ int aim_im_setparams(OscarData *od, struct aim_icbmparameters *params);
|
|
890 /* 0x0004 */ int aim_im_reqparams(OscarData *od);
|
|
891 /* 0x0006 */ int aim_im_sendch1_ext(OscarData *od, struct aim_sendimext_args *args);
|
|
892 /* 0x0006 */ int aim_im_sendch1(OscarData *, const char *destsn, guint16 flags, const char *msg);
|
|
893 /* 0x0006 */ int aim_im_sendch2_chatinvite(OscarData *od, const char *sn, const char *msg, guint16 exchange, const char *roomname, guint16 instance);
|
|
894 /* 0x0006 */ int aim_im_sendch2_icon(OscarData *od, const char *sn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum);
|
|
895 /* 0x0006 */ int aim_im_sendch2_rtfmsg(OscarData *od, struct aim_sendrtfmsg_args *args);
|
|
896
|
|
897 /* 0x0006 */ void aim_im_sendch2_cancel(PeerConnection *peer_conn);
|
|
898 /* 0x0006 */ void aim_im_sendch2_connected(PeerConnection *peer_conn);
|
|
899 /* 0x0006 */ void aim_im_sendch2_odc_requestdirect(OscarData *od, guchar *cookie, const char *sn, const guint8 *ip, guint16 port, guint16 requestnumber);
|
|
900 /* 0x0006 */ void aim_im_sendch2_odc_requestproxy(OscarData *od, guchar *cookie, const char *sn, const guint8 *ip, guint16 pin, guint16 requestnumber);
|
|
901 /* 0x0006 */ void aim_im_sendch2_sendfile_requestdirect(OscarData *od, guchar *cookie, const char *sn, const guint8 *ip, guint16 port, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles);
|
|
902 /* 0x0006 */ void aim_im_sendch2_sendfile_requestproxy(OscarData *od, guchar *cookie, const char *sn, const guint8 *ip, guint16 pin, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles);
|
|
903
|
|
904 /* 0x0006 */ int aim_im_sendch2_geticqaway(OscarData *od, const char *sn, int type);
|
|
905 /* 0x0006 */ int aim_im_sendch4(OscarData *od, const char *sn, guint16 type, const char *message);
|
|
906 /* 0x0008 */ int aim_im_warn(OscarData *od, FlapConnection *conn, const char *destsn, guint32 flags);
|
|
907 /* 0x000b */ int aim_im_denytransfer(OscarData *od, const char *sn, const guchar *cookie, guint16 code);
|
|
908 /* 0x0014 */ int aim_im_sendmtn(OscarData *od, guint16 type1, const char *sn, guint16 type2);
|
|
909 void aim_icbm_makecookie(guchar* cookie);
|
|
910 gchar *oscar_encoding_to_utf8(const char *encoding, const char *text, int textlen);
|
|
911 gchar *gaim_plugin_oscar_decode_im_part(GaimAccount *account, const char *sourcesn, guint16 charset, guint16 charsubset, const gchar *data, gsize datalen);
|
13234
|
912
|
|
913
|
13239
|
914 /* 0x0002 - family_locate.c */
|
13234
|
915 /*
|
|
916 * AIM User Info, Standard Form.
|
|
917 */
|
13592
|
918 #define AIM_FLAG_UNCONFIRMED 0x0001 /* "damned transients" */
|
|
919 #define AIM_FLAG_ADMINISTRATOR 0x0002
|
|
920 #define AIM_FLAG_AOL 0x0004
|
|
921 #define AIM_FLAG_OSCAR_PAY 0x0008
|
|
922 #define AIM_FLAG_FREE 0x0010
|
|
923 #define AIM_FLAG_AWAY 0x0020
|
|
924 #define AIM_FLAG_ICQ 0x0040
|
|
925 #define AIM_FLAG_WIRELESS 0x0080
|
|
926 #define AIM_FLAG_UNKNOWN100 0x0100
|
|
927 #define AIM_FLAG_UNKNOWN200 0x0200
|
|
928 #define AIM_FLAG_ACTIVEBUDDY 0x0400
|
|
929 #define AIM_FLAG_UNKNOWN800 0x0800
|
|
930 #define AIM_FLAG_ABINTERNAL 0x1000
|
|
931 #define AIM_FLAG_ALLUSERS 0x001f
|
13234
|
932
|
|
933 #define AIM_USERINFO_PRESENT_FLAGS 0x00000001
|
|
934 #define AIM_USERINFO_PRESENT_MEMBERSINCE 0x00000002
|
|
935 #define AIM_USERINFO_PRESENT_ONLINESINCE 0x00000004
|
|
936 #define AIM_USERINFO_PRESENT_IDLE 0x00000008
|
|
937 #define AIM_USERINFO_PRESENT_ICQEXTSTATUS 0x00000010
|
|
938 #define AIM_USERINFO_PRESENT_ICQIPADDR 0x00000020
|
|
939 #define AIM_USERINFO_PRESENT_ICQDATA 0x00000040
|
|
940 #define AIM_USERINFO_PRESENT_CAPABILITIES 0x00000080
|
|
941 #define AIM_USERINFO_PRESENT_SESSIONLEN 0x00000100
|
|
942 #define AIM_USERINFO_PRESENT_CREATETIME 0x00000200
|
|
943
|
13239
|
944 struct userinfo_node
|
|
945 {
|
13234
|
946 char *sn;
|
|
947 struct userinfo_node *next;
|
|
948 };
|
|
949
|
13239
|
950 typedef struct aim_userinfo_s
|
|
951 {
|
13234
|
952 char *sn;
|
|
953 guint16 warnlevel; /* evil percent * 10 (999 = 99.9%) */
|
|
954 guint16 idletime; /* in seconds */
|
|
955 guint16 flags;
|
|
956 guint32 createtime; /* time_t */
|
|
957 guint32 membersince; /* time_t */
|
|
958 guint32 onlinesince; /* time_t */
|
|
959 guint32 sessionlen; /* in seconds */
|
|
960 guint32 capabilities;
|
|
961 struct {
|
|
962 guint32 status;
|
|
963 guint32 ipaddr;
|
|
964 guint8 crap[0x25]; /* until we figure it out... */
|
|
965 } icqinfo;
|
|
966 guint32 present;
|
|
967
|
|
968 guint8 iconcsumtype;
|
|
969 guint16 iconcsumlen;
|
|
970 guint8 *iconcsum;
|
|
971
|
|
972 char *info;
|
|
973 char *info_encoding;
|
|
974 guint16 info_len;
|
|
975
|
|
976 char *status;
|
|
977 char *status_encoding;
|
|
978 guint16 status_len;
|
|
979
|
|
980 char *away;
|
|
981 char *away_encoding;
|
|
982 guint16 away_len;
|
|
983
|
|
984 struct aim_userinfo_s *next;
|
|
985 } aim_userinfo_t;
|
|
986
|
|
987 #define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0
|
|
988 #define AIM_SENDMEMBLOCK_FLAG_ISHASH 1
|
|
989
|
13592
|
990 int aim_sendmemblock(OscarData *od, FlapConnection *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag);
|
13234
|
991
|
13239
|
992 struct aim_invite_priv
|
|
993 {
|
13234
|
994 char *sn;
|
|
995 char *roomname;
|
|
996 guint16 exchange;
|
|
997 guint16 instance;
|
|
998 };
|
|
999
|
|
1000 #define AIM_COOKIETYPE_UNKNOWN 0x00
|
|
1001 #define AIM_COOKIETYPE_ICBM 0x01
|
|
1002 #define AIM_COOKIETYPE_ADS 0x02
|
|
1003 #define AIM_COOKIETYPE_BOS 0x03
|
|
1004 #define AIM_COOKIETYPE_IM 0x04
|
|
1005 #define AIM_COOKIETYPE_CHAT 0x05
|
|
1006 #define AIM_COOKIETYPE_CHATNAV 0x06
|
|
1007 #define AIM_COOKIETYPE_INVITE 0x07
|
|
1008 /* we'll move OFT up a bit to give breathing room. not like it really
|
|
1009 * matters. */
|
|
1010 #define AIM_COOKIETYPE_OFTIM 0x10
|
|
1011 #define AIM_COOKIETYPE_OFTGET 0x11
|
|
1012 #define AIM_COOKIETYPE_OFTSEND 0x12
|
|
1013 #define AIM_COOKIETYPE_OFTVOICE 0x13
|
|
1014 #define AIM_COOKIETYPE_OFTIMAGE 0x14
|
|
1015 #define AIM_COOKIETYPE_OFTICON 0x15
|
|
1016
|
13592
|
1017 aim_userinfo_t *aim_locate_finduserinfo(OscarData *od, const char *sn);
|
|
1018 void aim_locate_dorequest(OscarData *od);
|
13234
|
1019
|
13592
|
1020 /* 0x0002 */ int aim_locate_reqrights(OscarData *od);
|
|
1021 /* 0x0004 */ int aim_locate_setcaps(OscarData *od, guint32 caps);
|
|
1022 /* 0x0004 */ int aim_locate_setprofile(OscarData *od, const char *profile_encoding, const gchar *profile, const int profile_len, const char *awaymsg_encoding, const gchar *awaymsg, const int awaymsg_len);
|
|
1023 /* 0x0005 */ int aim_locate_getinfo(OscarData *od, const char *, guint16);
|
|
1024 /* 0x0009 */ int aim_locate_setdirinfo(OscarData *od, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, guint16 privacy);
|
|
1025 /* 0x000b */ int aim_locate_000b(OscarData *od, const char *sn);
|
|
1026 /* 0x000f */ int aim_locate_setinterests(OscarData *od, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, guint16 privacy);
|
|
1027 /* 0x0015 */ int aim_locate_getinfoshort(OscarData *od, const char *sn, guint32 flags);
|
|
1028
|
|
1029 void aim_locate_requestuserinfo(OscarData *od, const char *sn);
|
|
1030 guint32 aim_locate_getcaps(OscarData *od, ByteStream *bs, int len);
|
|
1031 guint32 aim_locate_getcaps_short(OscarData *od, ByteStream *bs, int len);
|
|
1032 void aim_info_free(aim_userinfo_t *);
|
|
1033 int aim_info_extract(OscarData *od, ByteStream *bs, aim_userinfo_t *);
|
|
1034 int aim_putuserinfo(ByteStream *bs, aim_userinfo_t *info);
|
13234
|
1035
|
|
1036
|
|
1037
|
13239
|
1038 /* 0x0003 - family_buddy.c */
|
13609
|
1039 /* 0x0002 */ void aim_buddylist_reqrights(OscarData *, FlapConnection *);
|
13592
|
1040 /* 0x0004 */ int aim_buddylist_set(OscarData *, FlapConnection *, const char *);
|
|
1041 /* 0x0004 */ int aim_buddylist_addbuddy(OscarData *, FlapConnection *, const char *);
|
|
1042 /* 0x0005 */ int aim_buddylist_removebuddy(OscarData *, FlapConnection *, const char *);
|
13234
|
1043
|
|
1044
|
|
1045
|
13239
|
1046 /* 0x000a - family_userlookup.c */
|
13592
|
1047 int aim_search_address(OscarData *, const char *);
|
13234
|
1048
|
|
1049
|
|
1050
|
13239
|
1051 /* 0x000d - family_chatnav.c */
|
|
1052 /* 0x000e - family_chat.c */
|
13234
|
1053 /* These apply to exchanges as well. */
|
|
1054 #define AIM_CHATROOM_FLAG_EVILABLE 0x0001
|
|
1055 #define AIM_CHATROOM_FLAG_NAV_ONLY 0x0002
|
|
1056 #define AIM_CHATROOM_FLAG_INSTANCING_ALLOWED 0x0004
|
|
1057 #define AIM_CHATROOM_FLAG_OCCUPANT_PEEK_ALLOWED 0x0008
|
|
1058
|
13239
|
1059 struct aim_chat_exchangeinfo
|
|
1060 {
|
13234
|
1061 guint16 number;
|
|
1062 guint16 flags;
|
|
1063 char *name;
|
|
1064 char *charset1;
|
|
1065 char *lang1;
|
|
1066 char *charset2;
|
|
1067 char *lang2;
|
|
1068 };
|
|
1069
|
|
1070 #define AIM_CHATFLAGS_NOREFLECT 0x0001
|
|
1071 #define AIM_CHATFLAGS_AWAY 0x0002
|
13592
|
1072 int aim_chat_send_im(OscarData *od, FlapConnection *conn, guint16 flags, const gchar *msg, int msglen, const char *encoding, const char *language);
|
|
1073 int aim_chat_join(OscarData *od, guint16 exchange, const char *roomname, guint16 instance);
|
|
1074 int aim_chat_attachname(FlapConnection *conn, guint16 exchange, const char *roomname, guint16 instance);
|
|
1075 char *aim_chat_getname(FlapConnection *conn);
|
|
1076 FlapConnection *aim_chat_getconn(OscarData *, const char *name);
|
13234
|
1077
|
13609
|
1078 void aim_chatnav_reqrights(OscarData *od, FlapConnection *conn);
|
13234
|
1079
|
13592
|
1080 int aim_chatnav_createroom(OscarData *od, FlapConnection *conn, const char *name, guint16 exchange);
|
|
1081 int aim_chat_leaveroom(OscarData *od, const char *name);
|
13234
|
1082
|
|
1083
|
|
1084
|
13239
|
1085 /* 0x000f - family_odir.c */
|
|
1086 struct aim_odir
|
|
1087 {
|
13234
|
1088 char *first;
|
|
1089 char *last;
|
|
1090 char *middle;
|
|
1091 char *maiden;
|
|
1092 char *email;
|
|
1093 char *country;
|
|
1094 char *state;
|
|
1095 char *city;
|
|
1096 char *sn;
|
|
1097 char *interest;
|
|
1098 char *nick;
|
|
1099 char *zip;
|
|
1100 char *region;
|
|
1101 char *address;
|
|
1102 struct aim_odir *next;
|
|
1103 };
|
|
1104
|
13592
|
1105 int aim_odir_email(OscarData *, const char *, const char *);
|
|
1106 int aim_odir_name(OscarData *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *);
|
|
1107 int aim_odir_interest(OscarData *, const char *, const char *);
|
13234
|
1108
|
|
1109
|
|
1110
|
13239
|
1111 /* 0x0010 - family_bart.c */
|
13592
|
1112 int aim_bart_upload(OscarData *od, const guint8 *icon, guint16 iconlen);
|
|
1113 int aim_bart_request(OscarData *od, const char *sn, guint8 iconcsumtype, const guint8 *iconstr, guint16 iconstrlen);
|
13234
|
1114
|
|
1115
|
|
1116
|
13239
|
1117 /* 0x0013 - family_feedbag.c */
|
13234
|
1118 #define AIM_SSI_TYPE_BUDDY 0x0000
|
|
1119 #define AIM_SSI_TYPE_GROUP 0x0001
|
|
1120 #define AIM_SSI_TYPE_PERMIT 0x0002
|
|
1121 #define AIM_SSI_TYPE_DENY 0x0003
|
|
1122 #define AIM_SSI_TYPE_PDINFO 0x0004
|
|
1123 #define AIM_SSI_TYPE_PRESENCEPREFS 0x0005
|
|
1124 #define AIM_SSI_TYPE_ICONINFO 0x0014
|
|
1125
|
|
1126 #define AIM_SSI_ACK_SUCCESS 0x0000
|
|
1127 #define AIM_SSI_ACK_ITEMNOTFOUND 0x0002
|
|
1128 #define AIM_SSI_ACK_IDNUMINUSE 0x000a
|
|
1129 #define AIM_SSI_ACK_ATMAX 0x000c
|
|
1130 #define AIM_SSI_ACK_INVALIDNAME 0x000d
|
|
1131 #define AIM_SSI_ACK_AUTHREQUIRED 0x000e
|
|
1132
|
|
1133 /* These flags are set in the 0x00c9 TLV of SSI teyp 0x0005 */
|
|
1134 #define AIM_SSI_PRESENCE_FLAG_SHOWIDLE 0x00000400
|
|
1135 #define AIM_SSI_PRESENCE_FLAG_NORECENTBUDDIES 0x00020000
|
|
1136
|
13239
|
1137 struct aim_ssi_item
|
|
1138 {
|
13234
|
1139 char *name;
|
|
1140 guint16 gid;
|
|
1141 guint16 bid;
|
|
1142 guint16 type;
|
|
1143 struct aim_tlvlist_s *data;
|
|
1144 struct aim_ssi_item *next;
|
|
1145 };
|
|
1146
|
13239
|
1147 struct aim_ssi_tmp
|
|
1148 {
|
13234
|
1149 guint16 action;
|
|
1150 guint16 ack;
|
|
1151 char *name;
|
|
1152 struct aim_ssi_item *item;
|
|
1153 struct aim_ssi_tmp *next;
|
|
1154 };
|
|
1155
|
|
1156 /* These build the actual SNACs and queue them to be sent */
|
13592
|
1157 /* 0x0002 */ int aim_ssi_reqrights(OscarData *od);
|
|
1158 /* 0x0004 */ int aim_ssi_reqdata(OscarData *od);
|
|
1159 /* 0x0005 */ int aim_ssi_reqifchanged(OscarData *od, time_t localstamp, guint16 localrev);
|
|
1160 /* 0x0007 */ int aim_ssi_enable(OscarData *od);
|
|
1161 /* 0x0011 */ int aim_ssi_modbegin(OscarData *od);
|
|
1162 /* 0x0012 */ int aim_ssi_modend(OscarData *od);
|
|
1163 /* 0x0014 */ int aim_ssi_sendauth(OscarData *od, char *sn, char *msg);
|
|
1164 /* 0x0018 */ int aim_ssi_sendauthrequest(OscarData *od, char *sn, const char *msg);
|
|
1165 /* 0x001a */ int aim_ssi_sendauthreply(OscarData *od, char *sn, guint8 reply, const char *msg);
|
13234
|
1166
|
|
1167 /* Client functions for retrieving SSI data */
|
13592
|
1168 struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gid, guint16 bid);
|
|
1169 struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *sn, guint16 type);
|
|
1170 struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *sn);
|
|
1171 char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *sn);
|
|
1172 int aim_ssi_getpermdeny(struct aim_ssi_item *list);
|
|
1173 guint32 aim_ssi_getpresence(struct aim_ssi_item *list);
|
|
1174 char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *sn);
|
|
1175 char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *sn);
|
13901
|
1176 gboolean aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *sn);
|
13234
|
1177
|
|
1178 /* Client functions for changing SSI data */
|
13592
|
1179 int aim_ssi_addbuddy(OscarData *od, const char *name, const char *group, const char *alias, const char *comment, const char *smsnum, int needauth);
|
|
1180 int aim_ssi_addpermit(OscarData *od, const char *name);
|
|
1181 int aim_ssi_adddeny(OscarData *od, const char *name);
|
|
1182 int aim_ssi_delbuddy(OscarData *od, const char *name, const char *group);
|
|
1183 int aim_ssi_delpermit(OscarData *od, const char *name);
|
|
1184 int aim_ssi_deldeny(OscarData *od, const char *name);
|
|
1185 int aim_ssi_movebuddy(OscarData *od, const char *oldgn, const char *newgn, const char *sn);
|
|
1186 int aim_ssi_aliasbuddy(OscarData *od, const char *gn, const char *sn, const char *alias);
|
|
1187 int aim_ssi_editcomment(OscarData *od, const char *gn, const char *sn, const char *alias);
|
|
1188 int aim_ssi_rename_group(OscarData *od, const char *oldgn, const char *newgn);
|
|
1189 int aim_ssi_cleanlist(OscarData *od);
|
|
1190 int aim_ssi_deletelist(OscarData *od);
|
|
1191 int aim_ssi_setpermdeny(OscarData *od, guint8 permdeny, guint32 vismask);
|
|
1192 int aim_ssi_setpresence(OscarData *od, guint32 presence);
|
13890
|
1193 int aim_ssi_seticon(OscarData *od, const guint8 *iconsum, guint16 iconsumlen);
|
13592
|
1194 int aim_ssi_delicon(OscarData *od);
|
13234
|
1195
|
|
1196
|
|
1197
|
13239
|
1198 /* 0x0015 - family_icq.c */
|
13234
|
1199 #define AIM_ICQ_INFO_SIMPLE 0x001
|
|
1200 #define AIM_ICQ_INFO_SUMMARY 0x002
|
|
1201 #define AIM_ICQ_INFO_EMAIL 0x004
|
|
1202 #define AIM_ICQ_INFO_PERSONAL 0x008
|
|
1203 #define AIM_ICQ_INFO_ADDITIONAL 0x010
|
|
1204 #define AIM_ICQ_INFO_WORK 0x020
|
|
1205 #define AIM_ICQ_INFO_INTERESTS 0x040
|
|
1206 #define AIM_ICQ_INFO_ORGS 0x080
|
|
1207 #define AIM_ICQ_INFO_UNKNOWN 0x100
|
|
1208 #define AIM_ICQ_INFO_HAVEALL 0x1ff
|
|
1209
|
13239
|
1210 struct aim_icq_offlinemsg
|
|
1211 {
|
13234
|
1212 guint32 sender;
|
|
1213 guint16 year;
|
|
1214 guint8 month, day, hour, minute;
|
|
1215 guint8 type;
|
|
1216 guint8 flags;
|
|
1217 char *msg;
|
|
1218 int msglen;
|
|
1219 };
|
|
1220
|
13239
|
1221 struct aim_icq_info
|
|
1222 {
|
13234
|
1223 guint16 reqid;
|
|
1224
|
|
1225 /* simple */
|
|
1226 guint32 uin;
|
|
1227
|
|
1228 /* general and "home" information (0x00c8) */
|
|
1229 char *nick;
|
|
1230 char *first;
|
|
1231 char *last;
|
|
1232 char *email;
|
|
1233 char *homecity;
|
|
1234 char *homestate;
|
|
1235 char *homephone;
|
|
1236 char *homefax;
|
|
1237 char *homeaddr;
|
|
1238 char *mobile;
|
|
1239 char *homezip;
|
|
1240 guint16 homecountry;
|
|
1241 /* guint8 timezone;
|
|
1242 guint8 hideemail; */
|
|
1243
|
|
1244 /* personal (0x00dc) */
|
|
1245 guint8 age;
|
|
1246 guint8 unknown;
|
|
1247 guint8 gender;
|
|
1248 char *personalwebpage;
|
|
1249 guint16 birthyear;
|
|
1250 guint8 birthmonth;
|
|
1251 guint8 birthday;
|
|
1252 guint8 language1;
|
|
1253 guint8 language2;
|
|
1254 guint8 language3;
|
|
1255
|
|
1256 /* work (0x00d2) */
|
|
1257 char *workcity;
|
|
1258 char *workstate;
|
|
1259 char *workphone;
|
|
1260 char *workfax;
|
|
1261 char *workaddr;
|
|
1262 char *workzip;
|
|
1263 guint16 workcountry;
|
|
1264 char *workcompany;
|
|
1265 char *workdivision;
|
|
1266 char *workposition;
|
|
1267 char *workwebpage;
|
|
1268
|
|
1269 /* additional personal information (0x00e6) */
|
|
1270 char *info;
|
|
1271
|
|
1272 /* email (0x00eb) */
|
|
1273 guint16 numaddresses;
|
|
1274 char **email2;
|
|
1275
|
|
1276 /* we keep track of these in a linked list because we're 1337 */
|
|
1277 struct aim_icq_info *next;
|
|
1278 };
|
|
1279
|
13592
|
1280 int aim_icq_reqofflinemsgs(OscarData *od);
|
|
1281 int aim_icq_ackofflinemsgs(OscarData *od);
|
|
1282 int aim_icq_setsecurity(OscarData *od, gboolean auth_required, gboolean webaware);
|
|
1283 int aim_icq_changepasswd(OscarData *od, const char *passwd);
|
|
1284 int aim_icq_getsimpleinfo(OscarData *od, const char *uin);
|
|
1285 int aim_icq_getalias(OscarData *od, const char *uin);
|
|
1286 int aim_icq_getallinfo(OscarData *od, const char *uin);
|
13234
|
1287
|
|
1288
|
|
1289
|
13239
|
1290 /* 0x0017 - family_auth.c */
|
13592
|
1291 void aim_sendcookie(OscarData *, FlapConnection *, const guint16 length, const guint8 *);
|
|
1292 int aim_admin_changepasswd(OscarData *, FlapConnection *, const char *newpw, const char *curpw);
|
|
1293 int aim_admin_reqconfirm(OscarData *od, FlapConnection *conn);
|
|
1294 int aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info);
|
|
1295 int aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail);
|
|
1296 int aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick);
|
13234
|
1297
|
|
1298
|
|
1299
|
13239
|
1300 /* 0x0018 - family_alert.c */
|
|
1301 struct aim_emailinfo
|
|
1302 {
|
13234
|
1303 guint8 *cookie16;
|
|
1304 guint8 *cookie8;
|
|
1305 char *url;
|
|
1306 guint16 nummsgs;
|
|
1307 guint8 unread;
|
|
1308 char *domain;
|
|
1309 guint16 flag;
|
|
1310 struct aim_emailinfo *next;
|
|
1311 };
|
|
1312
|
13592
|
1313 int aim_email_sendcookies(OscarData *od);
|
|
1314 int aim_email_activate(OscarData *od);
|
13234
|
1315
|
|
1316
|
|
1317
|
|
1318 /* tlv.c - TLV handling */
|
|
1319
|
|
1320 /* TLV structure */
|
13239
|
1321 typedef struct aim_tlv_s
|
|
1322 {
|
13234
|
1323 guint16 type;
|
|
1324 guint16 length;
|
|
1325 guint8 *value;
|
|
1326 } aim_tlv_t;
|
|
1327
|
|
1328 /* TLV List structure */
|
13239
|
1329 typedef struct aim_tlvlist_s
|
|
1330 {
|
13234
|
1331 aim_tlv_t *tlv;
|
|
1332 struct aim_tlvlist_s *next;
|
|
1333 } aim_tlvlist_t;
|
|
1334
|
|
1335 /* TLV handling functions */
|
13652
|
1336 char *aim_tlv_getvalue_as_string(aim_tlv_t *tlv);
|
|
1337
|
13592
|
1338 aim_tlv_t *aim_tlv_gettlv(aim_tlvlist_t *list, guint16 type, const int nth);
|
|
1339 int aim_tlv_getlength(aim_tlvlist_t *list, guint16 type, const int nth);
|
|
1340 char *aim_tlv_getstr(aim_tlvlist_t *list, const guint16 type, const int nth);
|
|
1341 guint8 aim_tlv_get8(aim_tlvlist_t *list, const guint16 type, const int nth);
|
|
1342 guint16 aim_tlv_get16(aim_tlvlist_t *list, const guint16 type, const int nth);
|
|
1343 guint32 aim_tlv_get32(aim_tlvlist_t *list, const guint16 type, const int nth);
|
13234
|
1344
|
|
1345 /* TLV list handling functions */
|
13592
|
1346 aim_tlvlist_t *aim_tlvlist_read(ByteStream *bs);
|
|
1347 aim_tlvlist_t *aim_tlvlist_readnum(ByteStream *bs, guint16 num);
|
|
1348 aim_tlvlist_t *aim_tlvlist_readlen(ByteStream *bs, guint16 len);
|
|
1349 aim_tlvlist_t *aim_tlvlist_copy(aim_tlvlist_t *orig);
|
13234
|
1350
|
13592
|
1351 int aim_tlvlist_count(aim_tlvlist_t **list);
|
|
1352 int aim_tlvlist_size(aim_tlvlist_t **list);
|
|
1353 int aim_tlvlist_cmp(aim_tlvlist_t *one, aim_tlvlist_t *two);
|
|
1354 int aim_tlvlist_write(ByteStream *bs, aim_tlvlist_t **list);
|
|
1355 void aim_tlvlist_free(aim_tlvlist_t **list);
|
13234
|
1356
|
13592
|
1357 int aim_tlvlist_add_raw(aim_tlvlist_t **list, const guint16 type, const guint16 length, const guint8 *value);
|
|
1358 int aim_tlvlist_add_noval(aim_tlvlist_t **list, const guint16 type);
|
|
1359 int aim_tlvlist_add_8(aim_tlvlist_t **list, const guint16 type, const guint8 value);
|
|
1360 int aim_tlvlist_add_16(aim_tlvlist_t **list, const guint16 type, const guint16 value);
|
|
1361 int aim_tlvlist_add_32(aim_tlvlist_t **list, const guint16 type, const guint32 value);
|
|
1362 int aim_tlvlist_add_str(aim_tlvlist_t **list, const guint16 type, const char *value);
|
|
1363 int aim_tlvlist_add_caps(aim_tlvlist_t **list, const guint16 type, const guint32 caps);
|
|
1364 int aim_tlvlist_add_userinfo(aim_tlvlist_t **list, guint16 type, aim_userinfo_t *userinfo);
|
|
1365 int aim_tlvlist_add_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance);
|
|
1366 int aim_tlvlist_add_frozentlvlist(aim_tlvlist_t **list, guint16 type, aim_tlvlist_t **tl);
|
13234
|
1367
|
13592
|
1368 int aim_tlvlist_replace_raw(aim_tlvlist_t **list, const guint16 type, const guint16 lenth, const guint8 *value);
|
|
1369 int aim_tlvlist_replace_str(aim_tlvlist_t **list, const guint16 type, const char *str);
|
|
1370 int aim_tlvlist_replace_noval(aim_tlvlist_t **list, const guint16 type);
|
|
1371 int aim_tlvlist_replace_8(aim_tlvlist_t **list, const guint16 type, const guint8 value);
|
|
1372 int aim_tlvlist_replace_16(aim_tlvlist_t **list, const guint16 type, const guint16 value);
|
|
1373 int aim_tlvlist_replace_32(aim_tlvlist_t **list, const guint16 type, const guint32 value);
|
13234
|
1374
|
13592
|
1375 void aim_tlvlist_remove(aim_tlvlist_t **list, const guint16 type);
|
13234
|
1376
|
|
1377
|
|
1378
|
|
1379 /* util.c */
|
13592
|
1380 /* These are really ugly. You'd think this was LISP. I wish it was. */
|
13234
|
1381 #define aimutil_put8(buf, data) ((*(buf) = (guint8)(data)&0xff),1)
|
|
1382 #define aimutil_get8(buf) ((*(buf))&0xff)
|
|
1383 #define aimutil_put16(buf, data) ( \
|
|
1384 (*(buf) = (guint8)((data)>>8)&0xff), \
|
|
1385 (*((buf)+1) = (guint8)(data)&0xff), \
|
|
1386 2)
|
|
1387 #define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff))
|
|
1388 #define aimutil_put32(buf, data) ( \
|
|
1389 (*((buf)) = (guint8)((data)>>24)&0xff), \
|
|
1390 (*((buf)+1) = (guint8)((data)>>16)&0xff), \
|
|
1391 (*((buf)+2) = (guint8)((data)>>8)&0xff), \
|
|
1392 (*((buf)+3) = (guint8)(data)&0xff), \
|
|
1393 4)
|
|
1394 #define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \
|
|
1395 (((*((buf)+1))<<16)&0x00ff0000) + \
|
|
1396 (((*((buf)+2))<< 8)&0x0000ff00) + \
|
|
1397 (((*((buf)+3) )&0x000000ff)))
|
|
1398
|
|
1399 /* Little-endian versions (damn ICQ) */
|
|
1400 #define aimutil_putle8(buf, data) ( \
|
|
1401 (*(buf) = (guint8)(data) & 0xff), \
|
|
1402 1)
|
|
1403 #define aimutil_getle8(buf) ( \
|
|
1404 (*(buf)) & 0xff \
|
|
1405 )
|
|
1406 #define aimutil_putle16(buf, data) ( \
|
|
1407 (*((buf)+0) = (guint8)((data) >> 0) & 0xff), \
|
|
1408 (*((buf)+1) = (guint8)((data) >> 8) & 0xff), \
|
|
1409 2)
|
|
1410 #define aimutil_getle16(buf) ( \
|
|
1411 (((*((buf)+0)) << 0) & 0x00ff) + \
|
|
1412 (((*((buf)+1)) << 8) & 0xff00) \
|
|
1413 )
|
|
1414 #define aimutil_putle32(buf, data) ( \
|
|
1415 (*((buf)+0) = (guint8)((data) >> 0) & 0xff), \
|
|
1416 (*((buf)+1) = (guint8)((data) >> 8) & 0xff), \
|
|
1417 (*((buf)+2) = (guint8)((data) >> 16) & 0xff), \
|
|
1418 (*((buf)+3) = (guint8)((data) >> 24) & 0xff), \
|
|
1419 4)
|
|
1420 #define aimutil_getle32(buf) ( \
|
|
1421 (((*((buf)+0)) << 0) & 0x000000ff) + \
|
|
1422 (((*((buf)+1)) << 8) & 0x0000ff00) + \
|
|
1423 (((*((buf)+2)) << 16) & 0x00ff0000) + \
|
|
1424 (((*((buf)+3)) << 24) & 0xff000000))
|
|
1425
|
13592
|
1426 guint16 aimutil_iconsum(const guint8 *buf, int buflen);
|
|
1427 int aimutil_tokslen(char *toSearch, int theindex, char dl);
|
|
1428 int aimutil_itemcnt(char *toSearch, char dl);
|
|
1429 char *aimutil_itemindex(char *toSearch, int theindex, char dl);
|
|
1430
|
13606
|
1431 gboolean aim_snvalid(const char *sn);
|
|
1432 gboolean aim_sn_is_icq(const char *sn);
|
|
1433 gboolean aim_sn_is_sms(const char *sn);
|
13592
|
1434 int aim_snlen(const char *sn);
|
|
1435 int aim_sncmp(const char *sn1, const char *sn2);
|
|
1436
|
|
1437
|
|
1438
|
|
1439
|
|
1440 typedef struct {
|
|
1441 guint16 family;
|
|
1442 guint16 subtype;
|
|
1443 guint16 flags;
|
|
1444 guint32 id;
|
|
1445 } aim_modsnac_t;
|
|
1446
|
|
1447 #define AIM_MODULENAME_MAXLEN 16
|
|
1448 #define AIM_MODFLAG_MULTIFAMILY 0x0001
|
|
1449 typedef struct aim_module_s
|
|
1450 {
|
|
1451 guint16 family;
|
|
1452 guint16 version;
|
|
1453 guint16 toolid;
|
|
1454 guint16 toolversion;
|
|
1455 guint16 flags;
|
|
1456 char name[AIM_MODULENAME_MAXLEN+1];
|
|
1457 int (*snachandler)(OscarData *od, FlapConnection *conn, struct aim_module_s *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs);
|
|
1458 void (*shutdown)(OscarData *od, struct aim_module_s *mod);
|
|
1459 void *priv;
|
|
1460 struct aim_module_s *next;
|
|
1461 } aim_module_t;
|
|
1462
|
|
1463 int aim__registermodule(OscarData *od, int (*modfirst)(OscarData *, aim_module_t *));
|
|
1464 void aim__shutdownmodules(OscarData *od);
|
|
1465 aim_module_t *aim__findmodulebygroup(OscarData *od, guint16 group);
|
|
1466 aim_module_t *aim__findmodule(OscarData *od, const char *name);
|
|
1467
|
|
1468 int admin_modfirst(OscarData *od, aim_module_t *mod);
|
|
1469 int buddylist_modfirst(OscarData *od, aim_module_t *mod);
|
|
1470 int bos_modfirst(OscarData *od, aim_module_t *mod);
|
|
1471 int search_modfirst(OscarData *od, aim_module_t *mod);
|
|
1472 int stats_modfirst(OscarData *od, aim_module_t *mod);
|
|
1473 int auth_modfirst(OscarData *od, aim_module_t *mod);
|
|
1474 int msg_modfirst(OscarData *od, aim_module_t *mod);
|
|
1475 int misc_modfirst(OscarData *od, aim_module_t *mod);
|
|
1476 int chatnav_modfirst(OscarData *od, aim_module_t *mod);
|
|
1477 int chat_modfirst(OscarData *od, aim_module_t *mod);
|
|
1478 int locate_modfirst(OscarData *od, aim_module_t *mod);
|
|
1479 int service_modfirst(OscarData *od, aim_module_t *mod);
|
|
1480 int invite_modfirst(OscarData *od, aim_module_t *mod);
|
|
1481 int translate_modfirst(OscarData *od, aim_module_t *mod);
|
|
1482 int popups_modfirst(OscarData *od, aim_module_t *mod);
|
|
1483 int adverts_modfirst(OscarData *od, aim_module_t *mod);
|
|
1484 int odir_modfirst(OscarData *od, aim_module_t *mod);
|
|
1485 int bart_modfirst(OscarData *od, aim_module_t *mod);
|
|
1486 int ssi_modfirst(OscarData *od, aim_module_t *mod);
|
|
1487 int icq_modfirst(OscarData *od, aim_module_t *mod);
|
|
1488 int email_modfirst(OscarData *od, aim_module_t *mod);
|
|
1489
|
|
1490 int aim_genericreq_n(OscarData *, FlapConnection *conn, guint16 family, guint16 subtype);
|
13609
|
1491 void aim_genericreq_n_snacid(OscarData *, FlapConnection *conn, guint16 family, guint16 subtype);
|
13592
|
1492 int aim_genericreq_l(OscarData *, FlapConnection *conn, guint16 family, guint16 subtype, guint32 *);
|
|
1493 int aim_genericreq_s(OscarData *, FlapConnection *conn, guint16 family, guint16 subtype, guint16 *);
|
13234
|
1494
|
13592
|
1495 /* bstream.c */
|
|
1496 int byte_stream_init(ByteStream *bs, guint8 *data, int len);
|
|
1497 int byte_stream_empty(ByteStream *bs);
|
|
1498 int byte_stream_curpos(ByteStream *bs);
|
|
1499 int byte_stream_setpos(ByteStream *bs, unsigned int off);
|
|
1500 void byte_stream_rewind(ByteStream *bs);
|
|
1501 int byte_stream_advance(ByteStream *bs, int n);
|
|
1502 guint8 byte_stream_get8(ByteStream *bs);
|
|
1503 guint16 byte_stream_get16(ByteStream *bs);
|
|
1504 guint32 byte_stream_get32(ByteStream *bs);
|
|
1505 guint8 byte_stream_getle8(ByteStream *bs);
|
|
1506 guint16 byte_stream_getle16(ByteStream *bs);
|
|
1507 guint32 byte_stream_getle32(ByteStream *bs);
|
|
1508 int byte_stream_getrawbuf(ByteStream *bs, guint8 *buf, int len);
|
|
1509 guint8 *byte_stream_getraw(ByteStream *bs, int len);
|
|
1510 char *byte_stream_getstr(ByteStream *bs, int len);
|
|
1511 int byte_stream_put8(ByteStream *bs, guint8 v);
|
|
1512 int byte_stream_put16(ByteStream *bs, guint16 v);
|
|
1513 int byte_stream_put32(ByteStream *bs, guint32 v);
|
|
1514 int byte_stream_putle8(ByteStream *bs, guint8 v);
|
|
1515 int byte_stream_putle16(ByteStream *bs, guint16 v);
|
|
1516 int byte_stream_putle32(ByteStream *bs, guint32 v);
|
|
1517 int byte_stream_putraw(ByteStream *bs, const guint8 *v, int len);
|
|
1518 int byte_stream_putstr(ByteStream *bs, const char *str);
|
|
1519 int byte_stream_putbs(ByteStream *bs, ByteStream *srcbs, int len);
|
|
1520 int byte_stream_putcaps(ByteStream *bs, guint32 caps);
|
|
1521
|
|
1522 /* rxhandlers.c */
|
|
1523 aim_rxcallback_t aim_callhandler(OscarData *od, guint16 family, guint16 type);
|
|
1524
|
|
1525 /*
|
|
1526 * Generic SNAC structure. Rarely if ever used.
|
|
1527 */
|
|
1528 typedef struct aim_snac_s {
|
|
1529 aim_snacid_t id;
|
|
1530 guint16 family;
|
|
1531 guint16 type;
|
|
1532 guint16 flags;
|
|
1533 void *data;
|
|
1534 time_t issuetime;
|
|
1535 struct aim_snac_s *next;
|
|
1536 } aim_snac_t;
|
|
1537
|
|
1538 /* snac.c */
|
|
1539 void aim_initsnachash(OscarData *od);
|
|
1540 aim_snacid_t aim_newsnac(OscarData *, aim_snac_t *newsnac);
|
|
1541 aim_snacid_t aim_cachesnac(OscarData *od, const guint16 family, const guint16 type, const guint16 flags, const void *data, const int datalen);
|
|
1542 aim_snac_t *aim_remsnac(OscarData *, aim_snacid_t id);
|
|
1543 int aim_putsnac(ByteStream *, guint16 family, guint16 type, guint16 flags, aim_snacid_t id);
|
|
1544
|
|
1545 struct chatsnacinfo {
|
|
1546 guint16 exchange;
|
|
1547 char name[128];
|
|
1548 guint16 instance;
|
|
1549 };
|
13234
|
1550
|
13592
|
1551 struct snacpair {
|
|
1552 guint16 group;
|
|
1553 guint16 subtype;
|
|
1554 struct snacpair *next;
|
|
1555 };
|
|
1556
|
|
1557 struct rateclass {
|
|
1558 guint16 classid;
|
|
1559 guint32 windowsize;
|
|
1560 guint32 clear;
|
|
1561 guint32 alert;
|
|
1562 guint32 limit;
|
|
1563 guint32 disconnect;
|
|
1564 guint32 current;
|
|
1565 guint32 max;
|
|
1566 guint8 unknown[5]; /* only present in versions >= 3 */
|
|
1567 struct snacpair *members;
|
|
1568 struct rateclass *next;
|
|
1569 };
|
|
1570
|
|
1571 int aim_cachecookie(OscarData *od, IcbmCookie *cookie);
|
|
1572 IcbmCookie *aim_uncachecookie(OscarData *od, guint8 *cookie, int type);
|
|
1573 IcbmCookie *aim_mkcookie(guint8 *, int, void *);
|
|
1574 IcbmCookie *aim_checkcookie(OscarData *, const unsigned char *, const int);
|
|
1575 int aim_freecookie(OscarData *od, IcbmCookie *cookie);
|
|
1576 int aim_msgcookie_gettype(int type);
|
|
1577 int aim_cookie_free(OscarData *od, IcbmCookie *cookie);
|
|
1578
|
|
1579 int aim_chat_readroominfo(ByteStream *bs, struct aim_chat_roominfo *outinfo);
|
|
1580
|
|
1581 void flap_connection_destroy_chat(OscarData *od, FlapConnection *conn);
|
|
1582
|
|
1583 /* These are all handled internally now. */
|
13609
|
1584 void aim_setversions(OscarData *od, FlapConnection *conn);
|
|
1585 void aim_reqrates(OscarData *, FlapConnection *);
|
|
1586 void aim_rates_addparam(OscarData *, FlapConnection *);
|
|
1587 void aim_rates_delparam(OscarData *, FlapConnection *);
|
|
1588 void aim_sendpauseack(OscarData *od, FlapConnection *conn);
|
13592
|
1589
|
|
1590
|
|
1591
|
|
1592
|
13234
|
1593
|
|
1594 #ifdef __cplusplus
|
|
1595 }
|
|
1596 #endif
|
|
1597
|
|
1598 #endif /* _OSCAR_H_ */
|