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