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