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/chatnav.c

    raf359b4 r5ebff60  
    33 *
    44 * [The ChatNav(igation) service does various things to keep chat
    5  *  alive.  It provides room information, room searching and creating, 
     5 *  alive.  It provides room information, room searching and creating,
    66 *  as well as giving users the right ("permission") to use chat.]
    77 *
     
    2121int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, guint16 exchange)
    2222{
    23         static const char ck[] = {"create"};
    24         static const char lang[] = {"en"};
    25         static const char charset[] = {"us-ascii"};
     23        static const char ck[] = { "create" };
     24        static const char lang[] = { "en" };
     25        static const char charset[] = { "us-ascii" };
    2626        aim_frame_t *fr;
    2727        aim_snacid_t snacid;
    2828        aim_tlvlist_t *tl = NULL;
    2929
    30         if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152)))
     30        if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) {
    3131                return -ENOMEM;
     32        }
    3233
    3334        snacid = aim_cachesnac(sess, 0x000d, 0x0008, 0x0000, NULL, 0);
     
    4041         * This looks to be a big hack.  You'll note that this entire
    4142         * SNAC is just a room info structure, but the hard room name,
    42          * here, is set to "create". 
     43         * here, is set to "create".
    4344         *
    4445         * Either this goes on the "list of questions concerning
     
    4950         */
    5051        aimbs_put8(&fr->data, strlen(ck));
    51         aimbs_putraw(&fr->data, (guint8 *)ck, strlen(ck));
    52 
    53         /* 
     52        aimbs_putraw(&fr->data, (guint8 *) ck, strlen(ck));
     53
     54        /*
    5455         * instance
    55          * 
     56         *
    5657         * Setting this to 0xffff apparently assigns the last instance.
    5758         *
     
    6263        aimbs_put8(&fr->data, 0x01);
    6364
    64         aim_addtlvtochain_raw(&tl, 0x00d3, strlen(name), (guint8 *)name);
    65         aim_addtlvtochain_raw(&tl, 0x00d6, strlen(charset), (guint8 *)charset);
    66         aim_addtlvtochain_raw(&tl, 0x00d7, strlen(lang), (guint8 *)lang);
     65        aim_addtlvtochain_raw(&tl, 0x00d3, strlen(name), (guint8 *) name);
     66        aim_addtlvtochain_raw(&tl, 0x00d6, strlen(charset), (guint8 *) charset);
     67        aim_addtlvtochain_raw(&tl, 0x00d7, strlen(lang), (guint8 *) lang);
    6768
    6869        /* tlvcount */
     
    7778}
    7879
    79 static int parseinfo_perms(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs, aim_snac_t *snac2)
     80static int parseinfo_perms(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac,
     81                           aim_bstream_t *bs, aim_snac_t *snac2)
    8082{
    8183        aim_rxcallback_t userfunc;
     
    8991        tlvlist = aim_readtlvchain(bs);
    9092
    91         /* 
     93        /*
    9294         * Type 0x0002: Maximum concurrent rooms.
    93          */ 
    94         if (aim_gettlv(tlvlist, 0x0002, 1))
     95         */
     96        if (aim_gettlv(tlvlist, 0x0002, 1)) {
    9597                maxrooms = aim_gettlv8(tlvlist, 0x0002, 1);
    96 
    97         /*
     98        }
     99
     100        /*
    98101         * Type 0x0003: Exchange information
    99102         *
    100103         * There can be any number of these, each one
    101          * representing another exchange. 
    102          * 
    103          */
    104         for (curexchange = 0; ((exchangetlv = aim_gettlv(tlvlist, 0x0003, curexchange+1))); ) {
     104         * representing another exchange.
     105         *
     106         */
     107        for (curexchange = 0; ((exchangetlv = aim_gettlv(tlvlist, 0x0003, curexchange + 1))); ) {
    105108                aim_bstream_t tbs;
    106109
     
    112115
    113116                /* exchange number */
    114                 exchanges[curexchange-1].number = aimbs_get16(&tbs);
     117                exchanges[curexchange - 1].number = aimbs_get16(&tbs);
    115118                innerlist = aim_readtlvchain(&tbs);
    116119
    117                 /* 
     120                /*
    118121                 * Type 0x000a: Unknown.
    119122                 *
     
    121124                 *
    122125                 */
    123                 if (aim_gettlv(innerlist, 0x000a, 1))
    124                         ;
    125 
    126                 /*
     126                if (aim_gettlv(innerlist, 0x000a, 1)) {
     127                        ;
     128                }
     129
     130                /*
    127131                 * Type 0x000d: Unknown.
    128132                 */
    129                 if (aim_gettlv(innerlist, 0x000d, 1))
    130                         ;
    131 
    132                 /*
     133                if (aim_gettlv(innerlist, 0x000d, 1)) {
     134                        ;
     135                }
     136
     137                /*
    133138                 * Type 0x0004: Unknown
    134139                 */
    135                 if (aim_gettlv(innerlist, 0x0004, 1))
    136                         ;
    137 
    138                 /*
     140                if (aim_gettlv(innerlist, 0x0004, 1)) {
     141                        ;
     142                }
     143
     144                /*
    139145                 * Type 0x0002: Unknown
    140146                 */
    141                 if (aim_gettlv(innerlist, 0x0002, 1))
    142                         ;
     147                if (aim_gettlv(innerlist, 0x0002, 1)) {
     148                        ;
     149                }
    143150
    144151                /*
     
    150157                 * 8 Occupant Peek Allowed
    151158                 *
    152                  */
    153                 if (aim_gettlv(innerlist, 0x00c9, 1))
    154                         exchanges[curexchange-1].flags = aim_gettlv16(innerlist, 0x00c9, 1);
    155                      
    156                 /*
    157                  * Type 0x00ca: Creation Date
    158                  */
    159                 if (aim_gettlv(innerlist, 0x00ca, 1))
    160                         ;
    161                      
     159                 */
     160                if (aim_gettlv(innerlist, 0x00c9, 1)) {
     161                        exchanges[curexchange - 1].flags = aim_gettlv16(innerlist, 0x00c9, 1);
     162                }
     163
     164                /*
     165                 * Type 0x00ca: Creation Date
     166                 */
     167                if (aim_gettlv(innerlist, 0x00ca, 1)) {
     168                        ;
     169                }
     170
    162171                /*
    163172                 * Type 0x00d0: Mandatory Channels?
    164173                 */
    165                 if (aim_gettlv(innerlist, 0x00d0, 1))
    166                         ;
     174                if (aim_gettlv(innerlist, 0x00d0, 1)) {
     175                        ;
     176                }
    167177
    168178                /*
    169179                 * Type 0x00d1: Maximum Message length
    170180                 */
    171                 if (aim_gettlv(innerlist, 0x00d1, 1))
    172                         ;
     181                if (aim_gettlv(innerlist, 0x00d1, 1)) {
     182                        ;
     183                }
    173184
    174185                /*
    175186                 * Type 0x00d2: Maximum Occupancy?
    176187                 */
    177                 if (aim_gettlv(innerlist, 0x00d2, 1))   
    178                         ;
     188                if (aim_gettlv(innerlist, 0x00d2, 1)) {
     189                        ;
     190                }
    179191
    180192                /*
    181193                 * Type 0x00d3: Exchange Description
    182194                 */
    183                 if (aim_gettlv(innerlist, 0x00d3, 1))   
    184                         exchanges[curexchange-1].name = aim_gettlv_str(innerlist, 0x00d3, 1);
    185                 else
    186                         exchanges[curexchange-1].name = NULL;
     195                if (aim_gettlv(innerlist, 0x00d3, 1)) {
     196                        exchanges[curexchange - 1].name = aim_gettlv_str(innerlist, 0x00d3, 1);
     197                } else {
     198                        exchanges[curexchange - 1].name = NULL;
     199                }
    187200
    188201                /*
    189202                 * Type 0x00d4: Exchange Description URL
    190203                 */
    191                 if (aim_gettlv(innerlist, 0x00d4, 1))   
    192                         ;
     204                if (aim_gettlv(innerlist, 0x00d4, 1)) {
     205                        ;
     206                }
    193207
    194208                /*
     
    198212                 * 1  Room creation allowed
    199213                 * 2  Exchange creation allowed
    200                  * 
     214                 *
    201215                 */
    202216                if (aim_gettlv(innerlist, 0x00d5, 1)) {
     
    206220                /*
    207221                 * Type 0x00d6: Character Set (First Time)
    208                  */           
    209                 if (aim_gettlv(innerlist, 0x00d6, 1))   
    210                         exchanges[curexchange-1].charset1 = aim_gettlv_str(innerlist, 0x00d6, 1);
    211                 else
    212                         exchanges[curexchange-1].charset1 = NULL;
    213                      
     222                 */
     223                if (aim_gettlv(innerlist, 0x00d6, 1)) {
     224                        exchanges[curexchange - 1].charset1 = aim_gettlv_str(innerlist, 0x00d6, 1);
     225                } else {
     226                        exchanges[curexchange - 1].charset1 = NULL;
     227                }
     228
    214229                /*
    215230                 * Type 0x00d7: Language (First Time)
    216                  */           
    217                 if (aim_gettlv(innerlist, 0x00d7, 1))   
    218                         exchanges[curexchange-1].lang1 = aim_gettlv_str(innerlist, 0x00d7, 1);
    219                 else
    220                         exchanges[curexchange-1].lang1 = NULL;
     231                 */
     232                if (aim_gettlv(innerlist, 0x00d7, 1)) {
     233                        exchanges[curexchange - 1].lang1 = aim_gettlv_str(innerlist, 0x00d7, 1);
     234                } else {
     235                        exchanges[curexchange - 1].lang1 = NULL;
     236                }
    221237
    222238                /*
    223239                 * Type 0x00d8: Character Set (Second Time)
    224                  */           
    225                 if (aim_gettlv(innerlist, 0x00d8, 1))   
    226                         exchanges[curexchange-1].charset2 = aim_gettlv_str(innerlist, 0x00d8, 1);
    227                 else
    228                         exchanges[curexchange-1].charset2 = NULL;
     240                 */
     241                if (aim_gettlv(innerlist, 0x00d8, 1)) {
     242                        exchanges[curexchange - 1].charset2 = aim_gettlv_str(innerlist, 0x00d8, 1);
     243                } else {
     244                        exchanges[curexchange - 1].charset2 = NULL;
     245                }
    229246
    230247                /*
    231248                 * Type 0x00d9: Language (Second Time)
    232                  */           
    233                 if (aim_gettlv(innerlist, 0x00d9, 1))   
    234                         exchanges[curexchange-1].lang2 = aim_gettlv_str(innerlist, 0x00d9, 1);
    235                 else
    236                         exchanges[curexchange-1].lang2 = NULL;
    237                      
     249                 */
     250                if (aim_gettlv(innerlist, 0x00d9, 1)) {
     251                        exchanges[curexchange - 1].lang2 = aim_gettlv_str(innerlist, 0x00d9, 1);
     252                } else {
     253                        exchanges[curexchange - 1].lang2 = NULL;
     254                }
     255
    238256                /*
    239257                 * Type 0x00da: Unknown
    240258                 */
    241                 if (aim_gettlv(innerlist, 0x00da, 1))   
    242                         ;
     259                if (aim_gettlv(innerlist, 0x00da, 1)) {
     260                        ;
     261                }
    243262
    244263                aim_freetlvchain(&innerlist);
     
    248267         * Call client.
    249268         */
    250         if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
     269        if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
    251270                ret = userfunc(sess, rx, snac2->type, maxrooms, curexchange, exchanges);
     271        }
    252272
    253273        for (curexchange--; curexchange >= 0; curexchange--) {
     
    264284}
    265285
    266 static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs, aim_snac_t *snac2)
     286static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac,
     287                            aim_bstream_t *bs, aim_snac_t *snac2)
    267288{
    268289        aim_rxcallback_t userfunc;
     
    281302        if (!(bigblock = aim_gettlv(tlvlist, 0x0004, 1))) {
    282303                imcb_error(sess->aux_data, "no bigblock in top tlv in create room response");
    283        
     304
    284305                aim_freetlvchain(&tlvlist);
    285306                return 0;
     
    305326        innerlist = aim_readtlvchain(&bbbs);
    306327
    307         if (aim_gettlv(innerlist, 0x006a, 1))
     328        if (aim_gettlv(innerlist, 0x006a, 1)) {
    308329                fqcn = aim_gettlv_str(innerlist, 0x006a, 1);
    309 
    310         if (aim_gettlv(innerlist, 0x00c9, 1))
     330        }
     331
     332        if (aim_gettlv(innerlist, 0x00c9, 1)) {
    311333                flags = aim_gettlv16(innerlist, 0x00c9, 1);
    312 
    313         if (aim_gettlv(innerlist, 0x00ca, 1))
     334        }
     335
     336        if (aim_gettlv(innerlist, 0x00ca, 1)) {
    314337                createtime = aim_gettlv32(innerlist, 0x00ca, 1);
    315 
    316         if (aim_gettlv(innerlist, 0x00d1, 1))
     338        }
     339
     340        if (aim_gettlv(innerlist, 0x00d1, 1)) {
    317341                maxmsglen = aim_gettlv16(innerlist, 0x00d1, 1);
    318 
    319         if (aim_gettlv(innerlist, 0x00d2, 1))
     342        }
     343
     344        if (aim_gettlv(innerlist, 0x00d2, 1)) {
    320345                maxoccupancy = aim_gettlv16(innerlist, 0x00d2, 1);
    321 
    322         if (aim_gettlv(innerlist, 0x00d3, 1))
     346        }
     347
     348        if (aim_gettlv(innerlist, 0x00d3, 1)) {
    323349                name = aim_gettlv_str(innerlist, 0x00d3, 1);
    324 
    325         if (aim_gettlv(innerlist, 0x00d5, 1))
     350        }
     351
     352        if (aim_gettlv(innerlist, 0x00d5, 1)) {
    326353                createperms = aim_gettlv8(innerlist, 0x00d5, 1);
     354        }
    327355
    328356        if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
    329                 ret = userfunc(sess, rx, snac2->type, fqcn, instance, exchange, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck);
     357                ret = userfunc(sess, rx, snac2->type, fqcn, instance, exchange, flags, createtime, maxmsglen,
     358                               maxoccupancy, createperms, unknown, name, ck);
    330359        }
    331360
     
    340369
    341370/*
    342  * Since multiple things can trigger this callback, we must lookup the 
     371 * Since multiple things can trigger this callback, we must lookup the
    343372 * snacid to determine the original snac subtype that was called.
    344373 *
     
    350379 *    Nav Short Desc = 8
    351380 *    Nav Instance Info = 16
    352  * And then everything is really asynchronous.  There is no specific 
     381 * And then everything is really asynchronous.  There is no specific
    353382 * attachment of a response to a create room request, for example.  Creating
    354383 * the room yields no different a response than requesting the room's info.
     
    373402         * We now know what the original SNAC subtype was.
    374403         */
    375         if (snac2->type == 0x0002) /* request chat rights */
     404        if (snac2->type == 0x0002) { /* request chat rights */
    376405                ret = parseinfo_perms(sess, mod, rx, snac, bs, snac2);
    377         else if (snac2->type == 0x0003) {} /* request exchange info */
    378         else if (snac2->type == 0x0004) {} /* request room info */
    379         else if (snac2->type == 0x0005) {} /* request more room info */
    380         else if (snac2->type == 0x0006) {} /* request occupant list */
    381         else if (snac2->type == 0x0007) {} /* search for a room */
    382         else if (snac2->type == 0x0008) /* create room */
     406        } else if (snac2->type == 0x0003) {
     407        }                                  /* request exchange info */
     408        else if (snac2->type == 0x0004) {
     409        }                                  /* request room info */
     410        else if (snac2->type == 0x0005) {
     411        }                                  /* request more room info */
     412        else if (snac2->type == 0x0006) {
     413        }                                  /* request occupant list */
     414        else if (snac2->type == 0x0007) {
     415        }                                  /* search for a room */
     416        else if (snac2->type == 0x0008) { /* create room */
    383417                ret = parseinfo_create(sess, mod, rx, snac, bs, snac2);
    384         else
     418        } else {
    385419                imcb_error(sess->aux_data, "unknown request subtype");
    386 
    387         if (snac2)
     420        }
     421
     422        if (snac2) {
    388423                g_free(snac2->data);
     424        }
    389425        g_free(snac2);
    390426
     
    395431{
    396432
    397         if (snac->subtype == 0x0009)
     433        if (snac->subtype == 0x0009) {
    398434                return parseinfo(sess, mod, rx, snac, bs);
     435        }
    399436
    400437        return 0;
Note: See TracChangeset for help on using the changeset viewer.