Mercurial > pidgin
comparison src/protocols/oscar/oscar.h @ 13592:6519aeb66b31
[gaim-migrate @ 15978]
Holy cow this is crazy.
34 files changed, 5760 insertions(+), 8517 deletions(-)
* Non-blocking I/O for all of oscar. That includes normal FLAP
connections as well as file transfers and direct IM.
* Kick-ass file transfer and direct IM. Either party can request
the connection. Gaim will try both the "public" IP and the
"client" IP. It'll fall back to transferring through a proxy
if that fails. Should be relatively few memleaks (I didn't
have a lot of confidence in the non-memleakiness of the old
code). And the code is reasonably generic, so it shouldn't
be too much work to add voice chat. This might still be a
LITTLE buggy, but it shouldn't be too bad. If anything, file
transfer will be more buggy than direct IM. And sending a
file will be more buggy than receiving a file. Bug reports
with a series of steps to reproduce are welcome.
* I merged OscarData and aim_session_t
* Somewhere between 50 and 100 hours of work.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 07 Apr 2006 05:10:56 +0000 |
parents | b08f8f3c9197 |
children | c1157497b32c |
comparison
equal
deleted
inserted
replaced
13591:dcfda39ad547 | 13592:6519aeb66b31 |
---|---|
28 | 28 |
29 #ifndef _OSCAR_H_ | 29 #ifndef _OSCAR_H_ |
30 #define _OSCAR_H_ | 30 #define _OSCAR_H_ |
31 | 31 |
32 #include "debug.h" | 32 #include "debug.h" |
33 #include "eventloop.h" | |
33 #include "gaim_buffer.h" | 34 #include "gaim_buffer.h" |
34 #include "internal.h" | 35 #include "internal.h" |
35 | 36 |
36 #include <stdio.h> | 37 #include <stdio.h> |
37 #include <string.h> | 38 #include <string.h> |
54 | 55 |
55 typedef struct _ByteStream ByteStream; | 56 typedef struct _ByteStream ByteStream; |
56 typedef struct _ClientInfo ClientInfo; | 57 typedef struct _ClientInfo ClientInfo; |
57 typedef struct _FlapFrame FlapFrame; | 58 typedef struct _FlapFrame FlapFrame; |
58 typedef struct _IcbmCookie IcbmCookie; | 59 typedef struct _IcbmCookie IcbmCookie; |
59 typedef struct _OscarConnection OscarConnection; | 60 typedef struct _FlapConnection FlapConnection; |
60 typedef struct _OscarSession OscarSession; | 61 typedef struct _OscarData OscarData; |
62 typedef struct _IcbmArgsCh2 IcbmArgsCh2; | |
61 | 63 |
62 typedef guint32 aim_snacid_t; | 64 typedef guint32 aim_snacid_t; |
63 typedef guint16 flap_seqnum_t; | 65 typedef guint16 flap_seqnum_t; |
64 | 66 |
65 #include "peer.h" | |
66 #include "snactypes.h" | 67 #include "snactypes.h" |
67 | 68 |
68 #ifdef __cplusplus | 69 #ifdef __cplusplus |
69 extern "C" { | 70 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 | 71 #endif |
93 | 72 |
94 #define FAIM_SNAC_HASH_SIZE 16 | 73 #define FAIM_SNAC_HASH_SIZE 16 |
95 | 74 |
96 /* | 75 /* |
111 * Note that although we can send this much, its impossible | 90 * Note that although we can send this much, its impossible |
112 * for WinAIM clients (up through the latest (4.0.1957)) to | 91 * for WinAIM clients (up through the latest (4.0.1957)) to |
113 * send any more than 1kb. Amaze all your windows friends | 92 * send any more than 1kb. Amaze all your windows friends |
114 * with utterly oversized instant messages! | 93 * with utterly oversized instant messages! |
115 * | 94 * |
116 * XXX: the real limit is the total SNAC size at 8192. Fix this. | 95 * TODO: the real limit is the total SNAC size at 8192. Fix this. |
117 * | 96 * |
118 */ | 97 */ |
119 #define MAXMSGLEN 7987 | 98 #define MAXMSGLEN 7987 |
120 | 99 |
121 /* | 100 /* |
304 } | 283 } |
305 | 284 |
306 #define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_5_1_3036 | 285 #define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_5_1_3036 |
307 #define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQ_5_45_3777 | 286 #define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQ_5_45_3777 |
308 | 287 |
309 /* | 288 typedef enum |
310 * These could be arbitrary, but its easier to use the actual AIM values | 289 { |
311 */ | 290 OSCAR_CAPABILITY_BUDDYICON = 0x00000001, |
312 #define AIM_CONN_TYPE_BOS 0x0002 | 291 OSCAR_CAPABILITY_TALK = 0x00000002, |
313 #define AIM_CONN_TYPE_ADS 0x0005 | 292 OSCAR_CAPABILITY_DIRECTIM = 0x00000004, |
314 #define AIM_CONN_TYPE_AUTH 0x0007 | 293 OSCAR_CAPABILITY_CHAT = 0x00000008, |
315 #define AIM_CONN_TYPE_CHATNAV 0x000d | 294 OSCAR_CAPABILITY_GETFILE = 0x00000010, |
316 #define AIM_CONN_TYPE_CHAT 0x000e | 295 OSCAR_CAPABILITY_SENDFILE = 0x00000020, |
317 #define AIM_CONN_TYPE_SEARCH 0x000f | 296 OSCAR_CAPABILITY_GAMES = 0x00000040, |
318 #define AIM_CONN_TYPE_ICON 0x0010 | 297 OSCAR_CAPABILITY_ADDINS = 0x00000080, |
319 #define AIM_CONN_TYPE_EMAIL 0x0018 | 298 OSCAR_CAPABILITY_SENDBUDDYLIST = 0x00000100, |
320 | 299 OSCAR_CAPABILITY_GAMES2 = 0x00000200, |
321 /* they start getting arbitrary for rendezvous stuff =) */ | 300 OSCAR_CAPABILITY_ICQ_DIRECT = 0x00000400, |
322 #define AIM_CONN_TYPE_RENDEZVOUS_PROXY 0xfffd /* these speak a strange language */ | 301 OSCAR_CAPABILITY_APINFO = 0x00000800, |
323 #define AIM_CONN_TYPE_RENDEZVOUS 0xfffe /* these do not speak FLAP! */ | 302 OSCAR_CAPABILITY_ICQRTF = 0x00001000, |
324 #define AIM_CONN_TYPE_LISTENER 0xffff /* socket waiting for accept() */ | 303 OSCAR_CAPABILITY_EMPTY = 0x00002000, |
325 | 304 OSCAR_CAPABILITY_ICQSERVERRELAY = 0x00004000, |
326 /* Command types for doing a rendezvous proxy login | 305 OSCAR_CAPABILITY_ICQUTF8OLD = 0x00008000, |
327 * Thanks to Keith Lea and the Joust project for documenting these commands well */ | 306 OSCAR_CAPABILITY_TRILLIANCRYPT = 0x00010000, |
328 #define AIM_RV_PROXY_PACKETVER_DFLT 0x044a | 307 OSCAR_CAPABILITY_ICQUTF8 = 0x00020000, |
329 #define AIM_RV_PROXY_ERROR 0x0001 | 308 OSCAR_CAPABILITY_INTEROPERATE = 0x00040000, |
330 #define AIM_RV_PROXY_INIT_SEND 0x0002 /* First command sent when creating a connection */ | 309 OSCAR_CAPABILITY_ICHAT = 0x00080000, |
331 #define AIM_RV_PROXY_INIT_RECV 0x0004 /* First command sent when receiving existing connection */ | 310 OSCAR_CAPABILITY_HIPTOP = 0x00100000, |
332 #define AIM_RV_PROXY_ACK 0x0003 | 311 OSCAR_CAPABILITY_SECUREIM = 0x00200000, |
333 #define AIM_RV_PROXY_READY 0x0005 | 312 OSCAR_CAPABILITY_SMS = 0x00400000, |
334 | 313 OSCAR_CAPABILITY_GENERICUNKNOWN = 0x00800000, |
335 /* Number of bytes expected in each of the above packets, including the 2 bytes specifying length */ | 314 OSCAR_CAPABILITY_VIDEO = 0x01000000, |
336 #define AIM_RV_PROXY_ERROR_LEN 14 | 315 OSCAR_CAPABILITY_ICHATAV = 0x02000000, |
337 #define AIM_RV_PROXY_INIT_SEND_LEN 55 | 316 OSCAR_CAPABILITY_LIVEVIDEO = 0x04000000, |
338 #define AIM_RV_PROXY_INIT_RECV_LEN 57 | 317 OSCAR_CAPABILITY_CAMERA = 0x08000000, |
339 #define AIM_RV_PROXY_ACK_LEN 18 | 318 OSCAR_CAPABILITY_LAST = 0x10000000 |
340 #define AIM_RV_PROXY_READY_LEN 12 | 319 } OscarCapability; |
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?) | |
351 * These values are used in peer_connection->send_or_recv */ | |
352 #define AIM_XFER_SEND 0x0001 | |
353 #define AIM_XFER_RECV 0x0002 | |
354 | |
355 /* Via what method is the data getting routed? | |
356 * These values are used in peer_connection->method */ | |
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. | |
364 * These values are used in peer_connection->stage */ | |
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 | |
391 struct _OscarConnection | |
392 { | |
393 int fd; | |
394 GaimCircBuffer *buffer_outgoing; | |
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; | |
402 OscarSession *sessv; /* pointer to parent session */ | |
403 void *inside; /* only accessible from inside libfaim */ | |
404 struct _OscarConnection *next; | |
405 }; | |
406 | 320 |
407 /* | 321 /* |
408 * Byte Stream type. Sort of. | 322 * Byte Stream type. Sort of. |
409 * | 323 * |
410 * Use of this type serves a couple purposes: | 324 * Use of this type serves a couple purposes: |
425 guint32 offset; | 339 guint32 offset; |
426 }; | 340 }; |
427 | 341 |
428 struct _FlapFrame | 342 struct _FlapFrame |
429 { | 343 { |
430 guint8 hdrtype; /* defines which piece of the union to use */ | 344 guint8 channel; |
431 union { | 345 flap_seqnum_t seqnum; |
432 struct { | 346 ByteStream data; /* payload stream */ |
433 guint8 channel; | 347 }; |
434 flap_seqnum_t seqnum; | 348 |
435 } flap; | 349 struct _FlapConnection |
436 struct { | 350 { |
437 guint8 magic[4]; /* ODC2 or OFT2 */ | 351 OscarData *od; /**< Pointer to parent session. */ |
438 guint16 hdrlen; | 352 int fd; |
439 guint16 type; | 353 time_t lastactivity; /**< Time of last transmit. */ |
440 } rend; | 354 gboolean connected; |
441 } hdr; | 355 guint destroy_timeout; |
442 ByteStream data; /* payload stream */ | 356 |
443 OscarConnection *conn; /* the connection it came in on/is going out on */ | 357 FlapFrame buffer_incoming; |
444 guint8 handled; /* 0 = new, !0 = been handled */ | 358 GaimCircBuffer *buffer_outgoing; |
445 struct _FlapFrame *next; | 359 guint watcher_incoming; |
360 guint watcher_outgoing; | |
361 | |
362 guint16 type; | |
363 guint16 subtype; | |
364 flap_seqnum_t seqnum; | |
365 guint32 status; | |
366 void *internal; /* internal conn-specific libfaim data */ | |
367 void *inside; /* only accessible from inside libfaim */ | |
446 }; | 368 }; |
447 | 369 |
448 struct _IcbmCookie | 370 struct _IcbmCookie |
449 { | 371 { |
450 guchar cookie[8]; | 372 guchar cookie[8]; |
452 void *data; | 374 void *data; |
453 time_t addtime; | 375 time_t addtime; |
454 struct _IcbmCookie *next; | 376 struct _IcbmCookie *next; |
455 }; | 377 }; |
456 | 378 |
379 #include "peer.h" | |
380 | |
457 /* | 381 /* |
458 * AIM Session: The main client-data interface. | 382 * AIM Session: The main client-data interface. |
459 * | 383 * |
460 */ | 384 */ |
461 struct _OscarSession | 385 struct _OscarData |
462 { | 386 { |
387 gboolean iconconnecting; | |
388 gboolean set_icon; | |
389 | |
390 GSList *create_rooms; | |
391 | |
392 gboolean conf; | |
393 gboolean reqemail; | |
394 gboolean setemail; | |
395 char *email; | |
396 gboolean setnick; | |
397 char *newsn; | |
398 gboolean chpass; | |
399 char *oldp; | |
400 char *newp; | |
401 | |
402 GSList *oscar_chats; | |
403 GHashTable *buddyinfo; | |
404 GSList *requesticon; | |
405 | |
406 gboolean killme; | |
407 gboolean icq; | |
408 guint icontimer; | |
409 guint getblisttimer; | |
410 guint getinfotimer; | |
411 gint timeoffset; | |
412 | |
413 struct { | |
414 guint maxwatchers; /* max users who can watch you */ | |
415 guint maxbuddies; /* max users you can watch */ | |
416 guint maxgroups; /* max groups in server list */ | |
417 guint maxpermits; /* max users on permit list */ | |
418 guint maxdenies; /* max users on deny list */ | |
419 guint maxsiglen; /* max size (bytes) of profile */ | |
420 guint maxawaymsglen; /* max size (bytes) of posted away message */ | |
421 } rights; | |
463 | 422 |
464 /* ---- Client Accessible ------------------------ */ | 423 /* ---- Client Accessible ------------------------ */ |
465 | 424 |
466 /* Our screen name. */ | 425 /* Our screen name. */ |
426 /* TODO: Get rid of this and use gaim_account_get_username() everywhere? */ | |
467 char sn[MAXSNLEN+1]; | 427 char sn[MAXSNLEN+1]; |
468 | 428 |
469 /* | 429 GaimConnection *gc; |
470 * Pointer to anything the client wants to | |
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 | 430 |
479 /* ---- Internal Use Only ------------------------ */ | 431 /* ---- Internal Use Only ------------------------ */ |
480 | 432 |
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. | |
487 * | |
488 */ | |
489 FlapFrame *queue_outgoing; | |
490 FlapFrame *queue_incoming; | |
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 */ | |
500 int (*tx_enqueue)(OscarSession *, FlapFrame *); | |
501 | |
502 void *modlistv; | 433 void *modlistv; |
503 | |
504 struct { | |
505 char server[128]; | |
506 char username[128]; | |
507 char password[128]; | |
508 } socksproxy; | |
509 | 434 |
510 /* | 435 /* |
511 * Outstanding snac handling | 436 * Outstanding snac handling |
512 * | 437 * |
513 * XXX: Should these be per-connection? -mid | 438 * TODO: Should these be per-connection? -mid |
514 */ | 439 */ |
515 void *snac_hash[FAIM_SNAC_HASH_SIZE]; | 440 void *snac_hash[FAIM_SNAC_HASH_SIZE]; |
516 aim_snacid_t snacid_next; | 441 aim_snacid_t snacid_next; |
442 | |
443 /* | |
444 * TODO: Data specific to a certain family should go into a | |
445 * hashtable and the core parts of libfaim shouldn't | |
446 * need to know about them. | |
447 */ | |
517 | 448 |
518 IcbmCookie *msgcookies; | 449 IcbmCookie *msgcookies; |
519 struct aim_icq_info *icq_info; | 450 struct aim_icq_info *icq_info; |
520 struct aim_authresp_info *authinfo; | 451 struct aim_authresp_info *authinfo; |
521 struct aim_emailinfo *emailinfo; | 452 struct aim_emailinfo *emailinfo; |
536 struct aim_ssi_tmp *pending; | 467 struct aim_ssi_tmp *pending; |
537 time_t timestamp; | 468 time_t timestamp; |
538 int waiting_for_ack; | 469 int waiting_for_ack; |
539 } ssi; | 470 } ssi; |
540 | 471 |
541 /** A linked list containing OscarConnections. */ | 472 /* TODO: Implement this as a HashTable for HUGE speed improvement! */ |
473 GList *handlerlist; | |
474 | |
475 /** A linked list containing FlapConnections. */ | |
542 GList *oscar_connections; | 476 GList *oscar_connections; |
543 | 477 |
544 /** A linked list containing PeerConnections. */ | 478 /** A linked list containing PeerConnections. */ |
545 GList *peer_connections; | 479 GList *peer_connections; |
546 }; | 480 }; |
547 | 481 |
548 /* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */ | 482 /* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */ |
549 #define AIM_ICQ_STATE_NORMAL 0x00000000 | 483 #define AIM_ICQ_STATE_NORMAL 0x00000000 |
550 #define AIM_ICQ_STATE_AWAY 0x00000001 | 484 #define AIM_ICQ_STATE_AWAY 0x00000001 |
551 #define AIM_ICQ_STATE_DND 0x00000002 | 485 #define AIM_ICQ_STATE_DND 0x00000002 |
552 #define AIM_ICQ_STATE_OUT 0x00000004 | 486 #define AIM_ICQ_STATE_OUT 0x00000004 |
553 #define AIM_ICQ_STATE_BUSY 0x00000010 | 487 #define AIM_ICQ_STATE_BUSY 0x00000010 |
554 #define AIM_ICQ_STATE_CHAT 0x00000020 | 488 #define AIM_ICQ_STATE_CHAT 0x00000020 |
555 #define AIM_ICQ_STATE_INVISIBLE 0x00000100 | 489 #define AIM_ICQ_STATE_INVISIBLE 0x00000100 |
556 #define AIM_ICQ_STATE_WEBAWARE 0x00010000 | 490 #define AIM_ICQ_STATE_WEBAWARE 0x00010000 |
557 #define AIM_ICQ_STATE_HIDEIP 0x00020000 | 491 #define AIM_ICQ_STATE_HIDEIP 0x00020000 |
558 #define AIM_ICQ_STATE_BIRTHDAY 0x00080000 | 492 #define AIM_ICQ_STATE_BIRTHDAY 0x00080000 |
559 #define AIM_ICQ_STATE_DIRECTDISABLED 0x00100000 | 493 #define AIM_ICQ_STATE_DIRECTDISABLED 0x00100000 |
560 #define AIM_ICQ_STATE_ICQHOMEPAGE 0x00200000 | 494 #define AIM_ICQ_STATE_ICQHOMEPAGE 0x00200000 |
561 #define AIM_ICQ_STATE_DIRECTREQUIREAUTH 0x10000000 | 495 #define AIM_ICQ_STATE_DIRECTREQUIREAUTH 0x10000000 |
562 #define AIM_ICQ_STATE_DIRECTCONTACTLIST 0x20000000 | 496 #define AIM_ICQ_STATE_DIRECTCONTACTLIST 0x20000000 |
563 | 497 |
564 /* | 498 typedef int (*aim_rxcallback_t)(OscarData *od, FlapConnection *conn, FlapFrame *frame, ...); |
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 */ | |
571 faim_export int aim_get_command(OscarSession *, OscarConnection *); | |
572 | |
573 /* | |
574 * Dispatch commands that are in the rx queue. | |
575 */ | |
576 faim_export void aim_rxdispatch(OscarSession *); | |
577 | |
578 faim_export int aim_debugconn_sendconnect(OscarSession *sess, OscarConnection *conn); | |
579 | |
580 void oscar_connection_destroy(OscarSession *sess, OscarConnection *deadconn); | |
581 | |
582 typedef int (*aim_rxcallback_t)(OscarSession *, FlapFrame *, ...); | |
583 | 499 |
584 | 500 |
585 /* family_auth.c */ | 501 /* family_auth.c */ |
586 struct aim_clientrelease | 502 struct aim_clientrelease |
587 { | 503 { |
611 { | 527 { |
612 guint16 group; | 528 guint16 group; |
613 const char *ip; | 529 const char *ip; |
614 guint16 cookielen; | 530 guint16 cookielen; |
615 const guint8 *cookie; | 531 const guint8 *cookie; |
616 struct { /* group == AIM_CONN_TYPE_CHAT */ | 532 struct { /* group == SNAC_FAMILY_CHAT */ |
617 guint16 exchange; | 533 guint16 exchange; |
618 const char *room; | 534 const char *room; |
619 guint16 instance; | 535 guint16 instance; |
620 } chat; | 536 } chat; |
621 }; | 537 }; |
622 | 538 |
623 faim_export int aim_clientready(OscarSession *sess, OscarConnection *conn); | 539 int aim_clientready(OscarData *od, FlapConnection *conn); |
624 faim_export int aim_sendflapver(OscarSession *sess, OscarConnection *conn); | 540 int aim_request_login(OscarData *od, FlapConnection *conn, const char *sn); |
625 faim_export int aim_request_login(OscarSession *sess, OscarConnection *conn, const char *sn); | 541 int aim_send_login(OscarData *, FlapConnection *, const char *, const char *, ClientInfo *, const char *key); |
626 faim_export int aim_send_login(OscarSession *, OscarConnection *, const char *, const char *, ClientInfo *, const char *key); | 542 /* 0x000b */ int aim_auth_securid_send(OscarData *od, const char *securid); |
627 /* 0x000b */ faim_export int aim_auth_securid_send(OscarSession *sess, const char *securid); | 543 |
628 | 544 void aim_cleansnacs(OscarData *, int maxage); |
629 faim_export void aim_purge_rxqueue(OscarSession *); | 545 |
630 faim_export void aim_cleansnacs(OscarSession *, int maxage); | 546 int oscar_data_addhandler(OscarData *od, guint16 family, guint16 type, aim_rxcallback_t newhandler, guint16 flags); |
631 | 547 void aim_clearhandlers(OscarData *od); |
632 #define AIM_TX_QUEUED 0 /* default */ | 548 |
633 #define AIM_TX_IMMEDIATE 1 | 549 /* flap_connection.c */ |
634 faim_export int aim_tx_setenqueue(OscarSession *sess, int what, int (*func)(OscarSession *, FlapFrame *)); | 550 FlapConnection *flap_connection_new(OscarData *, int type); |
635 | 551 void flap_connection_addgroup(FlapConnection *conn, guint16 group); |
636 faim_export int aim_tx_flushqueue(OscarSession *); | 552 void flap_connection_close(OscarData *od, FlapConnection *conn); |
637 | 553 void flap_connection_destroy(FlapConnection *conn); |
638 faim_export int aim_conn_addhandler(OscarSession *, OscarConnection *conn, guint16 family, guint16 type, aim_rxcallback_t newhandler, guint16 flags); | 554 void flap_connection_schedule_destroy(FlapConnection *conn); |
639 faim_export int aim_clearhandlers(OscarConnection *conn); | 555 FlapConnection *flap_connection_findbygroup(OscarData *od, guint16 group); |
640 | 556 FlapConnection *flap_connection_getbytype(OscarData *, int type); |
641 faim_export OscarConnection *aim_conn_findbygroup(OscarSession *sess, guint16 group); | 557 FlapConnection *flap_connection_getbytype_all(OscarData *, int type); |
642 faim_export OscarSession *aim_conn_getsess(OscarConnection *conn); | 558 void flap_connection_recv_cb(gpointer data, gint source, GaimInputCondition cond); |
643 void oscar_connection_destroy(OscarSession *sess, OscarConnection *conn); | 559 FlapConnection *flap_connection_clone(OscarData *od, FlapConnection *src); |
644 faim_export void aim_conn_close(OscarSession *sess, OscarConnection *conn); | 560 void flap_connection_send(FlapConnection *conn, FlapFrame *frame); |
645 faim_export OscarConnection *oscar_connection_new(OscarSession *, int type); | 561 void flap_connection_send_version(OscarData *od, FlapConnection *conn); |
646 faim_export int aim_conn_isready(OscarConnection *); | 562 void flap_connection_send_version_with_cookie(OscarData *od, FlapConnection *conn, guint16 length, const guint8 *chipsahoy); |
647 faim_export int aim_conn_setstatus(OscarConnection *, int); | 563 void flap_connection_send_keepalive(OscarData *od, FlapConnection *conn); |
648 faim_export int aim_conn_completeconnect(OscarSession *sess, OscarConnection *conn); | 564 FlapFrame *flap_frame_new(OscarData *od, guint16 channel, int datalen); |
649 faim_export int aim_conn_isconnecting(OscarConnection *conn); | 565 |
650 | 566 |
651 OscarSession *oscar_session_new(void); | 567 OscarData *oscar_data_new(void); |
652 void oscar_session_destroy(OscarSession *); | 568 void oscar_data_destroy(OscarData *); |
653 | |
654 faim_export OscarConnection *aim_getconn_type(OscarSession *, int type); | |
655 faim_export OscarConnection *aim_getconn_type_all(OscarSession *, int type); | |
656 | 569 |
657 /* 0x0001 - family_oservice.c */ | 570 /* 0x0001 - family_oservice.c */ |
658 faim_export int aim_srv_setstatusmsg(OscarSession *sess, const char *msg); | 571 int aim_srv_setstatusmsg(OscarData *od, const char *msg); |
659 faim_export int aim_srv_setidle(OscarSession *sess, guint32 idletime); | 572 int aim_srv_setidle(OscarData *od, guint32 idletime); |
660 | 573 |
661 /* misc.c */ | 574 /* misc.c */ |
662 | 575 |
663 #define AIM_VISIBILITYCHANGE_PERMITADD 0x05 | 576 #define AIM_VISIBILITYCHANGE_PERMITADD 0x05 |
664 #define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06 | 577 #define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06 |
668 #define AIM_PRIVFLAGS_ALLOWIDLE 0x01 | 581 #define AIM_PRIVFLAGS_ALLOWIDLE 0x01 |
669 #define AIM_PRIVFLAGS_ALLOWMEMBERSINCE 0x02 | 582 #define AIM_PRIVFLAGS_ALLOWMEMBERSINCE 0x02 |
670 | 583 |
671 #define AIM_WARN_ANON 0x01 | 584 #define AIM_WARN_ANON 0x01 |
672 | 585 |
673 faim_export int aim_sendpauseack(OscarSession *sess, OscarConnection *conn); | 586 int aim_sendpauseack(OscarData *od, FlapConnection *conn); |
674 faim_export int aim_nop(OscarSession *, OscarConnection *); | 587 int aim_nop(OscarData *, FlapConnection *); |
675 faim_export int aim_flap_nop(OscarSession *sess, OscarConnection *conn); | 588 int aim_bos_changevisibility(OscarData *, FlapConnection *, int, const char *); |
676 faim_export int aim_bos_changevisibility(OscarSession *, OscarConnection *, int, const char *); | 589 int aim_bos_setgroupperm(OscarData *, FlapConnection *, guint32 mask); |
677 faim_export int aim_bos_setgroupperm(OscarSession *, OscarConnection *, guint32 mask); | 590 int aim_bos_setprivacyflags(OscarData *, FlapConnection *, guint32); |
678 faim_export int aim_bos_setprivacyflags(OscarSession *, OscarConnection *, guint32); | 591 int aim_reqpersonalinfo(OscarData *, FlapConnection *); |
679 faim_export int aim_reqpersonalinfo(OscarSession *, OscarConnection *); | 592 int aim_reqservice(OscarData *, guint16); |
680 faim_export int aim_reqservice(OscarSession *, OscarConnection *, guint16); | 593 int aim_bos_reqrights(OscarData *, FlapConnection *); |
681 faim_export int aim_bos_reqrights(OscarSession *, OscarConnection *); | 594 int aim_setextstatus(OscarData *od, guint32 status); |
682 faim_export int aim_setextstatus(OscarSession *sess, guint32 status); | |
683 | 595 |
684 #define AIM_CLIENTTYPE_UNKNOWN 0x0000 | 596 #define AIM_CLIENTTYPE_UNKNOWN 0x0000 |
685 #define AIM_CLIENTTYPE_MC 0x0001 | 597 #define AIM_CLIENTTYPE_MC 0x0001 |
686 #define AIM_CLIENTTYPE_WINAIM 0x0002 | 598 #define AIM_CLIENTTYPE_WINAIM 0x0002 |
687 #define AIM_CLIENTTYPE_WINAIM41 0x0003 | 599 #define AIM_CLIENTTYPE_WINAIM41 0x0003 |
688 #define AIM_CLIENTTYPE_AOL_TOC 0x0004 | 600 #define AIM_CLIENTTYPE_AOL_TOC 0x0004 |
689 faim_export guint16 aim_im_fingerprint(const guint8 *msghdr, int len); | 601 guint16 aim_im_fingerprint(const guint8 *msghdr, int len); |
690 | 602 |
691 #define AIM_RATE_CODE_CHANGE 0x0001 | 603 #define AIM_RATE_CODE_CHANGE 0x0001 |
692 #define AIM_RATE_CODE_WARNING 0x0002 | 604 #define AIM_RATE_CODE_WARNING 0x0002 |
693 #define AIM_RATE_CODE_LIMIT 0x0003 | 605 #define AIM_RATE_CODE_LIMIT 0x0003 |
694 #define AIM_RATE_CODE_CLEARLIMIT 0x0004 | 606 #define AIM_RATE_CODE_CLEARLIMIT 0x0004 |
695 faim_export int aim_ads_requestads(OscarSession *sess, OscarConnection *conn); | 607 int aim_ads_requestads(OscarData *od, FlapConnection *conn); |
696 | 608 |
697 | 609 |
698 | 610 |
699 /* family_icbm.c */ | 611 /* family_icbm.c */ |
700 #define AIM_OFT_SUBTYPE_SEND_FILE 0x0001 | 612 #define AIM_OFT_SUBTYPE_SEND_FILE 0x0001 |
776 { | 688 { |
777 unsigned int numparts; | 689 unsigned int numparts; |
778 aim_mpmsg_section_t *parts; | 690 aim_mpmsg_section_t *parts; |
779 } aim_mpmsg_t; | 691 } aim_mpmsg_t; |
780 | 692 |
781 faim_export int aim_mpmsg_init(OscarSession *sess, aim_mpmsg_t *mpm); | 693 int aim_mpmsg_init(OscarData *od, aim_mpmsg_t *mpm); |
782 faim_export int aim_mpmsg_addraw(OscarSession *sess, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const gchar *data, guint16 datalen); | 694 int aim_mpmsg_addraw(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const gchar *data, guint16 datalen); |
783 faim_export int aim_mpmsg_addascii(OscarSession *sess, aim_mpmsg_t *mpm, const char *ascii); | 695 int aim_mpmsg_addascii(OscarData *od, aim_mpmsg_t *mpm, const char *ascii); |
784 faim_export int aim_mpmsg_addunicode(OscarSession *sess, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen); | 696 int aim_mpmsg_addunicode(OscarData *od, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen); |
785 faim_export void aim_mpmsg_free(OscarSession *sess, aim_mpmsg_t *mpm); | 697 void aim_mpmsg_free(OscarData *od, aim_mpmsg_t *mpm); |
786 | 698 |
787 /* | 699 /* |
788 * Arguments to aim_send_im_ext(). | 700 * Arguments to aim_send_im_ext(). |
789 * | 701 * |
790 * This is really complicated. But immensely versatile. | 702 * This is really complicated. But immensely versatile. |
870 guint16 charset; | 782 guint16 charset; |
871 guint16 charsubset; | 783 guint16 charsubset; |
872 }; | 784 }; |
873 | 785 |
874 /* Valid values for channel 2 args->status */ | 786 /* Valid values for channel 2 args->status */ |
875 #define AIM_RENDEZVOUS_PROPOSE 0x0000 | 787 #define AIM_RENDEZVOUS_PROPOSE 0x0000 |
876 #define AIM_RENDEZVOUS_CANCEL 0x0001 | 788 #define AIM_RENDEZVOUS_CANCEL 0x0001 |
877 #define AIM_RENDEZVOUS_ACCEPT 0x0002 | 789 #define AIM_RENDEZVOUS_CONNECTED 0x0002 |
878 | 790 |
879 struct aim_incomingim_ch2_args | 791 struct _IcbmArgsCh2 |
880 { | 792 { |
881 guint16 status; | 793 guint16 status; |
882 guchar cookie[8]; | 794 guchar cookie[8]; |
883 int reqclass; | 795 int type; /* One of the OSCAR_CAPABILITY_ constants */ |
884 const char *proxyip; | 796 const char *proxyip; |
885 const char *clientip; | 797 const char *clientip; |
886 const char *verifiedip; | 798 const char *verifiedip; |
887 guint16 port; | 799 guint16 port; |
800 gboolean use_proxy; | |
888 guint16 errorcode; | 801 guint16 errorcode; |
889 const char *msg; /* invite message or file description */ | 802 const char *msg; /* invite message or file description */ |
890 guint16 msglen; | 803 guint16 msglen; |
891 const char *encoding; | 804 const char *encoding; |
892 const char *language; | 805 const char *language; |
806 guint16 requestnumber; | |
893 union { | 807 union { |
894 struct { | 808 struct { |
895 guint32 checksum; | 809 guint32 checksum; |
896 guint32 length; | 810 guint32 length; |
897 time_t timestamp; | 811 time_t timestamp; |
909 struct { | 823 struct { |
910 guint16 subtype; | 824 guint16 subtype; |
911 guint16 totfiles; | 825 guint16 totfiles; |
912 guint32 totsize; | 826 guint32 totsize; |
913 char *filename; | 827 char *filename; |
914 /* reqnum: 0x0001 usually; 0x0002 = reply request for stage 2 proxy transfer */ | |
915 guint16 reqnum; | |
916 guint8 use_proxy; /* Did the user request that we use a rv proxy? */ | |
917 } sendfile; | 828 } sendfile; |
918 } info; | 829 } info; |
919 void *destructor; /* used internally only */ | 830 void *destructor; /* used internally only */ |
920 }; | 831 }; |
921 | 832 |
932 gchar *msg; /* Reason for auth request, deny, or accept */ | 843 gchar *msg; /* Reason for auth request, deny, or accept */ |
933 int msglen; | 844 int msglen; |
934 }; | 845 }; |
935 | 846 |
936 /* SNAC sending functions */ | 847 /* SNAC sending functions */ |
937 /* 0x0002 */ faim_export int aim_im_setparams(OscarSession *sess, struct aim_icbmparameters *params); | 848 /* 0x0002 */ int aim_im_setparams(OscarData *od, struct aim_icbmparameters *params); |
938 /* 0x0004 */ faim_export int aim_im_reqparams(OscarSession *sess); | 849 /* 0x0004 */ int aim_im_reqparams(OscarData *od); |
939 /* 0x0006 */ faim_export int aim_im_sendch1_ext(OscarSession *sess, struct aim_sendimext_args *args); | 850 /* 0x0006 */ int aim_im_sendch1_ext(OscarData *od, struct aim_sendimext_args *args); |
940 /* 0x0006 */ faim_export int aim_im_sendch1(OscarSession *, const char *destsn, guint16 flags, const char *msg); | 851 /* 0x0006 */ int aim_im_sendch1(OscarData *, const char *destsn, guint16 flags, const char *msg); |
941 /* 0x0006 */ faim_export int aim_im_sendch2_chatinvite(OscarSession *sess, const char *sn, const char *msg, guint16 exchange, const char *roomname, guint16 instance); | 852 /* 0x0006 */ int aim_im_sendch2_chatinvite(OscarData *od, const char *sn, const char *msg, guint16 exchange, const char *roomname, guint16 instance); |
942 /* 0x0006 */ faim_export int aim_im_sendch2_icon(OscarSession *sess, const char *sn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum); | 853 /* 0x0006 */ int aim_im_sendch2_icon(OscarData *od, const char *sn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum); |
943 /* 0x0006 */ faim_export int aim_im_sendch2_rtfmsg(OscarSession *sess, struct aim_sendrtfmsg_args *args); | 854 /* 0x0006 */ int aim_im_sendch2_rtfmsg(OscarData *od, struct aim_sendrtfmsg_args *args); |
944 /* 0x0006 */ faim_export int aim_im_sendch2_odcrequest(OscarSession *sess, guchar *cookie, gboolean usecookie, const char *sn, const guint8 *ip, guint16 port); | 855 |
945 /* 0x0006 */ faim_export int aim_im_sendch2_sendfile_ask(OscarSession *sess, PeerConnection *peer_connection); | 856 /* 0x0006 */ void aim_im_sendch2_cancel(PeerConnection *peer_conn); |
946 /* 0x0006 */ faim_export int aim_im_sendch2_sendfile_accept(OscarSession *sess, PeerConnection *info); | 857 /* 0x0006 */ void aim_im_sendch2_connected(PeerConnection *peer_conn); |
947 /* 0x0006 */ faim_export int aim_im_sendch2_sendfile_cancel(OscarSession *sess, PeerConnection *peer_connection); | 858 /* 0x0006 */ void aim_im_sendch2_odc_requestdirect(OscarData *od, guchar *cookie, const char *sn, const guint8 *ip, guint16 port, guint16 requestnumber); |
948 /* 0x0006 */ faim_export int aim_im_sendch2_geticqaway(OscarSession *sess, const char *sn, int type); | 859 /* 0x0006 */ void aim_im_sendch2_odc_requestproxy(OscarData *od, guchar *cookie, const char *sn, const guint8 *ip, guint16 pin, guint16 requestnumber); |
949 /* 0x0006 */ faim_export int aim_im_sendch4(OscarSession *sess, const char *sn, guint16 type, const char *message); | 860 /* 0x0006 */ void aim_im_sendch2_sendfile_requestdirect(OscarData *od, guchar *cookie, const char *sn, const guint8 *ip, guint16 port, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles); |
950 /* 0x0008 */ faim_export int aim_im_warn(OscarSession *sess, OscarConnection *conn, const char *destsn, guint32 flags); | 861 /* 0x0006 */ void aim_im_sendch2_sendfile_requestproxy(OscarData *od, guchar *cookie, const char *sn, const guint8 *ip, guint16 pin, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles); |
951 /* 0x000b */ faim_export int aim_im_denytransfer(OscarSession *sess, const char *sender, const guchar *cookie, guint16 code); | 862 |
952 /* 0x0014 */ faim_export int aim_im_sendmtn(OscarSession *sess, guint16 type1, const char *sn, guint16 type2); | 863 /* 0x0006 */ int aim_im_sendch2_geticqaway(OscarData *od, const char *sn, int type); |
953 faim_export void aim_icbm_makecookie(guchar* cookie); | 864 /* 0x0006 */ int aim_im_sendch4(OscarData *od, const char *sn, guint16 type, const char *message); |
865 /* 0x0008 */ int aim_im_warn(OscarData *od, FlapConnection *conn, const char *destsn, guint32 flags); | |
866 /* 0x000b */ int aim_im_denytransfer(OscarData *od, const char *sn, const guchar *cookie, guint16 code); | |
867 /* 0x0014 */ int aim_im_sendmtn(OscarData *od, guint16 type1, const char *sn, guint16 type2); | |
868 void aim_icbm_makecookie(guchar* cookie); | |
869 gchar *oscar_encoding_to_utf8(const char *encoding, const char *text, int textlen); | |
870 gchar *gaim_plugin_oscar_decode_im_part(GaimAccount *account, const char *sourcesn, guint16 charset, guint16 charsubset, const gchar *data, gsize datalen); | |
954 | 871 |
955 | 872 |
956 /* 0x0002 - family_locate.c */ | 873 /* 0x0002 - family_locate.c */ |
957 /* | 874 /* |
958 * AIM User Info, Standard Form. | 875 * AIM User Info, Standard Form. |
959 */ | 876 */ |
960 #define AIM_FLAG_UNCONFIRMED 0x0001 /* "damned transients" */ | 877 #define AIM_FLAG_UNCONFIRMED 0x0001 /* "damned transients" */ |
961 #define AIM_FLAG_ADMINISTRATOR 0x0002 | 878 #define AIM_FLAG_ADMINISTRATOR 0x0002 |
962 #define AIM_FLAG_AOL 0x0004 | 879 #define AIM_FLAG_AOL 0x0004 |
963 #define AIM_FLAG_OSCAR_PAY 0x0008 | 880 #define AIM_FLAG_OSCAR_PAY 0x0008 |
964 #define AIM_FLAG_FREE 0x0010 | 881 #define AIM_FLAG_FREE 0x0010 |
965 #define AIM_FLAG_AWAY 0x0020 | 882 #define AIM_FLAG_AWAY 0x0020 |
966 #define AIM_FLAG_ICQ 0x0040 | 883 #define AIM_FLAG_ICQ 0x0040 |
967 #define AIM_FLAG_WIRELESS 0x0080 | 884 #define AIM_FLAG_WIRELESS 0x0080 |
968 #define AIM_FLAG_UNKNOWN100 0x0100 | 885 #define AIM_FLAG_UNKNOWN100 0x0100 |
969 #define AIM_FLAG_UNKNOWN200 0x0200 | 886 #define AIM_FLAG_UNKNOWN200 0x0200 |
970 #define AIM_FLAG_ACTIVEBUDDY 0x0400 | 887 #define AIM_FLAG_ACTIVEBUDDY 0x0400 |
971 #define AIM_FLAG_UNKNOWN800 0x0800 | 888 #define AIM_FLAG_UNKNOWN800 0x0800 |
972 #define AIM_FLAG_ABINTERNAL 0x1000 | 889 #define AIM_FLAG_ABINTERNAL 0x1000 |
973 #define AIM_FLAG_ALLUSERS 0x001f | 890 #define AIM_FLAG_ALLUSERS 0x001f |
974 | 891 |
975 #define AIM_USERINFO_PRESENT_FLAGS 0x00000001 | 892 #define AIM_USERINFO_PRESENT_FLAGS 0x00000001 |
976 #define AIM_USERINFO_PRESENT_MEMBERSINCE 0x00000002 | 893 #define AIM_USERINFO_PRESENT_MEMBERSINCE 0x00000002 |
977 #define AIM_USERINFO_PRESENT_ONLINESINCE 0x00000004 | 894 #define AIM_USERINFO_PRESENT_ONLINESINCE 0x00000004 |
978 #define AIM_USERINFO_PRESENT_IDLE 0x00000008 | 895 #define AIM_USERINFO_PRESENT_IDLE 0x00000008 |
1024 guint16 away_len; | 941 guint16 away_len; |
1025 | 942 |
1026 struct aim_userinfo_s *next; | 943 struct aim_userinfo_s *next; |
1027 } aim_userinfo_t; | 944 } aim_userinfo_t; |
1028 | 945 |
1029 #define AIM_CAPS_BUDDYICON 0x00000001 | |
1030 #define AIM_CAPS_TALK 0x00000002 | |
1031 #define AIM_CAPS_DIRECTIM 0x00000004 | |
1032 #define AIM_CAPS_CHAT 0x00000008 | |
1033 #define AIM_CAPS_GETFILE 0x00000010 | |
1034 #define AIM_CAPS_SENDFILE 0x00000020 | |
1035 #define AIM_CAPS_GAMES 0x00000040 | |
1036 #define AIM_CAPS_ADDINS 0x00000080 | |
1037 #define AIM_CAPS_SENDBUDDYLIST 0x00000100 | |
1038 #define AIM_CAPS_GAMES2 0x00000200 | |
1039 #define AIM_CAPS_ICQ_DIRECT 0x00000400 | |
1040 #define AIM_CAPS_APINFO 0x00000800 | |
1041 #define AIM_CAPS_ICQRTF 0x00001000 | |
1042 #define AIM_CAPS_EMPTY 0x00002000 | |
1043 #define AIM_CAPS_ICQSERVERRELAY 0x00004000 | |
1044 #define AIM_CAPS_ICQUTF8OLD 0x00008000 | |
1045 #define AIM_CAPS_TRILLIANCRYPT 0x00010000 | |
1046 #define AIM_CAPS_ICQUTF8 0x00020000 | |
1047 #define AIM_CAPS_INTEROPERATE 0x00040000 | |
1048 #define AIM_CAPS_ICHAT 0x00080000 | |
1049 #define AIM_CAPS_HIPTOP 0x00100000 | |
1050 #define AIM_CAPS_SECUREIM 0x00200000 | |
1051 #define AIM_CAPS_SMS 0x00400000 | |
1052 #define AIM_CAPS_GENERICUNKNOWN 0x00800000 | |
1053 #define AIM_CAPS_VIDEO 0x01000000 | |
1054 #define AIM_CAPS_ICHATAV 0x02000000 | |
1055 #define AIM_CAPS_LIVEVIDEO 0x04000000 | |
1056 #define AIM_CAPS_CAMERA 0x08000000 | |
1057 #define AIM_CAPS_LAST 0x10000000 | |
1058 | |
1059 #define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0 | 946 #define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0 |
1060 #define AIM_SENDMEMBLOCK_FLAG_ISHASH 1 | 947 #define AIM_SENDMEMBLOCK_FLAG_ISHASH 1 |
1061 | 948 |
1062 faim_export int aim_sendmemblock(OscarSession *sess, OscarConnection *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag); | 949 int aim_sendmemblock(OscarData *od, FlapConnection *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag); |
1063 | 950 |
1064 struct aim_invite_priv | 951 struct aim_invite_priv |
1065 { | 952 { |
1066 char *sn; | 953 char *sn; |
1067 char *roomname; | 954 char *roomname; |
1084 #define AIM_COOKIETYPE_OFTSEND 0x12 | 971 #define AIM_COOKIETYPE_OFTSEND 0x12 |
1085 #define AIM_COOKIETYPE_OFTVOICE 0x13 | 972 #define AIM_COOKIETYPE_OFTVOICE 0x13 |
1086 #define AIM_COOKIETYPE_OFTIMAGE 0x14 | 973 #define AIM_COOKIETYPE_OFTIMAGE 0x14 |
1087 #define AIM_COOKIETYPE_OFTICON 0x15 | 974 #define AIM_COOKIETYPE_OFTICON 0x15 |
1088 | 975 |
1089 faim_export aim_userinfo_t *aim_locate_finduserinfo(OscarSession *sess, const char *sn); | 976 aim_userinfo_t *aim_locate_finduserinfo(OscarData *od, const char *sn); |
1090 faim_export void aim_locate_dorequest(OscarSession *sess); | 977 void aim_locate_dorequest(OscarData *od); |
1091 | 978 |
1092 /* 0x0002 */ faim_export int aim_locate_reqrights(OscarSession *sess); | 979 /* 0x0002 */ int aim_locate_reqrights(OscarData *od); |
1093 /* 0x0004 */ faim_export int aim_locate_setcaps(OscarSession *sess, guint32 caps); | 980 /* 0x0004 */ int aim_locate_setcaps(OscarData *od, guint32 caps); |
1094 /* 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); | 981 /* 0x0004 */ int aim_locate_setprofile(OscarData *od, const char *profile_encoding, const gchar *profile, const int profile_len, const char *awaymsg_encoding, const gchar *awaymsg, const int awaymsg_len); |
1095 /* 0x0005 */ faim_export int aim_locate_getinfo(OscarSession *sess, const char *, guint16); | 982 /* 0x0005 */ int aim_locate_getinfo(OscarData *od, const char *, guint16); |
1096 /* 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); | 983 /* 0x0009 */ int aim_locate_setdirinfo(OscarData *od, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, guint16 privacy); |
1097 /* 0x000b */ faim_export int aim_locate_000b(OscarSession *sess, const char *sn); | 984 /* 0x000b */ int aim_locate_000b(OscarData *od, const char *sn); |
1098 /* 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); | 985 /* 0x000f */ int aim_locate_setinterests(OscarData *od, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, guint16 privacy); |
1099 /* 0x0015 */ faim_export int aim_locate_getinfoshort(OscarSession *sess, const char *sn, guint32 flags); | 986 /* 0x0015 */ int aim_locate_getinfoshort(OscarData *od, const char *sn, guint32 flags); |
987 | |
988 void aim_locate_requestuserinfo(OscarData *od, const char *sn); | |
989 guint32 aim_locate_getcaps(OscarData *od, ByteStream *bs, int len); | |
990 guint32 aim_locate_getcaps_short(OscarData *od, ByteStream *bs, int len); | |
991 void aim_info_free(aim_userinfo_t *); | |
992 int aim_info_extract(OscarData *od, ByteStream *bs, aim_userinfo_t *); | |
993 int aim_putuserinfo(ByteStream *bs, aim_userinfo_t *info); | |
1100 | 994 |
1101 | 995 |
1102 | 996 |
1103 /* 0x0003 - family_buddy.c */ | 997 /* 0x0003 - family_buddy.c */ |
1104 /* 0x0002 */ faim_export int aim_buddylist_reqrights(OscarSession *, OscarConnection *); | 998 /* 0x0002 */ int aim_buddylist_reqrights(OscarData *, FlapConnection *); |
1105 /* 0x0004 */ faim_export int aim_buddylist_set(OscarSession *, OscarConnection *, const char *); | 999 /* 0x0004 */ int aim_buddylist_set(OscarData *, FlapConnection *, const char *); |
1106 /* 0x0004 */ faim_export int aim_buddylist_addbuddy(OscarSession *, OscarConnection *, const char *); | 1000 /* 0x0004 */ int aim_buddylist_addbuddy(OscarData *, FlapConnection *, const char *); |
1107 /* 0x0005 */ faim_export int aim_buddylist_removebuddy(OscarSession *, OscarConnection *, const char *); | 1001 /* 0x0005 */ int aim_buddylist_removebuddy(OscarData *, FlapConnection *, const char *); |
1108 /* 0x000b */ faim_export int aim_buddylist_oncoming(OscarSession *sess, OscarConnection *conn, aim_userinfo_t *info); | |
1109 /* 0x000c */ faim_export int aim_buddylist_offgoing(OscarSession *sess, OscarConnection *conn, const char *sn); | |
1110 | 1002 |
1111 | 1003 |
1112 | 1004 |
1113 /* 0x000a - family_userlookup.c */ | 1005 /* 0x000a - family_userlookup.c */ |
1114 faim_export int aim_search_address(OscarSession *, OscarConnection *, const char *); | 1006 int aim_search_address(OscarData *, const char *); |
1115 | 1007 |
1116 | 1008 |
1117 | 1009 |
1118 /* 0x000d - family_chatnav.c */ | 1010 /* 0x000d - family_chatnav.c */ |
1119 /* 0x000e - family_chat.c */ | 1011 /* 0x000e - family_chat.c */ |
1134 char *lang2; | 1026 char *lang2; |
1135 }; | 1027 }; |
1136 | 1028 |
1137 #define AIM_CHATFLAGS_NOREFLECT 0x0001 | 1029 #define AIM_CHATFLAGS_NOREFLECT 0x0001 |
1138 #define AIM_CHATFLAGS_AWAY 0x0002 | 1030 #define AIM_CHATFLAGS_AWAY 0x0002 |
1139 faim_export int aim_chat_send_im(OscarSession *sess, OscarConnection *conn, guint16 flags, const gchar *msg, int msglen, const char *encoding, const char *language); | 1031 int aim_chat_send_im(OscarData *od, FlapConnection *conn, guint16 flags, const gchar *msg, int msglen, const char *encoding, const char *language); |
1140 faim_export int aim_chat_join(OscarSession *sess, OscarConnection *conn, guint16 exchange, const char *roomname, guint16 instance); | 1032 int aim_chat_join(OscarData *od, guint16 exchange, const char *roomname, guint16 instance); |
1141 faim_export int aim_chat_attachname(OscarConnection *conn, guint16 exchange, const char *roomname, guint16 instance); | 1033 int aim_chat_attachname(FlapConnection *conn, guint16 exchange, const char *roomname, guint16 instance); |
1142 faim_export char *aim_chat_getname(OscarConnection *conn); | 1034 char *aim_chat_getname(FlapConnection *conn); |
1143 faim_export OscarConnection *aim_chat_getconn(OscarSession *, const char *name); | 1035 FlapConnection *aim_chat_getconn(OscarData *, const char *name); |
1144 | 1036 |
1145 faim_export int aim_chatnav_reqrights(OscarSession *sess, OscarConnection *conn); | 1037 int aim_chatnav_reqrights(OscarData *od, FlapConnection *conn); |
1146 | 1038 |
1147 faim_export int aim_chatnav_createroom(OscarSession *sess, OscarConnection *conn, const char *name, guint16 exchange); | 1039 int aim_chatnav_createroom(OscarData *od, FlapConnection *conn, const char *name, guint16 exchange); |
1148 faim_export int aim_chat_leaveroom(OscarSession *sess, const char *name); | 1040 int aim_chat_leaveroom(OscarData *od, const char *name); |
1149 | 1041 |
1150 | 1042 |
1151 | 1043 |
1152 /* 0x000f - family_odir.c */ | 1044 /* 0x000f - family_odir.c */ |
1153 struct aim_odir | 1045 struct aim_odir |
1167 char *region; | 1059 char *region; |
1168 char *address; | 1060 char *address; |
1169 struct aim_odir *next; | 1061 struct aim_odir *next; |
1170 }; | 1062 }; |
1171 | 1063 |
1172 faim_export int aim_odir_email(OscarSession *, const char *, const char *); | 1064 int aim_odir_email(OscarData *, const char *, const char *); |
1173 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 *); | 1065 int aim_odir_name(OscarData *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *); |
1174 faim_export int aim_odir_interest(OscarSession *, const char *, const char *); | 1066 int aim_odir_interest(OscarData *, const char *, const char *); |
1175 | 1067 |
1176 | 1068 |
1177 | 1069 |
1178 /* 0x0010 - family_bart.c */ | 1070 /* 0x0010 - family_bart.c */ |
1179 faim_export int aim_bart_upload(OscarSession *sess, const guint8 *icon, guint16 iconlen); | 1071 int aim_bart_upload(OscarData *od, const guint8 *icon, guint16 iconlen); |
1180 faim_export int aim_bart_request(OscarSession *sess, const char *sn, guint8 iconcsumtype, const guint8 *iconstr, guint16 iconstrlen); | 1072 int aim_bart_request(OscarData *od, const char *sn, guint8 iconcsumtype, const guint8 *iconstr, guint16 iconstrlen); |
1181 | 1073 |
1182 | 1074 |
1183 | 1075 |
1184 /* 0x0013 - family_feedbag.c */ | 1076 /* 0x0013 - family_feedbag.c */ |
1185 #define AIM_SSI_TYPE_BUDDY 0x0000 | 1077 #define AIM_SSI_TYPE_BUDDY 0x0000 |
1219 struct aim_ssi_item *item; | 1111 struct aim_ssi_item *item; |
1220 struct aim_ssi_tmp *next; | 1112 struct aim_ssi_tmp *next; |
1221 }; | 1113 }; |
1222 | 1114 |
1223 /* These build the actual SNACs and queue them to be sent */ | 1115 /* These build the actual SNACs and queue them to be sent */ |
1224 /* 0x0002 */ faim_export int aim_ssi_reqrights(OscarSession *sess); | 1116 /* 0x0002 */ int aim_ssi_reqrights(OscarData *od); |
1225 /* 0x0004 */ faim_export int aim_ssi_reqdata(OscarSession *sess); | 1117 /* 0x0004 */ int aim_ssi_reqdata(OscarData *od); |
1226 /* 0x0005 */ faim_export int aim_ssi_reqifchanged(OscarSession *sess, time_t localstamp, guint16 localrev); | 1118 /* 0x0005 */ int aim_ssi_reqifchanged(OscarData *od, time_t localstamp, guint16 localrev); |
1227 /* 0x0007 */ faim_export int aim_ssi_enable(OscarSession *sess); | 1119 /* 0x0007 */ int aim_ssi_enable(OscarData *od); |
1228 /* 0x0008 */ faim_export int aim_ssi_addmoddel(OscarSession *sess); | 1120 /* 0x0008 */ int aim_ssi_addmoddel(OscarData *od); |
1229 /* 0x0011 */ faim_export int aim_ssi_modbegin(OscarSession *sess); | 1121 /* 0x0011 */ int aim_ssi_modbegin(OscarData *od); |
1230 /* 0x0012 */ faim_export int aim_ssi_modend(OscarSession *sess); | 1122 /* 0x0012 */ int aim_ssi_modend(OscarData *od); |
1231 /* 0x0014 */ faim_export int aim_ssi_sendauth(OscarSession *sess, char *sn, char *msg); | 1123 /* 0x0014 */ int aim_ssi_sendauth(OscarData *od, char *sn, char *msg); |
1232 /* 0x0018 */ faim_export int aim_ssi_sendauthrequest(OscarSession *sess, char *sn, const char *msg); | 1124 /* 0x0018 */ int aim_ssi_sendauthrequest(OscarData *od, char *sn, const char *msg); |
1233 /* 0x001a */ faim_export int aim_ssi_sendauthreply(OscarSession *sess, char *sn, guint8 reply, const char *msg); | 1125 /* 0x001a */ int aim_ssi_sendauthreply(OscarData *od, char *sn, guint8 reply, const char *msg); |
1234 | 1126 |
1235 /* Client functions for retrieving SSI data */ | 1127 /* Client functions for retrieving SSI data */ |
1236 faim_export struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gid, guint16 bid); | 1128 struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gid, guint16 bid); |
1237 faim_export struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *sn, guint16 type); | 1129 struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *sn, guint16 type); |
1238 faim_export struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *sn); | 1130 struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *sn); |
1239 faim_export char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *sn); | 1131 char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *sn); |
1240 faim_export int aim_ssi_getpermdeny(struct aim_ssi_item *list); | 1132 int aim_ssi_getpermdeny(struct aim_ssi_item *list); |
1241 faim_export guint32 aim_ssi_getpresence(struct aim_ssi_item *list); | 1133 guint32 aim_ssi_getpresence(struct aim_ssi_item *list); |
1242 faim_export char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *sn); | 1134 char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *sn); |
1243 faim_export char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *sn); | 1135 char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *sn); |
1244 faim_export int aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *sn); | 1136 int aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *sn); |
1245 | 1137 |
1246 /* Client functions for changing SSI data */ | 1138 /* Client functions for changing SSI data */ |
1247 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); | 1139 int aim_ssi_addbuddy(OscarData *od, const char *name, const char *group, const char *alias, const char *comment, const char *smsnum, int needauth); |
1248 faim_export int aim_ssi_addpermit(OscarSession *sess, const char *name); | 1140 int aim_ssi_addpermit(OscarData *od, const char *name); |
1249 faim_export int aim_ssi_adddeny(OscarSession *sess, const char *name); | 1141 int aim_ssi_adddeny(OscarData *od, const char *name); |
1250 faim_export int aim_ssi_delbuddy(OscarSession *sess, const char *name, const char *group); | 1142 int aim_ssi_delbuddy(OscarData *od, const char *name, const char *group); |
1251 faim_export int aim_ssi_delpermit(OscarSession *sess, const char *name); | 1143 int aim_ssi_delpermit(OscarData *od, const char *name); |
1252 faim_export int aim_ssi_deldeny(OscarSession *sess, const char *name); | 1144 int aim_ssi_deldeny(OscarData *od, const char *name); |
1253 faim_export int aim_ssi_movebuddy(OscarSession *sess, const char *oldgn, const char *newgn, const char *sn); | 1145 int aim_ssi_movebuddy(OscarData *od, const char *oldgn, const char *newgn, const char *sn); |
1254 faim_export int aim_ssi_aliasbuddy(OscarSession *sess, const char *gn, const char *sn, const char *alias); | 1146 int aim_ssi_aliasbuddy(OscarData *od, const char *gn, const char *sn, const char *alias); |
1255 faim_export int aim_ssi_editcomment(OscarSession *sess, const char *gn, const char *sn, const char *alias); | 1147 int aim_ssi_editcomment(OscarData *od, const char *gn, const char *sn, const char *alias); |
1256 faim_export int aim_ssi_rename_group(OscarSession *sess, const char *oldgn, const char *newgn); | 1148 int aim_ssi_rename_group(OscarData *od, const char *oldgn, const char *newgn); |
1257 faim_export int aim_ssi_cleanlist(OscarSession *sess); | 1149 int aim_ssi_cleanlist(OscarData *od); |
1258 faim_export int aim_ssi_deletelist(OscarSession *sess); | 1150 int aim_ssi_deletelist(OscarData *od); |
1259 faim_export int aim_ssi_setpermdeny(OscarSession *sess, guint8 permdeny, guint32 vismask); | 1151 int aim_ssi_setpermdeny(OscarData *od, guint8 permdeny, guint32 vismask); |
1260 faim_export int aim_ssi_setpresence(OscarSession *sess, guint32 presence); | 1152 int aim_ssi_setpresence(OscarData *od, guint32 presence); |
1261 faim_export int aim_ssi_seticon(OscarSession *sess, guint8 *iconsum, guint16 iconsumlen); | 1153 int aim_ssi_seticon(OscarData *od, guint8 *iconsum, guint16 iconsumlen); |
1262 faim_export int aim_ssi_delicon(OscarSession *sess); | 1154 int aim_ssi_delicon(OscarData *od); |
1263 | 1155 |
1264 | 1156 |
1265 | 1157 |
1266 /* 0x0015 - family_icq.c */ | 1158 /* 0x0015 - family_icq.c */ |
1267 #define AIM_ICQ_INFO_SIMPLE 0x001 | 1159 #define AIM_ICQ_INFO_SIMPLE 0x001 |
1343 | 1235 |
1344 /* we keep track of these in a linked list because we're 1337 */ | 1236 /* we keep track of these in a linked list because we're 1337 */ |
1345 struct aim_icq_info *next; | 1237 struct aim_icq_info *next; |
1346 }; | 1238 }; |
1347 | 1239 |
1348 faim_export int aim_icq_reqofflinemsgs(OscarSession *sess); | 1240 int aim_icq_reqofflinemsgs(OscarData *od); |
1349 faim_export int aim_icq_ackofflinemsgs(OscarSession *sess); | 1241 int aim_icq_ackofflinemsgs(OscarData *od); |
1350 faim_export int aim_icq_setsecurity(OscarSession *sess, gboolean auth_required, gboolean webaware); | 1242 int aim_icq_setsecurity(OscarData *od, gboolean auth_required, gboolean webaware); |
1351 faim_export int aim_icq_changepasswd(OscarSession *sess, const char *passwd); | 1243 int aim_icq_changepasswd(OscarData *od, const char *passwd); |
1352 faim_export int aim_icq_getsimpleinfo(OscarSession *sess, const char *uin); | 1244 int aim_icq_getsimpleinfo(OscarData *od, const char *uin); |
1353 faim_export int aim_icq_getalias(OscarSession *sess, const char *uin); | 1245 int aim_icq_getalias(OscarData *od, const char *uin); |
1354 faim_export int aim_icq_getallinfo(OscarSession *sess, const char *uin); | 1246 int aim_icq_getallinfo(OscarData *od, const char *uin); |
1355 | 1247 |
1356 | 1248 |
1357 | 1249 |
1358 /* 0x0017 - family_auth.c */ | 1250 /* 0x0017 - family_auth.c */ |
1359 faim_export int aim_sendcookie(OscarSession *, OscarConnection *, const guint16 length, const guint8 *); | 1251 void aim_sendcookie(OscarData *, FlapConnection *, const guint16 length, const guint8 *); |
1360 faim_export int aim_admin_changepasswd(OscarSession *, OscarConnection *, const char *newpw, const char *curpw); | 1252 int aim_admin_changepasswd(OscarData *, FlapConnection *, const char *newpw, const char *curpw); |
1361 faim_export int aim_admin_reqconfirm(OscarSession *sess, OscarConnection *conn); | 1253 int aim_admin_reqconfirm(OscarData *od, FlapConnection *conn); |
1362 faim_export int aim_admin_getinfo(OscarSession *sess, OscarConnection *conn, guint16 info); | 1254 int aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info); |
1363 faim_export int aim_admin_setemail(OscarSession *sess, OscarConnection *conn, const char *newemail); | 1255 int aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail); |
1364 faim_export int aim_admin_setnick(OscarSession *sess, OscarConnection *conn, const char *newnick); | 1256 int aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick); |
1365 | 1257 |
1366 | 1258 |
1367 | 1259 |
1368 /* 0x0018 - family_alert.c */ | 1260 /* 0x0018 - family_alert.c */ |
1369 struct aim_emailinfo | 1261 struct aim_emailinfo |
1376 char *domain; | 1268 char *domain; |
1377 guint16 flag; | 1269 guint16 flag; |
1378 struct aim_emailinfo *next; | 1270 struct aim_emailinfo *next; |
1379 }; | 1271 }; |
1380 | 1272 |
1381 faim_export int aim_email_sendcookies(OscarSession *sess); | 1273 int aim_email_sendcookies(OscarData *od); |
1382 faim_export int aim_email_activate(OscarSession *sess); | 1274 int aim_email_activate(OscarData *od); |
1383 | 1275 |
1384 | 1276 |
1385 | 1277 |
1386 /* tlv.c - TLV handling */ | 1278 /* tlv.c - TLV handling */ |
1387 | 1279 |
1399 aim_tlv_t *tlv; | 1291 aim_tlv_t *tlv; |
1400 struct aim_tlvlist_s *next; | 1292 struct aim_tlvlist_s *next; |
1401 } aim_tlvlist_t; | 1293 } aim_tlvlist_t; |
1402 | 1294 |
1403 /* TLV handling functions */ | 1295 /* TLV handling functions */ |
1404 faim_internal aim_tlv_t *aim_tlv_gettlv(aim_tlvlist_t *list, guint16 type, const int nth); | 1296 aim_tlv_t *aim_tlv_gettlv(aim_tlvlist_t *list, guint16 type, const int nth); |
1405 faim_internal int aim_tlv_getlength(aim_tlvlist_t *list, guint16 type, const int nth); | 1297 int aim_tlv_getlength(aim_tlvlist_t *list, guint16 type, const int nth); |
1406 faim_internal char *aim_tlv_getstr(aim_tlvlist_t *list, const guint16 type, const int nth); | 1298 char *aim_tlv_getstr(aim_tlvlist_t *list, const guint16 type, const int nth); |
1407 faim_internal guint8 aim_tlv_get8(aim_tlvlist_t *list, const guint16 type, const int nth); | 1299 guint8 aim_tlv_get8(aim_tlvlist_t *list, const guint16 type, const int nth); |
1408 faim_internal guint16 aim_tlv_get16(aim_tlvlist_t *list, const guint16 type, const int nth); | 1300 guint16 aim_tlv_get16(aim_tlvlist_t *list, const guint16 type, const int nth); |
1409 faim_internal guint32 aim_tlv_get32(aim_tlvlist_t *list, const guint16 type, const int nth); | 1301 guint32 aim_tlv_get32(aim_tlvlist_t *list, const guint16 type, const int nth); |
1410 | 1302 |
1411 /* TLV list handling functions */ | 1303 /* TLV list handling functions */ |
1412 faim_internal aim_tlvlist_t *aim_tlvlist_read(ByteStream *bs); | 1304 aim_tlvlist_t *aim_tlvlist_read(ByteStream *bs); |
1413 faim_internal aim_tlvlist_t *aim_tlvlist_readnum(ByteStream *bs, guint16 num); | 1305 aim_tlvlist_t *aim_tlvlist_readnum(ByteStream *bs, guint16 num); |
1414 faim_internal aim_tlvlist_t *aim_tlvlist_readlen(ByteStream *bs, guint16 len); | 1306 aim_tlvlist_t *aim_tlvlist_readlen(ByteStream *bs, guint16 len); |
1415 faim_internal aim_tlvlist_t *aim_tlvlist_copy(aim_tlvlist_t *orig); | 1307 aim_tlvlist_t *aim_tlvlist_copy(aim_tlvlist_t *orig); |
1416 | 1308 |
1417 faim_internal int aim_tlvlist_count(aim_tlvlist_t **list); | 1309 int aim_tlvlist_count(aim_tlvlist_t **list); |
1418 faim_internal int aim_tlvlist_size(aim_tlvlist_t **list); | 1310 int aim_tlvlist_size(aim_tlvlist_t **list); |
1419 faim_internal int aim_tlvlist_cmp(aim_tlvlist_t *one, aim_tlvlist_t *two); | 1311 int aim_tlvlist_cmp(aim_tlvlist_t *one, aim_tlvlist_t *two); |
1420 faim_internal int aim_tlvlist_write(ByteStream *bs, aim_tlvlist_t **list); | 1312 int aim_tlvlist_write(ByteStream *bs, aim_tlvlist_t **list); |
1421 faim_internal void aim_tlvlist_free(aim_tlvlist_t **list); | 1313 void aim_tlvlist_free(aim_tlvlist_t **list); |
1422 | 1314 |
1423 faim_internal int aim_tlvlist_add_raw(aim_tlvlist_t **list, const guint16 type, const guint16 length, const guint8 *value); | 1315 int aim_tlvlist_add_raw(aim_tlvlist_t **list, const guint16 type, const guint16 length, const guint8 *value); |
1424 faim_internal int aim_tlvlist_add_noval(aim_tlvlist_t **list, const guint16 type); | 1316 int aim_tlvlist_add_noval(aim_tlvlist_t **list, const guint16 type); |
1425 faim_internal int aim_tlvlist_add_8(aim_tlvlist_t **list, const guint16 type, const guint8 value); | 1317 int aim_tlvlist_add_8(aim_tlvlist_t **list, const guint16 type, const guint8 value); |
1426 faim_internal int aim_tlvlist_add_16(aim_tlvlist_t **list, const guint16 type, const guint16 value); | 1318 int aim_tlvlist_add_16(aim_tlvlist_t **list, const guint16 type, const guint16 value); |
1427 faim_internal int aim_tlvlist_add_32(aim_tlvlist_t **list, const guint16 type, const guint32 value); | 1319 int aim_tlvlist_add_32(aim_tlvlist_t **list, const guint16 type, const guint32 value); |
1428 faim_internal int aim_tlvlist_add_str(aim_tlvlist_t **list, const guint16 type, const char *value); | 1320 int aim_tlvlist_add_str(aim_tlvlist_t **list, const guint16 type, const char *value); |
1429 faim_internal int aim_tlvlist_add_caps(aim_tlvlist_t **list, const guint16 type, const guint32 caps); | 1321 int aim_tlvlist_add_caps(aim_tlvlist_t **list, const guint16 type, const guint32 caps); |
1430 faim_internal int aim_tlvlist_add_userinfo(aim_tlvlist_t **list, guint16 type, aim_userinfo_t *userinfo); | 1322 int aim_tlvlist_add_userinfo(aim_tlvlist_t **list, guint16 type, aim_userinfo_t *userinfo); |
1431 faim_internal int aim_tlvlist_add_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance); | 1323 int aim_tlvlist_add_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance); |
1432 faim_internal int aim_tlvlist_add_frozentlvlist(aim_tlvlist_t **list, guint16 type, aim_tlvlist_t **tl); | 1324 int aim_tlvlist_add_frozentlvlist(aim_tlvlist_t **list, guint16 type, aim_tlvlist_t **tl); |
1433 | 1325 |
1434 faim_internal int aim_tlvlist_replace_raw(aim_tlvlist_t **list, const guint16 type, const guint16 lenth, const guint8 *value); | 1326 int aim_tlvlist_replace_raw(aim_tlvlist_t **list, const guint16 type, const guint16 lenth, const guint8 *value); |
1435 faim_internal int aim_tlvlist_replace_str(aim_tlvlist_t **list, const guint16 type, const char *str); | 1327 int aim_tlvlist_replace_str(aim_tlvlist_t **list, const guint16 type, const char *str); |
1436 faim_internal int aim_tlvlist_replace_noval(aim_tlvlist_t **list, const guint16 type); | 1328 int aim_tlvlist_replace_noval(aim_tlvlist_t **list, const guint16 type); |
1437 faim_internal int aim_tlvlist_replace_8(aim_tlvlist_t **list, const guint16 type, const guint8 value); | 1329 int aim_tlvlist_replace_8(aim_tlvlist_t **list, const guint16 type, const guint8 value); |
1438 faim_internal int aim_tlvlist_replace_16(aim_tlvlist_t **list, const guint16 type, const guint16 value); | 1330 int aim_tlvlist_replace_16(aim_tlvlist_t **list, const guint16 type, const guint16 value); |
1439 faim_internal int aim_tlvlist_replace_32(aim_tlvlist_t **list, const guint16 type, const guint32 value); | 1331 int aim_tlvlist_replace_32(aim_tlvlist_t **list, const guint16 type, const guint32 value); |
1440 | 1332 |
1441 faim_internal void aim_tlvlist_remove(aim_tlvlist_t **list, const guint16 type); | 1333 void aim_tlvlist_remove(aim_tlvlist_t **list, const guint16 type); |
1442 | 1334 |
1443 | 1335 |
1444 | 1336 |
1445 /* util.c */ | 1337 /* util.c */ |
1446 /* | 1338 /* These are really ugly. You'd think this was LISP. I wish it was. */ |
1447 * These are really ugly. You'd think this was LISP. I wish it was. | |
1448 * | |
1449 * XXX With the advent of bstream's, these should be removed to enforce | |
1450 * their use. | |
1451 * | |
1452 */ | |
1453 #define aimutil_put8(buf, data) ((*(buf) = (guint8)(data)&0xff),1) | 1339 #define aimutil_put8(buf, data) ((*(buf) = (guint8)(data)&0xff),1) |
1454 #define aimutil_get8(buf) ((*(buf))&0xff) | 1340 #define aimutil_get8(buf) ((*(buf))&0xff) |
1455 #define aimutil_put16(buf, data) ( \ | 1341 #define aimutil_put16(buf, data) ( \ |
1456 (*(buf) = (guint8)((data)>>8)&0xff), \ | 1342 (*(buf) = (guint8)((data)>>8)&0xff), \ |
1457 (*((buf)+1) = (guint8)(data)&0xff), \ | 1343 (*((buf)+1) = (guint8)(data)&0xff), \ |
1493 (((*((buf)+0)) << 0) & 0x000000ff) + \ | 1379 (((*((buf)+0)) << 0) & 0x000000ff) + \ |
1494 (((*((buf)+1)) << 8) & 0x0000ff00) + \ | 1380 (((*((buf)+1)) << 8) & 0x0000ff00) + \ |
1495 (((*((buf)+2)) << 16) & 0x00ff0000) + \ | 1381 (((*((buf)+2)) << 16) & 0x00ff0000) + \ |
1496 (((*((buf)+3)) << 24) & 0xff000000)) | 1382 (((*((buf)+3)) << 24) & 0xff000000)) |
1497 | 1383 |
1498 faim_export guint16 aimutil_iconsum(const guint8 *buf, int buflen); | 1384 guint16 aimutil_iconsum(const guint8 *buf, int buflen); |
1499 faim_export int aimutil_tokslen(char *toSearch, int theindex, char dl); | 1385 int aimutil_tokslen(char *toSearch, int theindex, char dl); |
1500 faim_export int aimutil_itemcnt(char *toSearch, char dl); | 1386 int aimutil_itemcnt(char *toSearch, char dl); |
1501 faim_export char *aimutil_itemindex(char *toSearch, int theindex, char dl); | 1387 char *aimutil_itemindex(char *toSearch, int theindex, char dl); |
1502 | 1388 |
1503 faim_export int aim_snvalid(const char *sn); | 1389 int aim_snvalid(const char *sn); |
1504 faim_export int aim_sn_is_icq(const char *sn); | 1390 int aim_sn_is_icq(const char *sn); |
1505 faim_export int aim_sn_is_sms(const char *sn); | 1391 int aim_sn_is_sms(const char *sn); |
1506 faim_export int aim_snlen(const char *sn); | 1392 int aim_snlen(const char *sn); |
1507 faim_export int aim_sncmp(const char *sn1, const char *sn2); | 1393 int aim_sncmp(const char *sn1, const char *sn2); |
1508 | 1394 |
1509 #include "oscar_internal.h" | 1395 |
1396 | |
1397 | |
1398 typedef struct { | |
1399 guint16 family; | |
1400 guint16 subtype; | |
1401 guint16 flags; | |
1402 guint32 id; | |
1403 } aim_modsnac_t; | |
1404 | |
1405 #define AIM_MODULENAME_MAXLEN 16 | |
1406 #define AIM_MODFLAG_MULTIFAMILY 0x0001 | |
1407 typedef struct aim_module_s | |
1408 { | |
1409 guint16 family; | |
1410 guint16 version; | |
1411 guint16 toolid; | |
1412 guint16 toolversion; | |
1413 guint16 flags; | |
1414 char name[AIM_MODULENAME_MAXLEN+1]; | |
1415 int (*snachandler)(OscarData *od, FlapConnection *conn, struct aim_module_s *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs); | |
1416 void (*shutdown)(OscarData *od, struct aim_module_s *mod); | |
1417 void *priv; | |
1418 struct aim_module_s *next; | |
1419 } aim_module_t; | |
1420 | |
1421 int aim__registermodule(OscarData *od, int (*modfirst)(OscarData *, aim_module_t *)); | |
1422 void aim__shutdownmodules(OscarData *od); | |
1423 aim_module_t *aim__findmodulebygroup(OscarData *od, guint16 group); | |
1424 aim_module_t *aim__findmodule(OscarData *od, const char *name); | |
1425 | |
1426 int admin_modfirst(OscarData *od, aim_module_t *mod); | |
1427 int buddylist_modfirst(OscarData *od, aim_module_t *mod); | |
1428 int bos_modfirst(OscarData *od, aim_module_t *mod); | |
1429 int search_modfirst(OscarData *od, aim_module_t *mod); | |
1430 int stats_modfirst(OscarData *od, aim_module_t *mod); | |
1431 int auth_modfirst(OscarData *od, aim_module_t *mod); | |
1432 int msg_modfirst(OscarData *od, aim_module_t *mod); | |
1433 int misc_modfirst(OscarData *od, aim_module_t *mod); | |
1434 int chatnav_modfirst(OscarData *od, aim_module_t *mod); | |
1435 int chat_modfirst(OscarData *od, aim_module_t *mod); | |
1436 int locate_modfirst(OscarData *od, aim_module_t *mod); | |
1437 int service_modfirst(OscarData *od, aim_module_t *mod); | |
1438 int invite_modfirst(OscarData *od, aim_module_t *mod); | |
1439 int translate_modfirst(OscarData *od, aim_module_t *mod); | |
1440 int popups_modfirst(OscarData *od, aim_module_t *mod); | |
1441 int adverts_modfirst(OscarData *od, aim_module_t *mod); | |
1442 int odir_modfirst(OscarData *od, aim_module_t *mod); | |
1443 int bart_modfirst(OscarData *od, aim_module_t *mod); | |
1444 int ssi_modfirst(OscarData *od, aim_module_t *mod); | |
1445 int icq_modfirst(OscarData *od, aim_module_t *mod); | |
1446 int email_modfirst(OscarData *od, aim_module_t *mod); | |
1447 | |
1448 int aim_genericreq_n(OscarData *, FlapConnection *conn, guint16 family, guint16 subtype); | |
1449 int aim_genericreq_n_snacid(OscarData *, FlapConnection *conn, guint16 family, guint16 subtype); | |
1450 int aim_genericreq_l(OscarData *, FlapConnection *conn, guint16 family, guint16 subtype, guint32 *); | |
1451 int aim_genericreq_s(OscarData *, FlapConnection *conn, guint16 family, guint16 subtype, guint16 *); | |
1452 | |
1453 /* bstream.c */ | |
1454 int byte_stream_init(ByteStream *bs, guint8 *data, int len); | |
1455 int byte_stream_empty(ByteStream *bs); | |
1456 int byte_stream_curpos(ByteStream *bs); | |
1457 int byte_stream_setpos(ByteStream *bs, unsigned int off); | |
1458 void byte_stream_rewind(ByteStream *bs); | |
1459 int byte_stream_advance(ByteStream *bs, int n); | |
1460 guint8 byte_stream_get8(ByteStream *bs); | |
1461 guint16 byte_stream_get16(ByteStream *bs); | |
1462 guint32 byte_stream_get32(ByteStream *bs); | |
1463 guint8 byte_stream_getle8(ByteStream *bs); | |
1464 guint16 byte_stream_getle16(ByteStream *bs); | |
1465 guint32 byte_stream_getle32(ByteStream *bs); | |
1466 int byte_stream_getrawbuf(ByteStream *bs, guint8 *buf, int len); | |
1467 guint8 *byte_stream_getraw(ByteStream *bs, int len); | |
1468 char *byte_stream_getstr(ByteStream *bs, int len); | |
1469 int byte_stream_put8(ByteStream *bs, guint8 v); | |
1470 int byte_stream_put16(ByteStream *bs, guint16 v); | |
1471 int byte_stream_put32(ByteStream *bs, guint32 v); | |
1472 int byte_stream_putle8(ByteStream *bs, guint8 v); | |
1473 int byte_stream_putle16(ByteStream *bs, guint16 v); | |
1474 int byte_stream_putle32(ByteStream *bs, guint32 v); | |
1475 int byte_stream_putraw(ByteStream *bs, const guint8 *v, int len); | |
1476 int byte_stream_putstr(ByteStream *bs, const char *str); | |
1477 int byte_stream_putbs(ByteStream *bs, ByteStream *srcbs, int len); | |
1478 int byte_stream_putcaps(ByteStream *bs, guint32 caps); | |
1479 | |
1480 /* rxhandlers.c */ | |
1481 aim_rxcallback_t aim_callhandler(OscarData *od, guint16 family, guint16 type); | |
1482 | |
1483 /* | |
1484 * Generic SNAC structure. Rarely if ever used. | |
1485 */ | |
1486 typedef struct aim_snac_s { | |
1487 aim_snacid_t id; | |
1488 guint16 family; | |
1489 guint16 type; | |
1490 guint16 flags; | |
1491 void *data; | |
1492 time_t issuetime; | |
1493 struct aim_snac_s *next; | |
1494 } aim_snac_t; | |
1495 | |
1496 /* snac.c */ | |
1497 void aim_initsnachash(OscarData *od); | |
1498 aim_snacid_t aim_newsnac(OscarData *, aim_snac_t *newsnac); | |
1499 aim_snacid_t aim_cachesnac(OscarData *od, const guint16 family, const guint16 type, const guint16 flags, const void *data, const int datalen); | |
1500 aim_snac_t *aim_remsnac(OscarData *, aim_snacid_t id); | |
1501 int aim_putsnac(ByteStream *, guint16 family, guint16 type, guint16 flags, aim_snacid_t id); | |
1502 | |
1503 struct chatsnacinfo { | |
1504 guint16 exchange; | |
1505 char name[128]; | |
1506 guint16 instance; | |
1507 }; | |
1508 | |
1509 /* | |
1510 * In SNACland, the terms 'family' and 'group' are synonymous -- the former | |
1511 * is my term, the latter is AOL's. | |
1512 */ | |
1513 struct snacgroup { | |
1514 guint16 group; | |
1515 struct snacgroup *next; | |
1516 }; | |
1517 | |
1518 struct snacpair { | |
1519 guint16 group; | |
1520 guint16 subtype; | |
1521 struct snacpair *next; | |
1522 }; | |
1523 | |
1524 struct rateclass { | |
1525 guint16 classid; | |
1526 guint32 windowsize; | |
1527 guint32 clear; | |
1528 guint32 alert; | |
1529 guint32 limit; | |
1530 guint32 disconnect; | |
1531 guint32 current; | |
1532 guint32 max; | |
1533 guint8 unknown[5]; /* only present in versions >= 3 */ | |
1534 struct snacpair *members; | |
1535 struct rateclass *next; | |
1536 }; | |
1537 | |
1538 /* | |
1539 * This is inside every connection. But it is a void * to anything | |
1540 * outside of libfaim. It should remain that way. It's called data | |
1541 * abstraction. Maybe you've heard of it. (Probably not if you're a | |
1542 * libfaim user.) | |
1543 * | |
1544 */ | |
1545 typedef struct aim_conn_inside_s { | |
1546 struct snacgroup *groups; | |
1547 struct rateclass *rates; | |
1548 } aim_conn_inside_t; | |
1549 | |
1550 int aim_cachecookie(OscarData *od, IcbmCookie *cookie); | |
1551 IcbmCookie *aim_uncachecookie(OscarData *od, guint8 *cookie, int type); | |
1552 IcbmCookie *aim_mkcookie(guint8 *, int, void *); | |
1553 IcbmCookie *aim_checkcookie(OscarData *, const unsigned char *, const int); | |
1554 int aim_freecookie(OscarData *od, IcbmCookie *cookie); | |
1555 int aim_msgcookie_gettype(int type); | |
1556 int aim_cookie_free(OscarData *od, IcbmCookie *cookie); | |
1557 | |
1558 int aim_chat_readroominfo(ByteStream *bs, struct aim_chat_roominfo *outinfo); | |
1559 | |
1560 void flap_connection_destroy_chat(OscarData *od, FlapConnection *conn); | |
1561 | |
1562 /* These are all handled internally now. */ | |
1563 int aim_setversions(OscarData *od, FlapConnection *conn); | |
1564 int aim_reqrates(OscarData *, FlapConnection *); | |
1565 int aim_rates_addparam(OscarData *, FlapConnection *); | |
1566 int aim_rates_delparam(OscarData *, FlapConnection *); | |
1567 | |
1568 | |
1569 | |
1570 | |
1510 | 1571 |
1511 #ifdef __cplusplus | 1572 #ifdef __cplusplus |
1512 } | 1573 } |
1513 #endif | 1574 #endif |
1514 | 1575 |