Changeset e374dee for libfaim/aim.h


Ignore:
Timestamp:
Oct 10, 2003, 5:12:30 PM (21 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
fe6f1d3
Parents:
f4d0975
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfaim/aim.h

    r862371b re374dee  
    33 *
    44 * "come on, i turned a chick lesbian; i think this is the hackish equivalent"
    5  *                                                -- Josh Meyer
     5 *                                                -- Josh Myer
    66 *
    77 */
     
    2929#include <sys/time.h>
    3030#include <unistd.h>
     31#include <netdb.h>
    3132#include <netinet/in.h>
    3233#include <sys/socket.h>
     
    3536#endif
    3637
     38#ifdef __cplusplus
     39extern "C" {
     40#endif
     41
    3742/* XXX adjust these based on autoconf-detected platform */
    3843typedef unsigned char fu8_t;
    3944typedef unsigned short fu16_t;
    40 typedef unsigned long fu32_t;
     45typedef unsigned int fu32_t;
    4146typedef fu32_t aim_snacid_t;
    4247typedef fu16_t flap_seqnum_t;
     
    4449#if defined(mach) && defined(__APPLE__)
    4550#define gethostbyname(x) gethostbyname2(x, AF_INET)
    46 #endif
    47 
    48 #if defined(_WIN32) || defined(STRICT_ANSI)
    49 #define faim_shortfunc
    50 #else
    51 #define faim_shortfunc inline
    5251#endif
    5352
     
    7372#endif
    7473
     74#ifndef FALSE
     75#define FALSE (0)
     76#endif
     77
     78#ifndef TRUE
     79#define TRUE (!FALSE)
     80#endif
     81
    7582/*
    7683 * Current Maximum Length for Screen Names (not including NULL)
     
    7986 * however it is aparently legal for them to be larger.
    8087 */
    81 #define MAXSNLEN 32
     88#define MAXSNLEN 97
    8289
    8390/*
     
    114121#define MAXCHATMSGLEN 512
    115122
    116 /*
    117  * Standard size of an AIM authorization cookie
    118  */
    119 #define AIM_COOKIELEN            0x100
     123/**
     124 * Maximum length for the password of an ICQ account
     125 */
     126#define MAXICQPASSLEN 8
    120127
    121128#define AIM_MD5_STRING "AOL Instant Messenger (SM)"
     
    130137        const char *clientstring;
    131138        fu16_t clientid;
    132         int major;
    133         int minor;
    134         int point;
    135         int build;
     139        fu16_t major;
     140        fu16_t minor;
     141        fu16_t point;
     142        fu16_t build;
     143        fu32_t distrib;
    136144        const char *country; /* two-letter abbrev */
    137145        const char *lang; /* two-letter abbrev */
    138146};
    139147
     148/* Needs to be checked */
    140149#define CLIENTINFO_AIM_3_5_1670 { \
    141150        "AOL Instant Messenger (SM), version 3.5.1670/WIN32", \
    142151        0x0004, \
    143         0x0003, \
    144         0x0005, \
    145         0x0000, \
    146         0x0686, \
    147         "us", \
    148         "en", \
     152        0x0003, 0x0005, \
     153        0x0000, 0x0686, \
     154        0x0000002a, \
     155        "us", "en", \
    149156}
    150157
     158/* Needs to be checked */
     159/* Latest winaim without ssi */
    151160#define CLIENTINFO_AIM_4_1_2010 { \
    152           "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \
    153           0x0004, \
    154           0x0004, \
    155           0x0001, \
    156           0x0000, \
    157           0x07da, \
    158           "us", \
    159           "en", \
     161        "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \
     162        0x0004, \
     163        0x0004, 0x0001, \
     164        0x0000, 0x07da, \
     165        0x0000004b, \
     166        "us", "en", \
    160167}
    161168
     169/* Needs to be checked */
     170#define CLIENTINFO_AIM_4_3_2188 { \
     171        "AOL Instant Messenger (SM), version 4.3.2188/WIN32", \
     172        0x0109, \
     173        0x0400, 0x0003, \
     174        0x0000, 0x088c, \
     175        0x00000086, \
     176        "us", "en", \
     177}
     178
     179/* Needs to be checked */
     180#define CLIENTINFO_AIM_4_8_2540 { \
     181        "AOL Instant Messenger (SM), version 4.8.2540/WIN32", \
     182        0x0109, \
     183        0x0004, 0x0008, \
     184        0x0000, 0x09ec, \
     185        0x000000af, \
     186        "us", "en", \
     187}
     188
     189/* Needs to be checked */
    162190#define CLIENTINFO_AIM_5_0_2938 { \
    163           "AOL Instant Messenger, version 5.0.2938/WIN32", \
    164           0x0109, \
    165           0x0005, \
    166           0x0000, \
    167           0x0000, \
    168           0x0b7a, \
    169           "us", \
    170           "en", \
     191        "AOL Instant Messenger, version 5.0.2938/WIN32", \
     192        0x0109, \
     193        0x0005, 0x0000, \
     194        0x0000, 0x0b7a, \
     195        0x00000000, \
     196        "us", "en", \
    171197}
    172198
     199#define CLIENTINFO_AIM_5_1_3036 { \
     200        "AOL Instant Messenger, version 5.1.3036/WIN32", \
     201        0x0109, \
     202        0x0005, 0x0001, \
     203        0x0000, 0x0bdc, \
     204        0x000000d2, \
     205        "us", "en", \
     206}
     207
     208#define CLIENTINFO_ICHAT_1_0 { \
     209        "Apple iChat", \
     210        0x311a, \
     211        0x0001, 0x0000, \
     212        0x0000, 0x003c, \
     213        0x000000c6, \
     214        "us", "en", \
     215}
     216
     217/* Needs to be checked */
    173218#define CLIENTINFO_ICQ_4_65_3281 { \
    174219        "ICQ Inc. - Product of ICQ (TM) 2000b.4.65.1.3281.85", \
    175220        0x010a, \
    176         0x0004, \
    177         0x0041, \
    178         0x0001, \
    179         0x0cd1, \
    180         "us", \
    181         "en", \
     221        0x0004, 0x0041, \
     222        0x0001, 0x0cd1, \
     223        0x00000055, \
     224        "us", "en", \
    182225}
    183226
     227/* Needs to be checked */
    184228#define CLIENTINFO_ICQ_5_34_3728 { \
    185229        "ICQ Inc. - Product of ICQ (TM).2002a.5.34.1.3728.85", \
    186230        0x010a, \
    187         0x0005, \
    188         0x0022, \
    189         0x0001, \
    190         0x0e8f, \
    191         "us", \
    192         "en", \
     231        0x0005, 0x0022, \
     232        0x0001, 0x0e8f, \
     233        0x00000055, \
     234        "us", "en", \
    193235}
    194236
    195 /*
    196  * I would make 4.1.2010 the default, but they seem to have found
    197  * an alternate way of breaking that one.
    198  *
    199  * 3.5.1670 should work fine, however, you will be subjected to the
    200  * memory test, which may require you to have a WinAIM binary lying
    201  * around. (see login.c::memrequest())
    202  */
    203 #define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_3_5_1670
    204 #define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQ_4_65_3281
    205 
    206 #ifndef TRUE
    207 #define TRUE 1
    208 #define FALSE 0
    209 #endif
     237#define CLIENTINFO_ICQ_5_45_3777 { \
     238        "ICQ Inc. - Product of ICQ (TM).2003a.5.45.1.3777.85", \
     239        0x010a, \
     240        0x0005, 0x002d, \
     241        0x0001, 0x0ec1, \
     242        0x00000055, \
     243        "us", "en", \
     244}
     245
     246#define CLIENTINFO_ICQBasic_14_3_1068 { \
     247        "ICQBasic", \
     248        0x010a, \
     249        0x0014, 0x0003, \
     250        0x0000, 0x042c, \
     251        0x0000043d, \
     252        "us", "en", \
     253}
     254
     255#define CLIENTINFO_Netscape_7_0_1 { \
     256        "Netscape 2000 an approved user of AOL Instant Messenger (SM)", \
     257        0x1d0d, \
     258        0x0007, 0x0000, \
     259        0x0001, 0x0000, \
     260        0x00000058, \
     261        "us", "en", \
     262}
     263
     264#define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_5_1_3036
     265#define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQ_5_45_3777
    210266
    211267/*
    212268 * These could be arbitrary, but its easier to use the actual AIM values
    213269 */
    214 #define AIM_CONN_TYPE_AUTH          0x0007
    215 #define AIM_CONN_TYPE_ADS           0x0005
    216 #define AIM_CONN_TYPE_BOS           0x0002
    217 #define AIM_CONN_TYPE_CHAT          0x000e
    218 #define AIM_CONN_TYPE_CHATNAV       0x000d
    219 #define AIM_CONN_TYPE_SEARCH        0x000f
    220 #define AIM_CONN_TYPE_EMAIL         0x0018
    221 
    222 /* they start getting arbitrary in rendezvous stuff =) */
    223 #define AIM_CONN_TYPE_RENDEZVOUS    0x0101 /* these do not speak FLAP! */
    224 #define AIM_CONN_TYPE_RENDEZVOUS_OUT 0x0102 /* socket waiting for accept() */
     270#define AIM_CONN_TYPE_BOS               0x0002
     271#define AIM_CONN_TYPE_ADS               0x0005
     272#define AIM_CONN_TYPE_AUTH              0x0007
     273#define AIM_CONN_TYPE_CHATNAV           0x000d
     274#define AIM_CONN_TYPE_CHAT              0x000e
     275#define AIM_CONN_TYPE_SEARCH            0x000f
     276#define AIM_CONN_TYPE_ICON              0x0010
     277#define AIM_CONN_TYPE_EMAIL             0x0018
     278
     279/* they start getting arbitrary for rendezvous stuff =) */
     280#define AIM_CONN_TYPE_RENDEZVOUS        0xfffe /* these do not speak FLAP! */
     281#define AIM_CONN_TYPE_LISTENER          0xffff /* socket waiting for accept() */
    225282
    226283/*
    227284 * Subtypes, we need these for OFT stuff.
    228285 */
    229 #define AIM_CONN_SUBTYPE_OFT_DIRECTIM  0x0001
    230 #define AIM_CONN_SUBTYPE_OFT_GETFILE   0x0002
    231 #define AIM_CONN_SUBTYPE_OFT_SENDFILE  0x0003
    232 #define AIM_CONN_SUBTYPE_OFT_BUDDYICON 0x0004
    233 #define AIM_CONN_SUBTYPE_OFT_VOICE     0x0005
     286#define AIM_CONN_SUBTYPE_OFT_DIRECTIM   0x0001
     287#define AIM_CONN_SUBTYPE_OFT_GETFILE    0x0002
     288#define AIM_CONN_SUBTYPE_OFT_SENDFILE   0x0003
     289#define AIM_CONN_SUBTYPE_OFT_BUDDYICON  0x0004
     290#define AIM_CONN_SUBTYPE_OFT_VOICE      0x0005
    234291
    235292/*
    236293 * Status values returned from aim_conn_new().  ORed together.
    237294 */
    238 #define AIM_CONN_STATUS_READY       0x0001
    239 #define AIM_CONN_STATUS_INTERNALERR 0x0002
    240 #define AIM_CONN_STATUS_RESOLVERR   0x0040
    241 #define AIM_CONN_STATUS_CONNERR     0x0080
    242 #define AIM_CONN_STATUS_INPROGRESS  0x0100
    243 
    244 #define AIM_FRAMETYPE_FLAP 0x0000
    245 #define AIM_FRAMETYPE_OFT  0x0001
     295#define AIM_CONN_STATUS_READY           0x0001
     296#define AIM_CONN_STATUS_INTERNALERR     0x0002
     297#define AIM_CONN_STATUS_RESOLVERR       0x0040
     298#define AIM_CONN_STATUS_CONNERR         0x0080
     299#define AIM_CONN_STATUS_INPROGRESS      0x0100
     300
     301#define AIM_FRAMETYPE_FLAP              0x0000
     302#define AIM_FRAMETYPE_OFT               0x0001
    246303
    247304typedef struct aim_conn_s {
     
    289346                } flap;
    290347                struct {
    291                         fu8_t magic[4]; /* ODC2 OFT2 */
     348                        fu8_t magic[4]; /* ODC2 or OFT2 */
    292349                        fu16_t hdrlen;
    293350                        fu16_t type;
     
    297354        fu8_t handled;          /* 0 = new, !0 = been handled */
    298355        fu8_t nofree;           /* 0 = free data on purge, 1 = only unlink */
    299         aim_conn_t *conn;  /* the connection it came in on... */
     356        aim_conn_t *conn;       /* the connection it came in on... */
    300357        struct aim_frame_s *next;
    301358} aim_frame_t;
    302359
    303360typedef struct aim_msgcookie_s {
    304         unsigned char cookie[8];
     361        fu8_t cookie[8];
    305362        int type;
    306363        void *data;
     
    308365        struct aim_msgcookie_s *next;
    309366} aim_msgcookie_t;
     367
     368/* Values for sess->flags */
     369#define AIM_SESS_FLAGS_SNACLOGIN         0x00000001
     370#define AIM_SESS_FLAGS_XORLOGIN          0x00000002
     371#define AIM_SESS_FLAGS_NONBLOCKCONNECT   0x00000004
     372#define AIM_SESS_FLAGS_DONTTIMEOUTONICBM 0x00000008
    310373
    311374/*
     
    331394
    332395        /* ---- Internal Use Only ------------------------ */
    333 
    334         /* Server-stored information (ssi) */
    335         struct {
    336                 int received_data;
    337                 fu16_t revision;
    338                 struct aim_ssi_item *items;
    339                 time_t timestamp;
    340                 int waiting_for_ack;
    341                 aim_frame_t *holding_queue;
    342         } ssi;
    343 
    344         struct aim_emailinfo *emailinfo;
    345396
    346397        /* Connection information */
     
    368419        int (*tx_enqueue)(struct aim_session_s *, aim_frame_t *);
    369420
     421        void *modlistv;
     422
     423        struct {
     424                char server[128];
     425                char username[128];
     426                char password[128];
     427        } socksproxy;
     428
     429        fu32_t flags; /* AIM_SESS_FLAGS_ */
     430
     431        int debug;
     432        void (*debugcb)(struct aim_session_s *sess, int level, const char *format, va_list va); /* same as faim_debugging_callback_t */
     433
    370434        /*
    371435         * Outstanding snac handling
     
    376440        aim_snacid_t snacid_next;
    377441
     442        aim_msgcookie_t *msgcookies;
     443        struct aim_icq_info *icq_info;
     444        struct aim_oft_info *oft_info;
     445        struct aim_authresp_info *authinfo;
     446        struct aim_emailinfo *emailinfo;
     447
     448        /* Server-stored information (ssi) */
    378449        struct {
    379                 char server[128];
    380                 char username[128];
    381                 char password[128];
    382         } socksproxy;
    383 
    384         fu32_t flags; /* AIM_SESS_FLAGS_ */
    385 
    386         int debug;
    387         void (*debugcb)(struct aim_session_s *sess, int level, const char *format, va_list va); /* same as faim_debugging_callback_t */
    388 
    389         aim_msgcookie_t *msgcookies;
    390 
    391         void *modlistv;
     450                int received_data;
     451                fu16_t numitems;
     452                struct aim_ssi_item *official;
     453                struct aim_ssi_item *local;
     454                struct aim_ssi_tmp *pending;
     455                time_t timestamp;
     456                int waiting_for_ack;
     457        } ssi;
    392458} aim_session_t;
    393459
    394 /* Values for sess->flags */
    395 #define AIM_SESS_FLAGS_SNACLOGIN         0x00000001
    396 #define AIM_SESS_FLAGS_XORLOGIN          0x00000002
    397 #define AIM_SESS_FLAGS_NONBLOCKCONNECT   0x00000004
    398 #define AIM_SESS_FLAGS_DONTTIMEOUTONICBM 0x00000008
    399 
    400460/* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */
    401 #define AIM_ICQ_STATE_NORMAL    0x00000000
    402 #define AIM_ICQ_STATE_AWAY      0x00000001
    403 #define AIM_ICQ_STATE_DND       0x00000002
    404 #define AIM_ICQ_STATE_OUT       0x00000004
    405 #define AIM_ICQ_STATE_BUSY      0x00000010
    406 #define AIM_ICQ_STATE_CHAT      0x00000020
    407 #define AIM_ICQ_STATE_INVISIBLE 0x00000100
    408 #define AIM_ICQ_STATE_WEBAWARE  0x00010000
    409 
    410 /*
    411  * AIM User Info, Standard Form.
    412  */
    413 typedef struct {
    414         char sn[MAXSNLEN+1];
    415         fu16_t warnlevel; /* evil percent * 10 (999 = 99.9%) */
    416         fu16_t idletime; /* in seconds */
    417         fu16_t flags;
    418         fu32_t createtime; /* time_t */
    419         fu32_t membersince; /* time_t */
    420         fu32_t onlinesince; /* time_t */
    421         fu32_t sessionlen;  /* in seconds */
    422         fu32_t capabilities;
    423         struct {
    424                 fu32_t status;
    425                 fu32_t ipaddr;
    426                 fu8_t crap[0x25]; /* until we figure it out... */
    427         } icqinfo;
    428         fu32_t present;
    429 } aim_userinfo_t;
    430 
    431 #define AIM_USERINFO_PRESENT_FLAGS        0x00000001
    432 #define AIM_USERINFO_PRESENT_MEMBERSINCE  0x00000002
    433 #define AIM_USERINFO_PRESENT_ONLINESINCE  0x00000004
    434 #define AIM_USERINFO_PRESENT_IDLE         0x00000008
    435 #define AIM_USERINFO_PRESENT_ICQEXTSTATUS 0x00000010
    436 #define AIM_USERINFO_PRESENT_ICQIPADDR    0x00000020
    437 #define AIM_USERINFO_PRESENT_ICQDATA      0x00000040
    438 #define AIM_USERINFO_PRESENT_CAPABILITIES 0x00000080
    439 #define AIM_USERINFO_PRESENT_SESSIONLEN   0x00000100
    440 #define AIM_USERINFO_PRESENT_CREATETIME   0x00000200
    441 
    442 faim_export const char *aim_userinfo_sn(aim_userinfo_t *ui);
    443 faim_export fu16_t aim_userinfo_flags(aim_userinfo_t *ui);
    444 faim_export fu16_t aim_userinfo_idle(aim_userinfo_t *ui);
    445 faim_export float aim_userinfo_warnlevel(aim_userinfo_t *ui);
    446 faim_export time_t aim_userinfo_createtime(aim_userinfo_t *ui);
    447 faim_export time_t aim_userinfo_membersince(aim_userinfo_t *ui);
    448 faim_export time_t aim_userinfo_onlinesince(aim_userinfo_t *ui);
    449 faim_export fu32_t aim_userinfo_sessionlen(aim_userinfo_t *ui);
    450 faim_export int aim_userinfo_hascap(aim_userinfo_t *ui, fu32_t cap);
    451 
    452 #define AIM_FLAG_UNCONFIRMED    0x0001 /* "damned transients" */
    453 #define AIM_FLAG_ADMINISTRATOR  0x0002
    454 #define AIM_FLAG_AOL            0x0004
    455 #define AIM_FLAG_OSCAR_PAY      0x0008
    456 #define AIM_FLAG_FREE           0x0010
    457 #define AIM_FLAG_AWAY           0x0020
    458 #define AIM_FLAG_ICQ            0x0040
    459 #define AIM_FLAG_WIRELESS       0x0080
    460 #define AIM_FLAG_UNKNOWN100     0x0100
    461 #define AIM_FLAG_UNKNOWN200     0x0200
    462 #define AIM_FLAG_ACTIVEBUDDY    0x0400
    463 #define AIM_FLAG_UNKNOWN800     0x0800
    464 #define AIM_FLAG_ABINTERNAL     0x1000
    465 
    466 #define AIM_FLAG_ALLUSERS       0x001f
    467 
    468 
    469 #if defined(FAIM_INTERNAL) || defined(FAIM_NEED_TLV)
    470 /*
    471  * TLV handling
    472  */
    473 
    474 /* Generic TLV structure. */
    475 typedef struct aim_tlv_s {
    476         fu16_t type;
    477         fu16_t length;
    478         fu8_t *value;
    479 } aim_tlv_t;
    480 
    481 /* List of above. */
    482 typedef struct aim_tlvlist_s {
    483         aim_tlv_t *tlv;
    484         struct aim_tlvlist_s *next;
    485 } aim_tlvlist_t;
    486 
    487 /* TLV-handling functions */
    488 
    489 #if 0
    490 /* Very, very raw TLV handling. */
    491 faim_internal int aim_puttlv_8(fu8_t *buf, const fu16_t t, const fu8_t v);
    492 faim_internal int aim_puttlv_16(fu8_t *buf, const fu16_t t, const fu16_t v);
    493 faim_internal int aim_puttlv_32(fu8_t *buf, const fu16_t t, const fu32_t v);
    494 faim_internal int aim_puttlv_raw(fu8_t *buf, const fu16_t t, const fu16_t l, const fu8_t *v);
    495 #endif
    496 
    497 /* TLV list handling. */
    498 faim_internal aim_tlvlist_t *aim_readtlvchain(aim_bstream_t *bs);
    499 faim_internal aim_tlvlist_t *aim_readtlvchain_num(aim_bstream_t *bs, fu16_t num);
    500 faim_internal void aim_freetlvchain(aim_tlvlist_t **list);
    501 faim_internal aim_tlv_t *aim_gettlv(aim_tlvlist_t *, fu16_t t, const int n);
    502 faim_internal char *aim_gettlv_str(aim_tlvlist_t *, const fu16_t t, const int n);
    503 faim_internal fu8_t aim_gettlv8(aim_tlvlist_t *list, const fu16_t type, const int num);
    504 faim_internal fu16_t aim_gettlv16(aim_tlvlist_t *list, const fu16_t t, const int n);
    505 faim_internal fu32_t aim_gettlv32(aim_tlvlist_t *list, const fu16_t t, const int n);
    506 faim_internal int aim_writetlvchain(aim_bstream_t *bs, aim_tlvlist_t **list);
    507 faim_internal int aim_addtlvtochain8(aim_tlvlist_t **list, const fu16_t t, const fu8_t v);
    508 faim_internal int aim_addtlvtochain16(aim_tlvlist_t **list, const fu16_t t, const fu16_t v);
    509 faim_internal int aim_addtlvtochain32(aim_tlvlist_t **list, const fu16_t type, const fu32_t v);
    510 faim_internal int aim_addtlvtochain_raw(aim_tlvlist_t **list, const fu16_t t, const fu16_t l, const fu8_t *v);
    511 faim_internal int aim_addtlvtochain_caps(aim_tlvlist_t **list, const fu16_t t, const fu32_t caps);
    512 faim_internal int aim_addtlvtochain_noval(aim_tlvlist_t **list, const fu16_t type);
    513 faim_internal int aim_addtlvtochain_userinfo(aim_tlvlist_t **list, fu16_t type, aim_userinfo_t *ui);
    514 faim_internal int aim_addtlvtochain_frozentlvlist(aim_tlvlist_t **list, fu16_t type, aim_tlvlist_t **tl);
    515 faim_internal int aim_counttlvchain(aim_tlvlist_t **list);
    516 faim_internal int aim_sizetlvchain(aim_tlvlist_t **list);
    517 #endif /* FAIM_INTERNAL */
     461#define AIM_ICQ_STATE_NORMAL            0x00000000
     462#define AIM_ICQ_STATE_AWAY              0x00000001
     463#define AIM_ICQ_STATE_DND               0x00000002
     464#define AIM_ICQ_STATE_OUT               0x00000004
     465#define AIM_ICQ_STATE_BUSY              0x00000010
     466#define AIM_ICQ_STATE_CHAT              0x00000020
     467#define AIM_ICQ_STATE_INVISIBLE         0x00000100
     468#define AIM_ICQ_STATE_WEBAWARE          0x00010000
     469#define AIM_ICQ_STATE_HIDEIP            0x00020000
     470#define AIM_ICQ_STATE_BIRTHDAY          0x00080000
     471#define AIM_ICQ_STATE_DIRECTDISABLED    0x00100000
     472#define AIM_ICQ_STATE_ICQHOMEPAGE       0x00200000
     473#define AIM_ICQ_STATE_DIRECTREQUIREAUTH 0x10000000
     474#define AIM_ICQ_STATE_DIRECTCONTACTLIST 0x20000000
     475
    518476
    519477/*
     
    542500typedef int (*aim_rxcallback_t)(aim_session_t *, aim_frame_t *, ...);
    543501
     502
     503/* auth.c */
    544504struct aim_clientrelease {
    545505        char *name;
     
    556516        char *email;
    557517        char *bosip;
     518        fu16_t cookielen;
    558519        fu8_t *cookie;
    559520        char *chpassurl;
     
    566527        fu16_t group;
    567528        const char *ip;
     529        fu16_t cookielen;
    568530        const fu8_t *cookie;
    569531        struct { /* group == AIM_CONN_TYPE_CHAT */
     
    578540faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn);
    579541faim_export int aim_send_login(aim_session_t *, aim_conn_t *, const char *, const char *, struct client_info_s *, const char *key);
    580 faim_export int aim_encode_password_md5(const char *password, const char *key, unsigned char *digest);
     542faim_export int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest);
    581543faim_export void aim_purge_rxqueue(aim_session_t *);
     544faim_export void aim_cleansnacs(aim_session_t *, int maxage);
    582545
    583546#define AIM_TX_QUEUED    0 /* default */
     
    591554faim_export int aim_conn_setlatency(aim_conn_t *conn, int newval);
    592555
    593 faim_export int aim_conn_addhandler(aim_session_t *, aim_conn_t *conn, u_short family, u_short type, aim_rxcallback_t newhandler, u_short flags);
     556faim_export int aim_conn_addhandler(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t type, aim_rxcallback_t newhandler, fu16_t flags);
    594557faim_export int aim_clearhandlers(aim_conn_t *conn);
    595558
     
    600563faim_export int aim_conngetmaxfd(aim_session_t *);
    601564faim_export aim_conn_t *aim_select(aim_session_t *, struct timeval *, int *);
     565faim_export int aim_conn_in_sess(aim_session_t *sess, aim_conn_t *conn);
    602566faim_export int aim_conn_isready(aim_conn_t *);
    603567faim_export int aim_conn_setstatus(aim_conn_t *, int);
     
    607571typedef void (*faim_debugging_callback_t)(aim_session_t *sess, int level, const char *format, va_list va);
    608572faim_export int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t);
    609 faim_export void aim_session_init(aim_session_t *, unsigned long flags, int debuglevel);
     573faim_export void aim_session_init(aim_session_t *, fu32_t flags, int debuglevel);
    610574faim_export void aim_session_kill(aim_session_t *);
    611575faim_export void aim_setupproxy(aim_session_t *sess, const char *server, const char *username, const char *password);
     
    614578faim_export aim_conn_t *aim_getconn_fd(aim_session_t *, int fd);
    615579
     580
     581
     582/* service.c */
     583faim_export int aim_srv_setavailmsg(aim_session_t *sess, char *msg);
     584
     585
     586
    616587/* misc.c */
    617588
     
    627598
    628599faim_export int aim_sendpauseack(aim_session_t *sess, aim_conn_t *conn);
    629 faim_export int aim_send_warning(aim_session_t *sess, aim_conn_t *conn, const char *destsn, fu32_t flags);
    630600faim_export int aim_nop(aim_session_t *, aim_conn_t *);
    631601faim_export int aim_flap_nop(aim_session_t *sess, aim_conn_t *conn);
     
    633603faim_export int aim_bos_changevisibility(aim_session_t *, aim_conn_t *, int, const char *);
    634604faim_export int aim_bos_setbuddylist(aim_session_t *, aim_conn_t *, const char *);
    635 faim_export int aim_bos_setprofile(aim_session_t *sess, aim_conn_t *conn, const char *profile, const char *awaymsg, fu32_t caps);
     605faim_export int aim_bos_setprofile(aim_session_t *sess, aim_conn_t *conn, const char *profile_encoding, const char *profile, const int profile_len, const char *awaymsg_encoding, const char *awaymsg, const int awaymsg_len, fu32_t caps);
    636606faim_export int aim_bos_setgroupperm(aim_session_t *, aim_conn_t *, fu32_t mask);
    637607faim_export int aim_bos_setprivacyflags(aim_session_t *, aim_conn_t *, fu32_t);
     
    643613faim_export int aim_setdirectoryinfo(aim_session_t *sess, aim_conn_t *conn, 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, fu16_t privacy);
    644614faim_export int aim_setuserinterests(aim_session_t *sess, aim_conn_t *conn, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, fu16_t privacy);
    645 faim_export int aim_setextstatus(aim_session_t *sess, aim_conn_t *conn, fu32_t status);
    646 
    647 faim_export struct aim_fileheader_t *aim_getlisting(aim_session_t *sess, FILE *);
     615faim_export int aim_setextstatus(aim_session_t *sess, fu32_t status);
    648616
    649617#define AIM_CLIENTTYPE_UNKNOWN  0x0000
     
    652620#define AIM_CLIENTTYPE_WINAIM41 0x0003
    653621#define AIM_CLIENTTYPE_AOL_TOC  0x0004
    654 faim_export unsigned short aim_fingerprintclient(unsigned char *msghdr, int len);
     622faim_export fu16_t aim_im_fingerprint(const fu8_t *msghdr, int len);
    655623
    656624#define AIM_RATE_CODE_CHANGE     0x0001
     
    660628faim_export int aim_ads_requestads(aim_session_t *sess, aim_conn_t *conn);
    661629
     630
     631
    662632/* im.c */
    663 
    664 struct aim_fileheader_t {
    665 #if 0
    666         char  magic[4];         /* 0 */
    667         short hdrlen;           /* 4 */
    668         short hdrtype;          /* 6 */
    669 #endif
    670         char  bcookie[8];       /* 8 */
    671         short encrypt;          /* 16 */
    672         short compress;         /* 18 */
    673         short totfiles;         /* 20 */
    674         short filesleft;        /* 22 */
    675         short totparts;         /* 24 */
    676         short partsleft;        /* 26 */
    677         long  totsize;          /* 28 */
    678         long  size;             /* 32 */
    679         long  modtime;          /* 36 */
    680         long  checksum;         /* 40 */
    681         long  rfrcsum;          /* 44 */
    682         long  rfsize;           /* 48 */
    683         long  cretime;          /* 52 */
    684         long  rfcsum;           /* 56 */
    685         long  nrecvd;           /* 60 */
    686         long  recvcsum;         /* 64 */
    687         char  idstring[32];     /* 68 */
    688         char  flags;            /* 100 */
    689         char  lnameoffset;      /* 101 */
    690         char  lsizeoffset;      /* 102 */
    691         char  dummy[69];        /* 103 */
    692         char  macfileinfo[16];  /* 172 */
    693         short nencode;          /* 188 */
    694         short nlanguage;        /* 190 */
    695         char  name[64];         /* 192 */
    696                                 /* 256 */
    697 };
    698 
    699 #define AIM_OFT_SUBTYPE_SEND_FILE 0x0001
    700 #define AIM_OFT_SUBTYPE_SEND_DIR 0x0002
    701 #define AIM_OFT_SUBTYPE_GET_FILE 0x0011
    702 #define AIM_OPT_SUBTYPE_GET_LIST 0x0012
     633#define AIM_OFT_SUBTYPE_SEND_FILE       0x0001
     634#define AIM_OFT_SUBTYPE_SEND_DIR        0x0002
     635#define AIM_OFT_SUBTYPE_GET_FILE        0x0011
     636#define AIM_OPT_SUBTYPE_GET_LIST        0x0012
     637
     638#define AIM_TRANSFER_DENY_NOTSUPPORTED  0x0000
     639#define AIM_TRANSFER_DENY_DECLINE       0x0001
     640#define AIM_TRANSFER_DENY_NOTACCEPTING  0x0002
     641
     642#define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED       0x00000001
     643#define AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED    0x00000002
     644
     645/* This is what the server will give you if you don't set them yourself. */
     646#define AIM_IMPARAM_DEFAULTS { \
     647        0, \
     648        AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
     649        512, /* !! Note how small this is. */ \
     650        (99.9)*10, (99.9)*10, \
     651        1000 /* !! And how large this is. */ \
     652}
     653
     654/* This is what most AIM versions use. */
     655#define AIM_IMPARAM_REASONABLE { \
     656        0, \
     657        AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
     658        8000, \
     659        (99.9)*10, (99.9)*10, \
     660        0 \
     661}
     662
     663struct aim_icbmparameters {
     664        fu16_t maxchan;
     665        fu32_t flags; /* AIM_IMPARAM_FLAG_ */
     666        fu16_t maxmsglen; /* message size that you will accept */
     667        fu16_t maxsenderwarn; /* this and below are *10 (999=99.9%) */
     668        fu16_t maxrecverwarn;
     669        fu32_t minmsginterval; /* in milliseconds? */
     670};
    703671
    704672struct aim_chat_roominfo {
    705         unsigned short exchange;
     673        fu16_t exchange;
    706674        char *name;
    707         unsigned short instance;
     675        fu16_t instance;
    708676};
    709677
     
    717685#define AIM_IMFLAGS_CUSTOMFEATURES      0x0080 /* features field present */
    718686#define AIM_IMFLAGS_EXTDATA             0x0100
    719 #define AIM_IMFLAGS_CUSTOMCHARSET       0x0200 /* charset fields set */
     687#define AIM_IMFLAGS_X                   0x0200
    720688#define AIM_IMFLAGS_MULTIPART           0x0400 /* ->mpmsg section valid */
    721689#define AIM_IMFLAGS_OFFLINE             0x0800 /* send to offline user */
     
    829797
    830798/* Valid values for channel 2 args->status */
    831 #define AIM_RENDEZVOUS_PROPOSE 0x0000
    832 #define AIM_RENDEZVOUS_CANCEL  0x0001
    833 #define AIM_RENDEZVOUS_ACCEPT  0x0002
     799#define AIM_RENDEZVOUS_PROPOSE  0x0000
     800#define AIM_RENDEZVOUS_CANCEL   0x0001
     801#define AIM_RENDEZVOUS_ACCEPT   0x0002
    834802
    835803struct aim_incomingim_ch2_args {
     804        fu16_t status;
    836805        fu8_t cookie[8];
    837         fu16_t reqclass;
    838         fu16_t status;
    839         fu16_t errorcode;
     806        int reqclass;
     807        const char *proxyip;
    840808        const char *clientip;
    841         const char *clientip2;
    842809        const char *verifiedip;
    843810        fu16_t port;
     811        fu16_t errorcode;
    844812        const char *msg; /* invite message or file description */
    845813        const char *encoding;
     
    871839
    872840/* Valid values for channel 4 args->type */
    873 #define AIM_ICQMSG_AUTHREQUEST 0x0006
    874 #define AIM_ICQMSG_AUTHDENIED 0x0007
    875 #define AIM_ICQMSG_AUTHGRANTED 0x0008
     841#define AIM_ICQMSG_AUTHREQUEST  0x0006
     842#define AIM_ICQMSG_AUTHDENIED   0x0007
     843#define AIM_ICQMSG_AUTHGRANTED  0x0008
    876844
    877845struct aim_incomingim_ch4_args {
    878846        fu32_t uin; /* Of the sender of the ICBM */
    879         fu16_t type;
     847        fu8_t type;
     848        fu8_t flags;
    880849        char *msg; /* Reason for auth request, deny, or accept */
    881 };
    882 
    883 faim_export int aim_send_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args);
    884 faim_export int aim_send_im_ext(aim_session_t *sess, struct aim_sendimext_args *args);
    885 faim_export int aim_send_im(aim_session_t *, const char *destsn, unsigned short flags, const char *msg);
    886 faim_export int aim_send_icon(aim_session_t *sess, const char *sn, const fu8_t *icon, int iconlen, time_t stamp, fu16_t iconsum);
    887 faim_export fu16_t aim_iconsum(const fu8_t *buf, int buflen);
    888 faim_export int aim_send_typing(aim_session_t *sess, aim_conn_t *conn, int typing);
    889 faim_export int aim_send_im_direct(aim_session_t *, aim_conn_t *, const char *msg, int len, int encoding);
    890 faim_export const char *aim_directim_getsn(aim_conn_t *conn);
    891 faim_export aim_conn_t *aim_directim_initiate(aim_session_t *, const char *destsn);
    892 faim_export aim_conn_t *aim_directim_connect(aim_session_t *, const char *sn, const char *addr, const fu8_t *cookie);
    893 
    894 faim_export int aim_send_im_ch2_geticqmessage(aim_session_t *sess, const char *sn, int type);
    895 faim_export aim_conn_t *aim_sendfile_initiate(aim_session_t *, const char *destsn, const char *filename, fu16_t numfiles, fu32_t totsize, char *cookret);
    896 faim_export int aim_send_im_ch4(aim_session_t *sess, char *sn, fu16_t type, fu8_t *message);
    897 
    898 faim_export int aim_mtn_send(aim_session_t *sess, fu16_t type1, char *sn, fu16_t type2);
    899 
    900 faim_export aim_conn_t *aim_getfile_initiate(aim_session_t *sess, aim_conn_t *conn, const char *destsn);
    901 faim_export int aim_oft_getfile_request(aim_session_t *sess, aim_conn_t *conn, const char *name, int size);
    902 faim_export int aim_oft_sendfile_request(aim_session_t *sess, aim_conn_t *conn,
    903                 const char *name, int filesdone, int numfiles, int size,
    904                 int totsize);
    905 faim_export int aim_oft_getfile_ack(aim_session_t *sess, aim_conn_t *conn);
    906 faim_export int aim_oft_end(aim_session_t *sess, aim_conn_t *conn);
     850        int msglen;
     851};
     852
     853/* SNAC sending functions */
     854/* 0x0002 */ faim_export int aim_im_setparams(aim_session_t *sess, struct aim_icbmparameters *params);
     855/* 0x0004 */ faim_export int aim_im_reqparams(aim_session_t *sess);
     856/* 0x0006 */ faim_export int aim_im_sendch1_ext(aim_session_t *sess, struct aim_sendimext_args *args);
     857/* 0x0006 */ faim_export int aim_im_sendch1(aim_session_t *, const char *destsn, fu16_t flags, const char *msg);
     858/* 0x0006 */ faim_export int aim_im_sendch2_icon(aim_session_t *sess, const char *sn, const fu8_t *icon, int iconlen, time_t stamp, fu16_t iconsum);
     859/* 0x0006 */ faim_export int aim_im_sendch2_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args);
     860/* 0x0006 */ faim_export int aim_im_sendch2_odcrequest(aim_session_t *sess, fu8_t *cookie, const char *sn, const fu8_t *ip, fu16_t port);
     861/* 0x0006 */ faim_export int aim_im_sendch2_sendfile_ask(aim_session_t *sess, struct aim_oft_info *oft_info);
     862/* 0x0006 */ faim_export int aim_im_sendch2_sendfile_accept(aim_session_t *sess, struct aim_oft_info *info);
     863/* 0x0006 */ faim_export int aim_im_sendch2_sendfile_cancel(aim_session_t *sess, struct aim_oft_info *oft_info);
     864/* 0x0006 */ faim_export int aim_im_sendch2_geticqaway(aim_session_t *sess, const char *sn, int type);
     865/* 0x0006 */ faim_export int aim_im_sendch4(aim_session_t *sess, char *sn, fu16_t type, fu8_t *message);
     866/* 0x0008 */ faim_export int aim_im_warn(aim_session_t *sess, aim_conn_t *conn, const char *destsn, fu32_t flags);
     867/* 0x000b */ faim_export int aim_im_denytransfer(aim_session_t *sess, const char *sender, const char *cookie, fu16_t code);
     868/* 0x0014 */ faim_export int aim_im_sendmtn(aim_session_t *sess, fu16_t type1, const char *sn, fu16_t type2);
     869
     870
     871
     872/* ft.c */
     873struct aim_fileheader_t {
     874#if 0
     875        char magic[4];          /* 0 */
     876        fu16_t hdrlen;          /* 4 */
     877        fu16_t hdrtype;         /* 6 */
     878#endif
     879        char bcookie[8];        /* 8 */
     880        fu16_t encrypt;         /* 16 */
     881        fu16_t compress;        /* 18 */
     882        fu16_t totfiles;        /* 20 */
     883        fu16_t filesleft;       /* 22 */
     884        fu16_t totparts;        /* 24 */
     885        fu16_t partsleft;       /* 26 */
     886        fu32_t totsize;         /* 28 */
     887        fu32_t size;            /* 32 */
     888        fu32_t modtime;         /* 36 */
     889        fu32_t checksum;        /* 40 */
     890        fu32_t rfrcsum;         /* 44 */
     891        fu32_t rfsize;          /* 48 */
     892        fu32_t cretime;         /* 52 */
     893        fu32_t rfcsum;          /* 56 */
     894        fu32_t nrecvd;          /* 60 */
     895        fu32_t recvcsum;        /* 64 */
     896        fu8_t idstring[32];     /* 68 */
     897        fu8_t flags;            /* 100 */
     898        fu8_t lnameoffset;      /* 101 */
     899        fu8_t lsizeoffset;      /* 102 */
     900        char dummy[69];         /* 103 */
     901        char macfileinfo[16];   /* 172 */
     902        fu16_t nencode;         /* 188 */
     903        fu16_t nlanguage;       /* 190 */
     904        char name[64];          /* 192 */
     905                                /* 256 */
     906};
     907
     908struct aim_oft_info {
     909        char cookie[8];
     910        char *sn;
     911        char *proxyip;
     912        char *clientip;
     913        char *verifiedip;
     914        fu16_t port;
     915        aim_conn_t *conn;
     916        aim_session_t *sess;
     917        struct aim_fileheader_t fh;
     918        struct aim_oft_info *next;
     919};
     920
     921faim_export fu32_t aim_oft_checksum_chunk(const fu8_t *buffer, int bufferlen, fu32_t prevcheck);
     922faim_export fu32_t aim_oft_checksum_file(char *filename);
     923faim_export int aim_handlerendconnect(aim_session_t *sess, aim_conn_t *cur);
     924faim_export int aim_odc_send_typing(aim_session_t *sess, aim_conn_t *conn, int typing);
     925faim_export int aim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *msg, int len, int encoding, int isawaymsg);
     926faim_export const char *aim_odc_getsn(aim_conn_t *conn);
     927faim_export aim_conn_t *aim_odc_getconn(aim_session_t *sess, const char *sn);
     928faim_export aim_conn_t *aim_odc_initiate(aim_session_t *sess, const char *sn);
     929faim_export aim_conn_t *aim_odc_connect(aim_session_t *sess, const char *sn, const char *addr, const fu8_t *cookie);
     930
     931faim_export struct aim_oft_info *aim_oft_createinfo(aim_session_t *sess, const fu8_t *cookie, const char *sn, const char *ip, fu16_t port, fu32_t size, fu32_t modtime, char *filename);
     932faim_export int aim_oft_destroyinfo(struct aim_oft_info *oft_info);
     933faim_export int aim_sendfile_listen(aim_session_t *sess, struct aim_oft_info *oft_info);
     934faim_export int aim_oft_sendheader(aim_session_t *sess, fu16_t type, struct aim_oft_info *oft_info);
     935
     936
    907937
    908938/* info.c */
    909 #define AIM_CAPS_BUDDYICON      0x00000001
    910 #define AIM_CAPS_VOICE          0x00000002
    911 #define AIM_CAPS_IMIMAGE        0x00000004
    912 #define AIM_CAPS_CHAT           0x00000008
    913 #define AIM_CAPS_GETFILE        0x00000010
    914 #define AIM_CAPS_SENDFILE       0x00000020
    915 #define AIM_CAPS_GAMES          0x00000040
    916 #define AIM_CAPS_SAVESTOCKS     0x00000080
    917 #define AIM_CAPS_SENDBUDDYLIST  0x00000100
    918 #define AIM_CAPS_GAMES2         0x00000200
    919 #define AIM_CAPS_ICQ            0x00000400
    920 #define AIM_CAPS_APINFO         0x00000800
     939/*
     940 * AIM User Info, Standard Form.
     941 */
     942#define AIM_FLAG_UNCONFIRMED    0x0001 /* "damned transients" */
     943#define AIM_FLAG_ADMINISTRATOR  0x0002
     944#define AIM_FLAG_AOL            0x0004
     945#define AIM_FLAG_OSCAR_PAY      0x0008
     946#define AIM_FLAG_FREE           0x0010
     947#define AIM_FLAG_AWAY           0x0020
     948#define AIM_FLAG_ICQ            0x0040
     949#define AIM_FLAG_WIRELESS       0x0080
     950#define AIM_FLAG_UNKNOWN100     0x0100
     951#define AIM_FLAG_UNKNOWN200     0x0200
     952#define AIM_FLAG_ACTIVEBUDDY    0x0400
     953#define AIM_FLAG_UNKNOWN800     0x0800
     954#define AIM_FLAG_ABINTERNAL     0x1000
     955#define AIM_FLAG_ALLUSERS       0x001f
     956
     957#define AIM_USERINFO_PRESENT_FLAGS        0x00000001
     958#define AIM_USERINFO_PRESENT_MEMBERSINCE  0x00000002
     959#define AIM_USERINFO_PRESENT_ONLINESINCE  0x00000004
     960#define AIM_USERINFO_PRESENT_IDLE         0x00000008
     961#define AIM_USERINFO_PRESENT_ICQEXTSTATUS 0x00000010
     962#define AIM_USERINFO_PRESENT_ICQIPADDR    0x00000020
     963#define AIM_USERINFO_PRESENT_ICQDATA      0x00000040
     964#define AIM_USERINFO_PRESENT_CAPABILITIES 0x00000080
     965#define AIM_USERINFO_PRESENT_SESSIONLEN   0x00000100
     966#define AIM_USERINFO_PRESENT_CREATETIME   0x00000200
     967
     968typedef struct {
     969        char sn[MAXSNLEN+1];
     970        fu16_t warnlevel; /* evil percent * 10 (999 = 99.9%) */
     971        fu16_t idletime; /* in seconds */
     972        fu16_t flags;
     973        fu32_t createtime; /* time_t */
     974        fu32_t membersince; /* time_t */
     975        fu32_t onlinesince; /* time_t */
     976        fu32_t sessionlen;  /* in seconds */
     977        fu32_t capabilities;
     978        struct {
     979                fu32_t status;
     980                fu32_t ipaddr;
     981                fu8_t crap[0x25]; /* until we figure it out... */
     982        } icqinfo;
     983        fu32_t present;
     984        fu16_t iconcsumlen;
     985        fu8_t *iconcsum;
     986        char *availmsg_encoding;
     987        char *availmsg;
     988        int availmsg_len;
     989} aim_userinfo_t;
     990
     991faim_export const char *aim_userinfo_sn(aim_userinfo_t *ui);
     992faim_export fu16_t aim_userinfo_flags(aim_userinfo_t *ui);
     993faim_export fu16_t aim_userinfo_idle(aim_userinfo_t *ui);
     994faim_export float aim_userinfo_warnlevel(aim_userinfo_t *ui);
     995faim_export time_t aim_userinfo_createtime(aim_userinfo_t *ui);
     996faim_export time_t aim_userinfo_membersince(aim_userinfo_t *ui);
     997faim_export time_t aim_userinfo_onlinesince(aim_userinfo_t *ui);
     998faim_export fu32_t aim_userinfo_sessionlen(aim_userinfo_t *ui);
     999faim_export int aim_userinfo_hascap(aim_userinfo_t *ui, fu32_t cap);
     1000
     1001#define AIM_CAPS_BUDDYICON      0x00000001
     1002#define AIM_CAPS_VOICE          0x00000002
     1003#define AIM_CAPS_DIRECTIM       0x00000004
     1004#define AIM_CAPS_CHAT           0x00000008
     1005#define AIM_CAPS_GETFILE        0x00000010
     1006#define AIM_CAPS_SENDFILE       0x00000020
     1007#define AIM_CAPS_GAMES          0x00000040
     1008#define AIM_CAPS_SAVESTOCKS     0x00000080
     1009#define AIM_CAPS_SENDBUDDYLIST  0x00000100
     1010#define AIM_CAPS_GAMES2         0x00000200
     1011#define AIM_CAPS_ICQ            0x00000400
     1012#define AIM_CAPS_APINFO         0x00000800
    9211013#define AIM_CAPS_ICQRTF         0x00001000
    9221014#define AIM_CAPS_EMPTY          0x00002000
    923 #define AIM_CAPS_ICQSERVERRELAY 0x00004000
    924 #define AIM_CAPS_ICQUNKNOWN     0x00008000
    925 #define AIM_CAPS_TRILLIANCRYPT  0x00010000
    926 #define AIM_CAPS_LAST           0x00020000
     1015#define AIM_CAPS_ICQSERVERRELAY 0x00004000
     1016#define AIM_CAPS_ICQUTF8OLD     0x00008000
     1017#define AIM_CAPS_TRILLIANCRYPT  0x00010000
     1018#define AIM_CAPS_ICQUTF8        0x00020000
     1019#define AIM_CAPS_INTEROPERATE   0x00040000
     1020#define AIM_CAPS_ICHAT          0x00080000
     1021#define AIM_CAPS_HIPTOP         0x00100000
     1022#define AIM_CAPS_SECUREIM       0x00200000
     1023#define AIM_CAPS_LAST           0x00400000
    9271024
    9281025faim_export int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn);
     
    9311028#define AIM_SENDMEMBLOCK_FLAG_ISHASH     1
    9321029
    933 faim_export int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, unsigned long offset, unsigned long len, const unsigned char *buf, unsigned char flag);
     1030faim_export int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, fu32_t offset, fu32_t len, const fu8_t *buf, fu8_t flag);
    9341031
    9351032#define AIM_GETINFO_GENERALINFO 0x00001
     
    9611058#define AIM_COOKIETYPE_OFTICON  0x15
    9621059
    963 faim_export int aim_handlerendconnect(aim_session_t *sess, aim_conn_t *cur);
    964 
    965 #define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000
    966 #define AIM_TRANSFER_DENY_DECLINE 0x0001
    967 #define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002
    968 faim_export int aim_denytransfer(aim_session_t *sess, const char *sender, const char *cookie, unsigned short code);
    969 faim_export aim_conn_t *aim_accepttransfer(aim_session_t *sess, aim_conn_t *conn, const char *sn, const fu8_t *cookie, const fu8_t *ip, fu16_t port, fu16_t rendid, ...);
    970 faim_export int aim_canceltransfer(aim_session_t *sess, aim_conn_t *conn,
    971                                 const char *cookie, const char *sn, int rendid);
    972 faim_export fu32_t aim_update_checksum(aim_session_t *sess, aim_conn_t *conn,
    973                                 const unsigned char *buffer, int bufferlen);
    974 
    975 faim_export int aim_getinfo(aim_session_t *, aim_conn_t *, const char *, unsigned short);
    976 faim_export int aim_sendbuddyoncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info);
    977 faim_export int aim_sendbuddyoffgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn);
    978 
    979 #define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED       0x00000001
    980 #define AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED    0x00000002
    981 
    982 /* This is what the server will give you if you don't set them yourself. */
    983 #define AIM_IMPARAM_DEFAULTS { \
    984         0, \
    985         AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
    986         512, /* !! Note how small this is. */ \
    987         (99.9)*10, (99.9)*10, \
    988         1000 /* !! And how large this is. */ \
    989 }
    990 
    991 /* This is what most AIM versions use. */
    992 #define AIM_IMPARAM_REASONABLE { \
    993         0, \
    994         AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
    995         8000, \
    996         (99.9)*10, (99.9)*10, \
    997         0 \
    998 }
    999 
    1000 
    1001 struct aim_icbmparameters {
    1002         fu16_t maxchan;
    1003         fu32_t flags; /* AIM_IMPARAM_FLAG_ */
    1004         fu16_t maxmsglen; /* message size that you will accept */
    1005         fu16_t maxsenderwarn; /* this and below are *10 (999=99.9%) */
    1006         fu16_t maxrecverwarn;
    1007         fu32_t minmsginterval; /* in milliseconds? */
    1008 };
    1009 
    1010 faim_export int aim_reqicbmparams(aim_session_t *sess);
    1011 faim_export int aim_seticbmparam(aim_session_t *sess, struct aim_icbmparameters *params);
    1012 
    1013 
    1014 /* auth.c */
    1015 faim_export int aim_sendcookie(aim_session_t *, aim_conn_t *, const fu8_t *);
    1016 
    1017 faim_export int aim_admin_changepasswd(aim_session_t *, aim_conn_t *, const char *newpw, const char *curpw);
    1018 faim_export int aim_admin_reqconfirm(aim_session_t *sess, aim_conn_t *conn);
    1019 faim_export int aim_admin_getinfo(aim_session_t *sess, aim_conn_t *conn, fu16_t info);
    1020 faim_export int aim_admin_setemail(aim_session_t *sess, aim_conn_t *conn, const char *newemail);
    1021 faim_export int aim_admin_setnick(aim_session_t *sess, aim_conn_t *conn, const char *newnick);
    1022 
    1023 /* buddylist.c */
    1024 faim_export int aim_add_buddy(aim_session_t *, aim_conn_t *, const char *);
    1025 faim_export int aim_remove_buddy(aim_session_t *, aim_conn_t *, const char *);
    1026 
    1027 /* search.c */
    1028 faim_export int aim_usersearch_address(aim_session_t *, aim_conn_t *, const char *);
    1029 
    1030 /* newsearch.c */
    1031 struct aim_usersearch {
     1060/* 0x0005 */ faim_export int aim_getinfo(aim_session_t *, aim_conn_t *, const char *, fu16_t);
     1061
     1062
     1063
     1064/* 0x0003 - buddylist.c */
     1065/* 0x0004 */ faim_export int aim_add_buddy(aim_session_t *, aim_conn_t *, const char *);
     1066/* 0x0005 */ faim_export int aim_remove_buddy(aim_session_t *, aim_conn_t *, const char *);
     1067/* 0x000b */ faim_export int aim_sendbuddyoncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info);
     1068/* 0x000c */ faim_export int aim_sendbuddyoffgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn);
     1069
     1070
     1071
     1072/* 0x000a - search.c */
     1073faim_export int aim_search_address(aim_session_t *, aim_conn_t *, const char *);
     1074
     1075
     1076
     1077/* 0x000d - chatnav.c */
     1078/* 0x000e - chat.c */
     1079/* These apply to exchanges as well. */
     1080#define AIM_CHATROOM_FLAG_EVILABLE 0x0001
     1081#define AIM_CHATROOM_FLAG_NAV_ONLY 0x0002
     1082#define AIM_CHATROOM_FLAG_INSTANCING_ALLOWED 0x0004
     1083#define AIM_CHATROOM_FLAG_OCCUPANT_PEEK_ALLOWED 0x0008
     1084
     1085struct aim_chat_exchangeinfo {
     1086        fu16_t number;
     1087        fu16_t flags;
     1088        char *name;
     1089        char *charset1;
     1090        char *lang1;
     1091        char *charset2;
     1092        char *lang2;
     1093};
     1094
     1095#define AIM_CHATFLAGS_NOREFLECT 0x0001
     1096#define AIM_CHATFLAGS_AWAY      0x0002
     1097faim_export int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, fu16_t flags, const char *msg, int msglen);
     1098faim_export int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance);
     1099faim_export int aim_chat_attachname(aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance);
     1100faim_export char *aim_chat_getname(aim_conn_t *conn);
     1101faim_export aim_conn_t *aim_chat_getconn(aim_session_t *, const char *name);
     1102
     1103faim_export int aim_chatnav_reqrights(aim_session_t *sess, aim_conn_t *conn);
     1104
     1105faim_export int aim_chat_invite(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *msg, fu16_t exchange, const char *roomname, fu16_t instance);
     1106
     1107faim_export int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, fu16_t exchange);
     1108faim_export int aim_chat_leaveroom(aim_session_t *sess, const char *name);
     1109
     1110
     1111
     1112/* 0x000f - odir.c */
     1113struct aim_odir {
    10321114        char *first;
    10331115        char *last;
     
    10441126        char *region;
    10451127        char *address;
    1046         struct aim_usersearch *next;
    1047 };
    1048 
    1049 faim_export int aim_usersearch_email(aim_session_t *, const char *, const char *);
    1050 faim_export int aim_usersearch_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 *);
    1051 faim_export int aim_usersearch_interest(aim_session_t *, const char *, const char *);
    1052 
    1053 
    1054 /* These apply to exchanges as well. */
    1055 #define AIM_CHATROOM_FLAG_EVILABLE 0x0001
    1056 #define AIM_CHATROOM_FLAG_NAV_ONLY 0x0002
    1057 #define AIM_CHATROOM_FLAG_INSTANCING_ALLOWED 0x0004
    1058 #define AIM_CHATROOM_FLAG_OCCUPANT_PEEK_ALLOWED 0x0008
    1059 
    1060 struct aim_chat_exchangeinfo {
    1061         fu16_t number;
    1062         fu16_t flags;
    1063         char *name;
    1064         char *charset1;
    1065         char *lang1;
    1066         char *charset2;
    1067         char *lang2;
    1068 };
    1069 
    1070 #define AIM_CHATFLAGS_NOREFLECT 0x0001
    1071 #define AIM_CHATFLAGS_AWAY      0x0002
    1072 faim_export int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, fu16_t flags, const char *msg, int msglen);
    1073 faim_export int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance);
    1074 faim_export int aim_chat_attachname(aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance);
    1075 faim_export char *aim_chat_getname(aim_conn_t *conn);
    1076 faim_export aim_conn_t *aim_chat_getconn(aim_session_t *, const char *name);
    1077 
    1078 faim_export int aim_chatnav_reqrights(aim_session_t *sess, aim_conn_t *conn);
    1079 
    1080 faim_export int aim_chat_invite(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *msg, fu16_t exchange, const char *roomname, fu16_t instance);
    1081 
    1082 faim_export int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, fu16_t exchange);
    1083 faim_export int aim_chat_leaveroom(aim_session_t *sess, const char *name);
    1084 
    1085 
    1086 #define AIM_SSI_TYPE_BUDDY         0x0000
    1087 #define AIM_SSI_TYPE_GROUP         0x0001
    1088 #define AIM_SSI_TYPE_PERMIT        0x0002
    1089 #define AIM_SSI_TYPE_DENY          0x0003
    1090 #define AIM_SSI_TYPE_PDINFO        0x0004
    1091 #define AIM_SSI_TYPE_PRESENCEPREFS 0x0005
     1128        struct aim_odir *next;
     1129};
     1130
     1131faim_export int aim_odir_email(aim_session_t *, const char *, const char *);
     1132faim_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 *);
     1133faim_export int aim_odir_interest(aim_session_t *, const char *, const char *);
     1134
     1135
     1136
     1137/* 0x0010 - icon.c */
     1138faim_export int aim_bart_upload(aim_session_t *sess, const fu8_t *icon, fu16_t iconlen);
     1139faim_export int aim_bart_request(aim_session_t *sess, const char *sn, const fu8_t *iconstr, fu16_t iconstrlen);
     1140
     1141
     1142
     1143/* 0x0013 - ssi.c */
     1144#define AIM_SSI_TYPE_BUDDY              0x0000
     1145#define AIM_SSI_TYPE_GROUP              0x0001
     1146#define AIM_SSI_TYPE_PERMIT             0x0002
     1147#define AIM_SSI_TYPE_DENY               0x0003
     1148#define AIM_SSI_TYPE_PDINFO             0x0004
     1149#define AIM_SSI_TYPE_PRESENCEPREFS      0x0005
     1150#define AIM_SSI_TYPE_ICONINFO           0x0014
     1151
     1152#define AIM_SSI_ACK_SUCCESS             0x0000
     1153#define AIM_SSI_ACK_ITEMNOTFOUND        0x0002
     1154#define AIM_SSI_ACK_IDNUMINUSE          0x000a
     1155#define AIM_SSI_ACK_ATMAX               0x000c
     1156#define AIM_SSI_ACK_INVALIDNAME         0x000d
     1157#define AIM_SSI_ACK_AUTHREQUIRED        0x000e
    10921158
    10931159struct aim_ssi_item {
     
    10961162        fu16_t bid;
    10971163        fu16_t type;
    1098         void *data;
     1164        struct aim_tlvlist_s *data;
    10991165        struct aim_ssi_item *next;
    11001166};
    11011167
     1168struct aim_ssi_tmp {
     1169        fu16_t action;
     1170        fu16_t ack;
     1171        char *name;
     1172        struct aim_ssi_item *item;
     1173        struct aim_ssi_tmp *next;
     1174};
     1175
    11021176/* These build the actual SNACs and queue them to be sent */
    1103 faim_export int aim_ssi_reqrights(aim_session_t *sess, aim_conn_t *conn);
    1104 faim_export int aim_ssi_reqdata(aim_session_t *sess, aim_conn_t *conn, time_t localstamp, fu16_t localrev);
    1105 faim_export int aim_ssi_enable(aim_session_t *sess, aim_conn_t *conn);
    1106 faim_export int aim_ssi_addmoddel(aim_session_t *sess, aim_conn_t *conn, struct aim_ssi_item **items, unsigned int num, fu16_t subtype);
    1107 faim_export int aim_ssi_modbegin(aim_session_t *sess, aim_conn_t *conn);
    1108 faim_export int aim_ssi_modend(aim_session_t *sess, aim_conn_t *conn);
    1109 
    1110 /* These handle the local variables */
     1177/* 0x0002 */ faim_export int aim_ssi_reqrights(aim_session_t *sess);
     1178/* 0x0004 */ faim_export int aim_ssi_reqdata(aim_session_t *sess);
     1179/* 0x0005 */ faim_export int aim_ssi_reqifchanged(aim_session_t *sess, time_t localstamp, fu16_t localrev);
     1180/* 0x0007 */ faim_export int aim_ssi_enable(aim_session_t *sess);
     1181/* 0x0008 */ faim_export int aim_ssi_addmoddel(aim_session_t *sess);
     1182/* 0x0011 */ faim_export int aim_ssi_modbegin(aim_session_t *sess);
     1183/* 0x0012 */ faim_export int aim_ssi_modend(aim_session_t *sess);
     1184/* 0x0014 */ faim_export int aim_ssi_sendauth(aim_session_t *sess, char *sn, char *msg);
     1185/* 0x0018 */ faim_export int aim_ssi_sendauthrequest(aim_session_t *sess, char *sn, char *msg);
     1186/* 0x001a */ faim_export int aim_ssi_sendauthreply(aim_session_t *sess, char *sn, fu8_t reply, char *msg);
     1187
     1188/* Client functions for retrieving SSI data */
    11111189faim_export struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, fu16_t gid, fu16_t bid);
    11121190faim_export struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *sn, fu16_t type);
    1113 faim_export struct aim_ssi_item *aim_ssi_itemlist_findparent(struct aim_ssi_item *list, char *sn);
     1191faim_export struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *sn);
     1192faim_export char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *sn);
    11141193faim_export int aim_ssi_getpermdeny(struct aim_ssi_item *list);
    11151194faim_export fu32_t aim_ssi_getpresence(struct aim_ssi_item *list);
    1116 faim_export int aim_ssi_cleanlist(aim_session_t *sess, aim_conn_t *conn);
    1117 faim_export int aim_ssi_addbuddies(aim_session_t *sess, aim_conn_t *conn, const char *gn, const char **sn, unsigned int num);
    1118 faim_export int aim_ssi_addmastergroup(aim_session_t *sess, aim_conn_t *conn);
    1119 faim_export int aim_ssi_addgroups(aim_session_t *sess, aim_conn_t *conn, const char **gn, unsigned int num);
    1120 faim_export int aim_ssi_addpord(aim_session_t *sess, aim_conn_t *conn, const char **sn, unsigned int num, fu16_t type);
    1121 faim_export int aim_ssi_movebuddy(aim_session_t *sess, aim_conn_t *conn, const char *oldgn, const char *newgn, const char *sn);
    1122 faim_export int aim_ssi_rename_group(aim_session_t *sess, aim_conn_t *conn, const char *oldgn, const char *newgn);
    1123 faim_export int aim_ssi_delbuddies(aim_session_t *sess, aim_conn_t *conn, const char *gn, char **sn, unsigned int num);
    1124 faim_export int aim_ssi_delmastergroup(aim_session_t *sess, aim_conn_t *conn);
    1125 faim_export int aim_ssi_delgroups(aim_session_t *sess, aim_conn_t *conn, char **gn, unsigned int num);
    1126 faim_export int aim_ssi_deletelist(aim_session_t *sess, aim_conn_t *conn);
    1127 faim_export int aim_ssi_delpord(aim_session_t *sess, aim_conn_t *conn, const char **sn, unsigned int num, fu16_t type);
    1128 faim_export int aim_ssi_setpermdeny(aim_session_t *sess, aim_conn_t *conn, fu8_t permdeny, fu32_t vismask);
    1129 faim_export int aim_ssi_setpresence(aim_session_t *sess, aim_conn_t *conn, fu32_t presence);
     1195faim_export char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *sn);
     1196faim_export int aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *sn);
     1197
     1198/* Client functions for changing SSI data */
     1199faim_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);
     1200faim_export int aim_ssi_addpermit(aim_session_t *sess, const char *name);
     1201faim_export int aim_ssi_adddeny(aim_session_t *sess, const char *name);
     1202faim_export int aim_ssi_delbuddy(aim_session_t *sess, const char *name, const char *group);
     1203faim_export int aim_ssi_delpermit(aim_session_t *sess, const char *name);
     1204faim_export int aim_ssi_deldeny(aim_session_t *sess, const char *name);
     1205faim_export int aim_ssi_movebuddy(aim_session_t *sess, const char *oldgn, const char *newgn, const char *sn);
     1206faim_export int aim_ssi_aliasbuddy(aim_session_t *sess, const char *gn, const char *sn, const char *alias);
     1207faim_export int aim_ssi_rename_group(aim_session_t *sess, const char *oldgn, const char *newgn);
     1208faim_export int aim_ssi_cleanlist(aim_session_t *sess);
     1209faim_export int aim_ssi_deletelist(aim_session_t *sess);
     1210faim_export int aim_ssi_setpermdeny(aim_session_t *sess, fu8_t permdeny, fu32_t vismask);
     1211faim_export int aim_ssi_setpresence(aim_session_t *sess, fu32_t presence);
     1212faim_export int aim_ssi_seticon(aim_session_t *sess, fu8_t *iconsum, fu16_t iconsumlen);
     1213
     1214
     1215
     1216/* 0x0015 - icq.c */
     1217#define AIM_ICQ_INFO_SIMPLE     0x001
     1218#define AIM_ICQ_INFO_SUMMARY    0x002
     1219#define AIM_ICQ_INFO_EMAIL      0x004
     1220#define AIM_ICQ_INFO_PERSONAL   0x008
     1221#define AIM_ICQ_INFO_ADDITIONAL 0x010
     1222#define AIM_ICQ_INFO_WORK       0x020
     1223#define AIM_ICQ_INFO_INTERESTS  0x040
     1224#define AIM_ICQ_INFO_ORGS       0x080
     1225#define AIM_ICQ_INFO_UNKNOWN    0x100
     1226#define AIM_ICQ_INFO_HAVEALL    0x1ff
    11301227
    11311228struct aim_icq_offlinemsg {
     
    11331230        fu16_t year;
    11341231        fu8_t month, day, hour, minute;
    1135         fu16_t type;
     1232        fu8_t type;
     1233        fu8_t flags;
    11361234        char *msg;
    1137 };
    1138 
    1139 struct aim_icq_simpleinfo {
     1235        int msglen;
     1236};
     1237
     1238struct aim_icq_info {
     1239        fu16_t reqid;
     1240
     1241        /* simple */
    11401242        fu32_t uin;
     1243
     1244        /* general and "home" information (0x00c8) */
    11411245        char *nick;
    11421246        char *first;
    11431247        char *last;
    11441248        char *email;
     1249        char *homecity;
     1250        char *homestate;
     1251        char *homephone;
     1252        char *homefax;
     1253        char *homeaddr;
     1254        char *mobile;
     1255        char *homezip;
     1256        fu16_t homecountry;
     1257/*      fu8_t timezone;
     1258        fu8_t hideemail; */
     1259
     1260        /* personal (0x00dc) */
     1261        fu8_t age;
     1262        fu8_t unknown;
     1263        fu8_t gender;
     1264        char *personalwebpage;
     1265        fu16_t birthyear;
     1266        fu8_t birthmonth;
     1267        fu8_t birthday;
     1268        fu8_t language1;
     1269        fu8_t language2;
     1270        fu8_t language3;
     1271
     1272        /* work (0x00d2) */
     1273        char *workcity;
     1274        char *workstate;
     1275        char *workphone;
     1276        char *workfax;
     1277        char *workaddr;
     1278        char *workzip;
     1279        fu16_t workcountry;
     1280        char *workcompany;
     1281        char *workdivision;
     1282        char *workposition;
     1283        char *workwebpage;
     1284
     1285        /* additional personal information (0x00e6) */
     1286        char *info;
     1287
     1288        /* email (0x00eb) */
     1289        fu16_t numaddresses;
     1290        char **email2;
     1291
     1292        /* we keep track of these in a linked list because we're 1337 */
     1293        struct aim_icq_info *next;
    11451294};
    11461295
    11471296faim_export int aim_icq_reqofflinemsgs(aim_session_t *sess);
    11481297faim_export int aim_icq_ackofflinemsgs(aim_session_t *sess);
     1298faim_export int aim_icq_hideip(aim_session_t *sess);
     1299faim_export int aim_icq_changepasswd(aim_session_t *sess, const char *passwd);
    11491300faim_export int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin);
    1150 
    1151 /* email.c */
     1301faim_export int aim_icq_getalias(aim_session_t *sess, const char *uin);
     1302faim_export int aim_icq_getallinfo(aim_session_t *sess, const char *uin);
     1303
     1304
     1305
     1306/* 0x0017 - auth.c */
     1307faim_export int aim_sendcookie(aim_session_t *, aim_conn_t *, const fu16_t length, const fu8_t *);
     1308faim_export int aim_admin_changepasswd(aim_session_t *, aim_conn_t *, const char *newpw, const char *curpw);
     1309faim_export int aim_admin_reqconfirm(aim_session_t *sess, aim_conn_t *conn);
     1310faim_export int aim_admin_getinfo(aim_session_t *sess, aim_conn_t *conn, fu16_t info);
     1311faim_export int aim_admin_setemail(aim_session_t *sess, aim_conn_t *conn, const char *newemail);
     1312faim_export int aim_admin_setnick(aim_session_t *sess, aim_conn_t *conn, const char *newnick);
     1313
     1314
     1315
     1316/* 0x0018 - email.c */
    11521317struct aim_emailinfo {
    11531318        fu8_t *cookie16;
     
    11641329faim_export int aim_email_activate(aim_session_t *sess, aim_conn_t *conn);
    11651330
     1331
     1332
     1333/* tlv.c - TLV handling */
     1334#if defined(FAIM_INTERNAL) || defined(FAIM_NEED_TLV)
     1335/* Generic TLV structure. */
     1336typedef struct aim_tlv_s {
     1337        fu16_t type;
     1338        fu16_t length;
     1339        fu8_t *value;
     1340} aim_tlv_t;
     1341
     1342/* List of above. */
     1343typedef struct aim_tlvlist_s {
     1344        aim_tlv_t *tlv;
     1345        struct aim_tlvlist_s *next;
     1346} aim_tlvlist_t;
     1347
     1348/* TLV-handling functions */
     1349
     1350#if 0
     1351/* Very, very raw TLV handling. */
     1352faim_internal int aim_puttlv_8(fu8_t *buf, const fu16_t t, const fu8_t v);
     1353faim_internal int aim_puttlv_16(fu8_t *buf, const fu16_t t, const fu16_t v);
     1354faim_internal int aim_puttlv_32(fu8_t *buf, const fu16_t t, const fu32_t v);
     1355faim_internal int aim_puttlv_raw(fu8_t *buf, const fu16_t t, const fu16_t l, const fu8_t *v);
     1356#endif
     1357
     1358/* TLV list handling. */
     1359faim_internal aim_tlvlist_t *aim_readtlvchain(aim_bstream_t *bs);
     1360faim_internal aim_tlvlist_t *aim_readtlvchain_num(aim_bstream_t *bs, fu16_t num);
     1361faim_internal aim_tlvlist_t *aim_readtlvchain_len(aim_bstream_t *bs, fu16_t len);
     1362faim_internal aim_tlvlist_t *aim_tlvlist_copy(aim_tlvlist_t *orig);
     1363faim_internal int aim_tlvlist_cmp(aim_tlvlist_t *one, aim_tlvlist_t *two);
     1364faim_internal void aim_freetlvchain(aim_tlvlist_t **list);
     1365faim_internal aim_tlv_t *aim_gettlv(aim_tlvlist_t *, fu16_t t, const int n);
     1366faim_internal char *aim_gettlv_str(aim_tlvlist_t *, const fu16_t t, const int n);
     1367faim_internal fu8_t aim_gettlv8(aim_tlvlist_t *list, const fu16_t type, const int num);
     1368faim_internal fu16_t aim_gettlv16(aim_tlvlist_t *list, const fu16_t t, const int n);
     1369faim_internal fu32_t aim_gettlv32(aim_tlvlist_t *list, const fu16_t t, const int n);
     1370faim_internal int aim_writetlvchain(aim_bstream_t *bs, aim_tlvlist_t **list);
     1371faim_internal int aim_addtlvtochain8(aim_tlvlist_t **list, const fu16_t t, const fu8_t v);
     1372faim_internal int aim_addtlvtochain16(aim_tlvlist_t **list, const fu16_t t, const fu16_t v);
     1373faim_internal int aim_addtlvtochain32(aim_tlvlist_t **list, const fu16_t type, const fu32_t v);
     1374faim_internal int aim_addtlvtochain_raw(aim_tlvlist_t **list, const fu16_t t, const fu16_t l, const fu8_t *v);
     1375faim_internal int aim_addtlvtochain_caps(aim_tlvlist_t **list, const fu16_t t, const fu32_t caps);
     1376faim_internal int aim_addtlvtochain_noval(aim_tlvlist_t **list, const fu16_t type);
     1377faim_internal int aim_addtlvtochain_userinfo(aim_tlvlist_t **list, fu16_t type, aim_userinfo_t *ui);
     1378faim_internal int aim_addtlvtochain_frozentlvlist(aim_tlvlist_t **list, fu16_t type, aim_tlvlist_t **tl);
     1379faim_internal int aim_counttlvchain(aim_tlvlist_t **list);
     1380faim_internal int aim_sizetlvchain(aim_tlvlist_t **list);
     1381#endif /* FAIM_INTERNAL */
     1382
     1383
     1384
    11661385/* util.c */
    11671386/*
     
    11721391 *
    11731392 */
    1174 #define aimutil_put8(buf, data) ((*(buf) = (u_char)(data)&0xff),1)
     1393#define aimutil_put8(buf, data) ((*(buf) = (fu8_t)(data)&0xff),1)
    11751394#define aimutil_get8(buf) ((*(buf))&0xff)
    11761395#define aimutil_put16(buf, data) ( \
    1177                 (*(buf) = (u_char)((data)>>8)&0xff), \
    1178                 (*((buf)+1) = (u_char)(data)&0xff),  \
     1396                (*(buf) = (fu8_t)((data)>>8)&0xff), \
     1397                (*((buf)+1) = (fu8_t)(data)&0xff),  \
    11791398                2)
    11801399#define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff))
    11811400#define aimutil_put32(buf, data) ( \
    1182                 (*((buf)) = (u_char)((data)>>24)&0xff), \
    1183                 (*((buf)+1) = (u_char)((data)>>16)&0xff), \
    1184                 (*((buf)+2) = (u_char)((data)>>8)&0xff), \
    1185                 (*((buf)+3) = (u_char)(data)&0xff), \
     1401                (*((buf)) = (fu8_t)((data)>>24)&0xff), \
     1402                (*((buf)+1) = (fu8_t)((data)>>16)&0xff), \
     1403                (*((buf)+2) = (fu8_t)((data)>>8)&0xff), \
     1404                (*((buf)+3) = (fu8_t)(data)&0xff), \
    11861405                4)
    11871406#define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \
     
    11921411/* Little-endian versions (damn ICQ) */
    11931412#define aimutil_putle8(buf, data) ( \
    1194                 (*(buf) = (unsigned char)(data) & 0xff), \
     1413                (*(buf) = (fu8_t)(data) & 0xff), \
    11951414                1)
    11961415#define aimutil_getle8(buf) ( \
     
    11981417                )
    11991418#define aimutil_putle16(buf, data) ( \
    1200                 (*((buf)+0) = (unsigned char)((data) >> 0) & 0xff),  \
    1201                 (*((buf)+1) = (unsigned char)((data) >> 8) & 0xff), \
     1419                (*((buf)+0) = (fu8_t)((data) >> 0) & 0xff),  \
     1420                (*((buf)+1) = (fu8_t)((data) >> 8) & 0xff), \
    12021421                2)
    12031422#define aimutil_getle16(buf) ( \
     
    12061425                )
    12071426#define aimutil_putle32(buf, data) ( \
    1208                 (*((buf)+0) = (unsigned char)((data) >>  0) & 0xff), \
    1209                 (*((buf)+1) = (unsigned char)((data) >>  8) & 0xff), \
    1210                 (*((buf)+2) = (unsigned char)((data) >> 16) & 0xff), \
    1211                 (*((buf)+3) = (unsigned char)((data) >> 24) & 0xff), \
     1427                (*((buf)+0) = (fu8_t)((data) >>  0) & 0xff), \
     1428                (*((buf)+1) = (fu8_t)((data) >>  8) & 0xff), \
     1429                (*((buf)+2) = (fu8_t)((data) >> 16) & 0xff), \
     1430                (*((buf)+3) = (fu8_t)((data) >> 24) & 0xff), \
    12121431                4)
    12131432#define aimutil_getle32(buf) ( \
     
    12181437
    12191438
    1220 faim_export int aimutil_putstr(u_char *, const char *, int);
    1221 faim_export int aimutil_tokslen(char *toSearch, int index, char dl);
     1439faim_export int aimutil_putstr(char *, const char *, int);
     1440faim_export fu16_t aimutil_iconsum(const fu8_t *buf, int buflen);
     1441faim_export int aim_util_getlocalip(fu8_t *ip);
     1442faim_export int aimutil_tokslen(char *toSearch, int theindex, char dl);
    12221443faim_export int aimutil_itemcnt(char *toSearch, char dl);
    1223 faim_export char *aimutil_itemidx(char *toSearch, int index, char dl);
     1444faim_export char *aimutil_itemindex(char *toSearch, int theindex, char dl);
    12241445
    12251446faim_export int aim_snlen(const char *sn);
    12261447faim_export int aim_sncmp(const char *sn1, const char *sn2);
    12271448
    1228 /* for libc's that dont have it */
    1229 faim_export char *aim_strsep(char **pp, const char *delim);
    1230 
    1231 /* meta.c */
    1232 faim_export char *aim_getbuilddate(void);
    1233 faim_export char *aim_getbuildtime(void);
    1234 faim_export int aim_getbuildstring(char *buf, int buflen);
    1235 
    12361449#include <aim_internal.h>
    12371450
     1451#ifdef __cplusplus
     1452}
     1453#endif
     1454
    12381455#endif /* __AIM_H__ */
    1239 
Note: See TracChangeset for help on using the changeset viewer.