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