Ignore:
Timestamp:
2015-02-20T22:50:54Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
0b9daac, 3d45471, 7733b8c
Parents:
af359b4
git-author:
Indent <please@…> (19-02-15 05:47:20)
git-committer:
dequis <dx@…> (20-02-15 22:50:54)
Message:

Reindent everything to K&R style with tabs

Used uncrustify, with the configuration file in ./doc/uncrustify.cfg

Commit author set to "Indent <please@…>" so that it's easier to
skip while doing git blame.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/oscar/aim.h

    raf359b4 r5ebff60  
    1 /* 
     1/*
    22 * Main libfaim header.  Must be included in client for prototypes/macros.
    33 *
     
    2929
    3030#if defined(mach) && defined(__APPLE__)
    31 #define gethostbyname(x) gethostbyname2(x, AF_INET) 
     31#define gethostbyname(x) gethostbyname2(x, AF_INET)
    3232#endif
    3333
    34 /* 
    35  * Current Maximum Length for Screen Names (not including NULL) 
     34/*
     35 * Current Maximum Length for Screen Names (not including NULL)
    3636 *
    3737 * Currently only names up to 16 characters can be registered
     
    5353 *
    5454 * XXX: the real limit is the total SNAC size at 8192. Fix this.
    55  * 
     55 *
    5656 */
    5757#define MAXMSGLEN 7987
     
    6767 *
    6868 * This is actually defined by the protocol to be
    69  * dynamic, but I have yet to see due cause to 
     69 * dynamic, but I have yet to see due cause to
    7070 * define it dynamically here.  Maybe later.
    7171 *
     
    8181
    8282/*
    83  * Default Authorizer server name and TCP port for the OSCAR farm. 
     83 * Default Authorizer server name and TCP port for the OSCAR farm.
    8484 *
    8585 * You shouldn't need to change this unless you're writing
    86  * your own server. 
     86 * your own server.
    8787 *
    8888 * Note that only one server is needed to start the whole
     
    107107
    108108/*
    109  * Client info.  Filled in by the client and passed in to 
     109 * Client info.  Filled in by the client and passed in to
    110110 * aim_send_login().  The information ends up getting passed to OSCAR
    111111 * through the initial login command.
     
    124124
    125125#define AIM_CLIENTINFO_KNOWNGOOD_3_5_1670 { \
    126         "AOL Instant Messenger (SM), version 3.5.1670/WIN32", \
    127         0x0004, \
    128         0x0003, \
    129         0x0005, \
    130         0x0000, \
    131         0x0686, \
    132         "us", \
    133         "en", \
     126                "AOL Instant Messenger (SM), version 3.5.1670/WIN32", \
     127                0x0004, \
     128                0x0003, \
     129                0x0005, \
     130                0x0000, \
     131                0x0686, \
     132                "us", \
     133                "en", \
    134134}
    135135
    136136#define AIM_CLIENTINFO_KNOWNGOOD_4_1_2010 { \
    137           "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \
    138           0x0004, \
    139           0x0004, \
    140           0x0001, \
    141           0x0000, \
    142           0x07da, \
    143           "us", \
    144           "en", \
     137                "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \
     138                0x0004, \
     139                0x0004, \
     140                0x0001, \
     141                0x0000, \
     142                0x07da, \
     143                "us", \
     144                "en", \
    145145}
    146146
    147147#define AIM_CLIENTINFO_KNOWNGOOD_5_1_3036 { \
    148         "AOL Instant Messenger, version 5.1.3036/WIN32", \
    149         0x0109, \
    150         0x0005, \
    151         0x0001, \
    152         0x0000, \
    153         0x0bdc, \
    154         "us", \
    155         "en", \
     148                "AOL Instant Messenger, version 5.1.3036/WIN32", \
     149                0x0109, \
     150                0x0005, \
     151                0x0001, \
     152                0x0000, \
     153                0x0bdc, \
     154                "us", \
     155                "en", \
    156156}
    157157
    158158/*
    159159 * I would make 4.1.2010 the default, but they seem to have found
    160  * an alternate way of breaking that one. 
     160 * an alternate way of breaking that one.
    161161 *
    162162 * 3.5.1670 should work fine, however, you will be subjected to the
    163  * memory test, which may require you to have a WinAIM binary laying 
     163 * memory test, which may require you to have a WinAIM binary laying
    164164 * around. (see login.c::memrequest())
    165165 */
     
    171171#endif
    172172
    173 /* 
    174  * These could be arbitrary, but its easier to use the actual AIM values 
     173/*
     174 * These could be arbitrary, but its easier to use the actual AIM values
    175175 */
    176176#define AIM_CONN_TYPE_AUTH          0x0007
     
    207207#define AIM_MTYPE_CONTACTS  0x13
    208208#define AIM_MTYPE_PLUGIN    0x1A
    209 #define AIM_MTYPE_AUTOAWAY      0xE8
    210 #define AIM_MTYPE_AUTOBUSY      0xE9
    211 #define AIM_MTYPE_AUTONA        0xEA
    212 #define AIM_MTYPE_AUTODND       0xEB
    213 #define AIM_MTYPE_AUTOFFC       0xEC
     209#define AIM_MTYPE_AUTOAWAY      0xE8
     210#define AIM_MTYPE_AUTOBUSY      0xE9
     211#define AIM_MTYPE_AUTONA        0xEA
     212#define AIM_MTYPE_AUTODND       0xEB
     213#define AIM_MTYPE_AUTOFFC       0xEC
    214214
    215215typedef struct aim_conn_s {
     
    222222        void *internal; /* internal conn-specific libfaim data */
    223223        time_t lastactivity; /* time of last transmit */
    224         int forcedlatency; 
     224        int forcedlatency;
    225225        void *handlerlist;
    226226        void *sessv; /* pointer to parent session */
     
    252252        guint8 hdrtype; /* defines which piece of the union to use */
    253253        union {
    254                 struct { 
     254                struct {
    255255                        guint8 type;
    256                         flap_seqnum_t seqnum;     
     256                        flap_seqnum_t seqnum;
    257257                } flap;
    258258        } hdr;
    259         aim_bstream_t data;     /* payload stream */
    260         guint8 handled;         /* 0 = new, !0 = been handled */
    261         guint8 nofree;          /* 0 = free data on purge, 1 = only unlink */
     259        aim_bstream_t data;     /* payload stream */
     260        guint8 handled;         /* 0 = new, !0 = been handled */
     261        guint8 nofree;          /* 0 = free data on purge, 1 = only unlink */
    262262        aim_conn_t *conn;  /* the connection it came in on... */
    263263        struct aim_frame_s *next;
     
    273273
    274274/*
    275  * AIM Session: The main client-data interface. 
     275 * AIM Session: The main client-data interface.
    276276 *
    277277 */
     
    281281
    282282        /* Our screen name. */
    283         char sn[MAXSNLEN+1];
     283        char sn[MAXSNLEN + 1];
    284284
    285285        /*
    286          * Pointer to anything the client wants to 
     286         * Pointer to anything the client wants to
    287287         * explicitly associate with this session.
    288288         *
     
    314314         * I/O.  I don't suggest that you use libfaim's internal I/O.
    315315         * Its really bad and the API/event model is quirky at best.
    316          * 
     316         *
    317317         */
    318         aim_frame_t *queue_outgoing;   
    319         aim_frame_t *queue_incoming; 
     318        aim_frame_t *queue_outgoing;
     319        aim_frame_t *queue_incoming;
    320320
    321321        /*
     
    330330
    331331        /*
    332          * Outstanding snac handling 
     332         * Outstanding snac handling
    333333         *
    334334         * XXX: Should these be per-connection? -mid
     
    384384 */
    385385typedef struct {
    386         char sn[MAXSNLEN+1];
     386        char sn[MAXSNLEN + 1];
    387387        guint16 warnlevel;
    388388        guint16 idletime;
     
    390390        guint32 membersince;
    391391        guint32 onlinesince;
    392         guint32 sessionlen; 
     392        guint32 sessionlen;
    393393        guint32 capabilities;
    394394        struct {
     
    410410#define AIM_USERINFO_PRESENT_SESSIONLEN   0x00000100
    411411
    412 #define AIM_FLAG_UNCONFIRMED    0x0001 /* "damned transients" */
    413 #define AIM_FLAG_ADMINISTRATOR  0x0002
    414 #define AIM_FLAG_AOL            0x0004
    415 #define AIM_FLAG_OSCAR_PAY      0x0008
    416 #define AIM_FLAG_FREE           0x0010
    417 #define AIM_FLAG_AWAY           0x0020
    418 #define AIM_FLAG_ICQ            0x0040
    419 #define AIM_FLAG_WIRELESS       0x0080
    420 #define AIM_FLAG_UNKNOWN100     0x0100
    421 #define AIM_FLAG_UNKNOWN200     0x0200
     412#define AIM_FLAG_UNCONFIRMED    0x0001 /* "damned transients" */
     413#define AIM_FLAG_ADMINISTRATOR  0x0002
     414#define AIM_FLAG_AOL            0x0004
     415#define AIM_FLAG_OSCAR_PAY      0x0008
     416#define AIM_FLAG_FREE           0x0010
     417#define AIM_FLAG_AWAY           0x0020
     418#define AIM_FLAG_ICQ            0x0040
     419#define AIM_FLAG_WIRELESS       0x0080
     420#define AIM_FLAG_UNKNOWN100     0x0100
     421#define AIM_FLAG_UNKNOWN200     0x0200
    422422#define AIM_FLAG_ACTIVEBUDDY    0x0400
    423 #define AIM_FLAG_UNKNOWN800     0x0800
     423#define AIM_FLAG_UNKNOWN800     0x0800
    424424#define AIM_FLAG_ABINTERNAL     0x1000
    425425
    426 #define AIM_FLAG_ALLUSERS       0x001f
     426#define AIM_FLAG_ALLUSERS       0x001f
    427427
    428428/*
     
    468468int aim_addtlvtochain_caps(aim_tlvlist_t **list, const guint16 t, const guint32 caps);
    469469int aim_addtlvtochain_noval(aim_tlvlist_t **list, const guint16 type);
    470 int aim_addtlvtochain_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance);
     470int aim_addtlvtochain_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname,
     471                               guint16 instance);
    471472int aim_addtlvtochain_userinfo(aim_tlvlist_t **list, guint16 type, aim_userinfo_t *ui);
    472473int aim_addtlvtochain_frozentlvlist(aim_tlvlist_t **list, guint16 type, aim_tlvlist_t **tl);
     
    543544void aim_conn_kill(aim_session_t *sess, aim_conn_t **deadconn);
    544545
    545 int aim_conn_addhandler(aim_session_t *, aim_conn_t *conn, u_short family, u_short type, aim_rxcallback_t newhandler, u_short flags);
     546int aim_conn_addhandler(aim_session_t *, aim_conn_t *conn, u_short family, u_short type, aim_rxcallback_t newhandler,
     547                        u_short flags);
    546548int aim_clearhandlers(aim_conn_t *conn);
    547549
     
    558560
    559561typedef void (*faim_debugging_callback_t)(aim_session_t *sess, int level, const char *format, va_list va);
    560 int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t);
     562int aim_setdebuggingcb(aim_session_t * sess, faim_debugging_callback_t);
    561563void aim_session_init(aim_session_t *, guint32 flags, int debuglevel);
    562564void aim_session_kill(aim_session_t *);
     
    618620/* aim_im.c */
    619621
    620 aim_conn_t *aim_sendfile_initiate(aim_session_t *, const char *destsn, const char *filename, guint16 numfiles, guint32 totsize);
     622aim_conn_t *aim_sendfile_initiate(aim_session_t *, const char *destsn, const char *filename, guint16 numfiles,
     623                                  guint32 totsize);
    621624
    622625aim_conn_t *aim_getfile_initiate(aim_session_t *sess, aim_conn_t *conn, const char *destsn);
     
    653656#define AIM_TRANSFER_DENY_DECLINE 0x0001
    654657#define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002
    655 aim_conn_t *aim_accepttransfer(aim_session_t *sess, aim_conn_t *conn, const char *sn, const guint8 *cookie, const guint8 *ip, guint16 listingfiles, guint16 listingtotsize, guint16 listingsize, guint32 listingchecksum, guint16 rendid);
     658aim_conn_t *aim_accepttransfer(aim_session_t *sess, aim_conn_t *conn, const char *sn, const guint8 *cookie,
     659                               const guint8 *ip, guint16 listingfiles, guint16 listingtotsize, guint16 listingsize,
     660                               guint32 listingchecksum, guint16 rendid);
    656661
    657662int aim_getinfo(aim_session_t *, aim_conn_t *, const char *, unsigned short);
    658663
    659 #define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED       0x00000001
    660 #define AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED    0x00000002
     664#define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED       0x00000001
     665#define AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED    0x00000002
    661666
    662667/* This is what the server will give you if you don't set them yourself. */
    663668#define AIM_IMPARAM_DEFAULTS { \
    664         0, \
    665         AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
    666         512, /* !! Note how small this is. */ \
    667         (99.9)*10, (99.9)*10, \
    668         1000 /* !! And how large this is. */ \
     669                0, \
     670                AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
     671                512, /* !! Note how small this is. */ \
     672                (99.9) * 10, (99.9) * 10, \
     673                1000 /* !! And how large this is. */ \
    669674}
    670675
    671676/* This is what most AIM versions use. */
    672677#define AIM_IMPARAM_REASONABLE { \
    673         0, \
    674         AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
    675         8000, \
    676         (99.9)*10, (99.9)*10, \
    677         0 \
     678                0, \
     679                AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
     680                8000, \
     681                (99.9) * 10, (99.9) * 10, \
     682                0 \
    678683}
    679684
     
    716721};
    717722
    718 #define AIM_CHATFLAGS_NOREFLECT         0x0001
    719 #define AIM_CHATFLAGS_AWAY              0x0002
    720 #define AIM_CHATFLAGS_UNICODE           0x0004
    721 #define AIM_CHATFLAGS_ISO_8859_1        0x0008
     723#define AIM_CHATFLAGS_NOREFLECT         0x0001
     724#define AIM_CHATFLAGS_AWAY              0x0002
     725#define AIM_CHATFLAGS_UNICODE           0x0004
     726#define AIM_CHATFLAGS_ISO_8859_1        0x0008
    722727
    723728int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const char *msg, int msglen);
     
    726731int aim_chatnav_reqrights(aim_session_t *sess, aim_conn_t *conn);
    727732
    728 int aim_chat_invite(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *msg, guint16 exchange, const char *roomname, guint16 instance);
     733int aim_chat_invite(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *msg, guint16 exchange,
     734                    const char *roomname, guint16 instance);
    729735
    730736int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, guint16 exchange);
     
    738744 *
    739745 */
    740 #define aimutil_put8(buf, data) ((*(buf) = (u_char)(data)&0xff),1)
    741 #define aimutil_get8(buf) ((*(buf))&0xff)
     746#define aimutil_put8(buf, data) ((*(buf) = (u_char) (data) & 0xff), 1)
     747#define aimutil_get8(buf) ((*(buf)) & 0xff)
    742748#define aimutil_put16(buf, data) ( \
    743                 (*(buf) = (u_char)((data)>>8)&0xff), \
    744                 (*((buf)+1) = (u_char)(data)&0xff),  \
    745                 2)
    746 #define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff))
     749                (*(buf) = (u_char) ((data) >> 8) & 0xff), \
     750                (*((buf) + 1) = (u_char) (data) & 0xff),  \
     751                2)
     752#define aimutil_get16(buf) ((((*(buf)) << 8) & 0xff00) + ((*((buf) + 1)) & 0xff))
    747753#define aimutil_put32(buf, data) ( \
    748                 (*((buf)) = (u_char)((data)>>24)&0xff), \
    749                 (*((buf)+1) = (u_char)((data)>>16)&0xff), \
    750                 (*((buf)+2) = (u_char)((data)>>8)&0xff), \
    751                 (*((buf)+3) = (u_char)(data)&0xff), \
    752                 4)
    753 #define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \
    754                 (((*((buf)+1))<<16)&0x00ff0000) + \
    755                 (((*((buf)+2))<< 8)&0x0000ff00) + \
    756                 (((*((buf)+3)    )&0x000000ff)))
     754                (*((buf)) = (u_char) ((data) >> 24) & 0xff), \
     755                (*((buf) + 1) = (u_char) ((data) >> 16) & 0xff), \
     756                (*((buf) + 2) = (u_char) ((data) >> 8) & 0xff), \
     757                (*((buf) + 3) = (u_char) (data) & 0xff), \
     758                4)
     759#define aimutil_get32(buf) ((((*(buf)) << 24) & 0xff000000) + \
     760                            (((*((buf) + 1)) << 16) & 0x00ff0000) + \
     761                            (((*((buf) + 2)) << 8) & 0x0000ff00) + \
     762                            (((*((buf) + 3)) & 0x000000ff)))
    757763
    758764/* Little-endian versions (damn ICQ) */
    759765#define aimutil_putle8(buf, data) ( \
    760                 (*(buf) = (unsigned char)(data) & 0xff), \
    761                 1)
     766                (*(buf) = (unsigned char) (data) & 0xff), \
     767                1)
    762768#define aimutil_getle8(buf) ( \
    763                 (*(buf)) & 0xff \
    764                 )
     769                (*(buf)) & 0xff \
     770                )
    765771#define aimutil_putle16(buf, data) ( \
    766                 (*((buf)+0) = (unsigned char)((data) >> 0) & 0xff),  \
    767                 (*((buf)+1) = (unsigned char)((data) >> 8) & 0xff), \
    768                 2)
     772                (*((buf) + 0) = (unsigned char) ((data) >> 0) & 0xff),  \
     773                (*((buf) + 1) = (unsigned char) ((data) >> 8) & 0xff), \
     774                2)
    769775#define aimutil_getle16(buf) ( \
    770                 (((*((buf)+0)) << 0) & 0x00ff) + \
    771                 (((*((buf)+1)) << 8) & 0xff00) \
    772                 )
     776                (((*((buf) + 0)) << 0) & 0x00ff) + \
     777                (((*((buf) + 1)) << 8) & 0xff00) \
     778                )
    773779#define aimutil_putle32(buf, data) ( \
    774                 (*((buf)+0) = (unsigned char)((data) >>  0) & 0xff), \
    775                 (*((buf)+1) = (unsigned char)((data) >>  8) & 0xff), \
    776                 (*((buf)+2) = (unsigned char)((data) >> 16) & 0xff), \
    777                 (*((buf)+3) = (unsigned char)((data) >> 24) & 0xff), \
    778                 4)
     780                (*((buf) + 0) = (unsigned char) ((data) >>  0) & 0xff), \
     781                (*((buf) + 1) = (unsigned char) ((data) >>  8) & 0xff), \
     782                (*((buf) + 2) = (unsigned char) ((data) >> 16) & 0xff), \
     783                (*((buf) + 3) = (unsigned char) ((data) >> 24) & 0xff), \
     784                4)
    779785#define aimutil_getle32(buf) ( \
    780                 (((*((buf)+0)) <<  0) & 0x000000ff) + \
    781                 (((*((buf)+1)) <<  8) & 0x0000ff00) + \
    782                 (((*((buf)+2)) << 16) & 0x00ff0000) + \
    783                 (((*((buf)+3)) << 24) & 0xff000000))
     786                (((*((buf) + 0)) <<  0) & 0x000000ff) + \
     787                (((*((buf) + 1)) <<  8) & 0x0000ff00) + \
     788                (((*((buf) + 2)) << 16) & 0x00ff0000) + \
     789                (((*((buf) + 3)) << 24) & 0xff000000))
    784790
    785791
     
    797803/*
    798804 * SNAC Family: Ack.
    799  * 
     805 *
    800806 * Not really a family, but treating it as one really
    801807 * helps it fit into the libfaim callback structure better.
     
    806812/*
    807813 * SNAC Family: General.
    808  */ 
     814 */
    809815#define AIM_CB_GEN_ERROR 0x0001
    810816#define AIM_CB_GEN_CLIENTREADY 0x0002
     
    831837/*
    832838 * SNAC Family: Advertisement Services
    833  */ 
     839 */
    834840#define AIM_CB_ADS_ERROR 0x0001
    835841#define AIM_CB_ADS_DEFAULT 0xffff
     
    840846 * See non-SNAC note below.
    841847 */
    842 #define AIM_CB_OFT_DIRECTIMCONNECTREQ 0x0001/* connect request -- actually an OSCAR CAP*/
     848#define AIM_CB_OFT_DIRECTIMCONNECTREQ 0x0001 /* connect request -- actually an OSCAR CAP*/
    843849#define AIM_CB_OFT_DIRECTIMINCOMING 0x0002
    844850#define AIM_CB_OFT_DIRECTIMDISCONNECT 0x0003
     
    869875 * the SNAC-centered libfaim callback structure.
    870876 *
    871  */ 
     877 */
    872878#define AIM_CB_SPECIAL_AUTHSUCCESS 0x0001
    873879#define AIM_CB_SPECIAL_AUTHOTHER 0x0002
Note: See TracChangeset for help on using the changeset viewer.