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