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