Changeset 6e9ae72 for protocols


Ignore:
Timestamp:
2011-12-17T13:50:01Z (12 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
18c6d36
Parents:
87dddee (diff), 17f057d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Mainline merge.

Location:
protocols
Files:
22 added
21 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/io.c

    r87dddee r6e9ae72  
    212212                                   this is an old server that can't do SASL
    213213                                   authentication. */
    214                                 if( !sasl_supported( ic ) )
     214                                if( !set_getbool( &ic->acc->set, "sasl") || !sasl_supported( ic ) )
    215215                                {
    216216                                        /* If there's no version= tag, we suppose
     
    375375           other way. jabber.com doesn't seem to do SASL while it pretends
    376376           to be XMPP 1.0 compliant! */
    377         else if( !( jd->flags & JFLAG_AUTHENTICATED ) && sasl_supported( ic ) )
     377        else if( !( jd->flags & JFLAG_AUTHENTICATED ) && set_getbool( &ic->acc->set, "sasl") && sasl_supported( ic ) )
    378378        {
    379379                if( !jabber_init_iq_auth( ic ) )
  • protocols/jabber/jabber.c

    r87dddee r6e9ae72  
    8484        s->flags |= ACC_SET_OFFLINE_ONLY;
    8585       
     86        s = set_add( &acc->set, "sasl", "true", set_eval_bool, acc );
     87        s->flags |= ACC_SET_OFFLINE_ONLY | SET_HIDDEN_DEFAULT;
     88
    8689        s = set_add( &acc->set, "user_agent", "BitlBee", NULL, acc );
    8790       
  • protocols/jabber/s5bytestream.c

    r87dddee r6e9ae72  
    877877
    878878        if( ( ( host = strchr( proxy, ',' ) ) == 0 ) ||
    879              ( ( port = strchr( host+1, ',' ) ) == 0 ) ) {
     879            ( ( port = strchr( host+1, ',' ) ) == 0 ) )
     880        {
    880881                imcb_log( ic, "Error parsing proxy setting: \"%s\" (ignored)", proxy );
    881882                return NULL;
     
    889890        sh->jid = g_strdup( jid );
    890891        sh->host = g_strdup( host );
    891         strcpy( sh->port, port );
     892        g_snprintf( sh->port, sizeof( sh->port ), "%s", port );
    892893
    893894        return sh;
     
    915916                                sh->jid = g_strdup( tf->ini_jid );
    916917                                sh->host = g_strdup( host );
    917                                 strcpy( sh->port, port );
     918                                g_snprintf( sh->port, sizeof( sh->port ), "%s", port );
    918919                                bt->streamhosts = g_slist_append( bt->streamhosts, sh );
    919920
  • protocols/msn/ns.c

    r87dddee r6e9ae72  
    480480                else
    481481                {
    482                         imcb_error( ic, "Session terminated by remote server (reason unknown)" );
     482                        imcb_error( ic, "Session terminated by remote server (%s)",
     483                                    cmd[1] ? cmd[1] : "reason unknown)" );
    483484                }
    484485               
  • protocols/msn/sb.c

    r87dddee r6e9ae72  
    308308        struct msn_switchboard *sb = data;
    309309        struct im_connection *ic;
    310         struct msn_data *md;
    311310        char buf[1024];
    312311       
     
    316315       
    317316        ic = sb->ic;
    318         md = ic->proto_data;
    319317       
    320318        if( source != sb->fd )
     
    675673        struct im_connection *ic = sb->ic;
    676674        char *body;
    677         int blen = 0;
    678675       
    679676        if( !num_parts )
     
    681678       
    682679        if( ( body = strstr( msg, "\r\n\r\n" ) ) )
    683         {
    684680                body += 4;
    685                 blen = msglen - ( body - msg );
    686         }
    687681       
    688682        if( strcmp( cmd[0], "MSG" ) == 0 )
  • protocols/msn/soap.c

    r87dddee r6e9ae72  
    210210{
    211211        char *s;
    212         int st;
    213212       
    214213        if( !getenv( "BITLBEE_DEBUG" ) )
    215214                return;
    216215       
    217         if( ( s = strstr( headers, "\r\n\r\n" ) ) )
    218                 st = write( 1, s, s - headers + 4 );
    219         else
    220                 st = write( 1, headers, strlen( headers ) );
    221        
    222 #ifdef DEBUG
     216        if( headers )
     217        {
     218                if( ( s = strstr( headers, "\r\n\r\n" ) ) )
     219                        write( 2, headers, s - headers + 4 );
     220                else
     221                        write( 2, headers, strlen( headers ) );
     222        }
     223       
     224        if( payload )
    223225        {
    224226                struct xt_node *xt = xt_from_string( payload );
     
    227229                xt_free_node( xt );
    228230        }
    229 #endif
    230231}
    231232
     
    661662       
    662663        if( getenv( "BITLBEE_DEBUG" ) )
    663                 printf( "%p %s %d\n", bu, handle, bd->flags );
     664                fprintf( stderr, "%p %s %d\n", bu, handle, bd->flags );
    664665       
    665666        return XT_HANDLED;
     
    808809       
    809810        if( getenv( "BITLBEE_DEBUG" ) )
    810                 printf( "%s %s\n", id, name );
     811                fprintf( stderr, "%s %s\n", id, name );
    811812       
    812813        return XT_HANDLED;
     
    869870       
    870871        if( getenv( "BITLBEE_DEBUG" ) )
    871                 printf( "%s %s %s %s\n", id, type, handle, display_name );
     872                fprintf( stderr, "%s %s %s %s\n", id, type, handle, display_name );
    872873       
    873874        return XT_HANDLED;
  • protocols/nogaim.c

    r87dddee r6e9ae72  
    216216        if( a )
    217217                /* FIXME(wilmer): ui_log callback or so */
    218                 irc_usermsg( ic->bee->ui_data, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text );
     218                irc_rootmsg( ic->bee->ui_data, "%s - %s", ic->acc->tag, text );
    219219        else
    220                 irc_usermsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text );
     220                irc_rootmsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text );
    221221       
    222222        g_free( text );
  • protocols/oscar/chat.c

    r87dddee r6e9ae72  
    384384        char *roomname = NULL;
    385385        struct aim_chat_roominfo roominfo;
    386         guint16 tlvcount = 0;
    387386        aim_tlvlist_t *tlvlist;
    388387        char *roomdesc = NULL;
     
    401400        }
    402401
    403         tlvcount = aimbs_get16(bs);
     402        aimbs_get16(bs); /* tlv count */
    404403
    405404        /*
  • protocols/oscar/chatnav.c

    r87dddee r6e9ae72  
    139139                 * Type 0x0002: Unknown
    140140                 */
    141                 if (aim_gettlv(innerlist, 0x0002, 1)) {
    142                         guint16 classperms;
    143 
    144                         classperms = aim_gettlv16(innerlist, 0x0002, 1);
    145                        
    146                 }
     141                if (aim_gettlv(innerlist, 0x0002, 1))
     142                        ;
    147143
    148144                /*
     
    205201                 */
    206202                if (aim_gettlv(innerlist, 0x00d5, 1)) {
    207                         guint8 createperms;
    208 
    209                         createperms = aim_gettlv8(innerlist, 0x00d5, 1);
     203                        aim_gettlv8(innerlist, 0x00d5, 1); /* createperms */
    210204                }
    211205
  • protocols/oscar/icq.c

    r87dddee r6e9ae72  
    235235        aim_tlv_t *datatlv;
    236236        aim_bstream_t qbs;
    237         guint32 ouruin;
    238         guint16 cmdlen, cmd, reqid;
     237        guint16 cmd, reqid;
    239238
    240239        if (!(tl = aim_readtlvchain(bs)) || !(datatlv = aim_gettlv(tl, 0x0001, 1))) {
     
    246245        aim_bstream_init(&qbs, datatlv->value, datatlv->length);
    247246
    248         cmdlen = aimbs_getle16(&qbs);
    249         ouruin = aimbs_getle32(&qbs);
     247        aimbs_getle16(&qbs); /* cmdlen */
     248        aimbs_getle32(&qbs); /* ouruin */
    250249        cmd = aimbs_getle16(&qbs);
    251250        reqid = aimbs_getle16(&qbs);
  • protocols/oscar/im.c

    r87dddee r6e9ae72  
    919919        int i, ret = 0;
    920920        aim_rxcallback_t userfunc;
    921         guint8 cookie[8];
    922921        guint16 channel;
    923922        aim_tlvlist_t *tlvlist;
     
    931930        /* ICBM Cookie. */
    932931        for (i = 0; i < 8; i++)
    933                 cookie[i] = aimbs_get8(bs);
     932                aimbs_get8(bs);
    934933
    935934        /* Channel ID */
     
    14141413{
    14151414        guint16 hdrlen, msglen, dc;
    1416         guint8 msgtype, msgflags;
     1415        guint8 msgtype;
    14171416    guint8 *plugin;
    14181417    int i = 0, tmp = 0;
     
    14421441
    14431442        msgtype = aimbs_getle8(servdata);
    1444         msgflags = aimbs_getle8(servdata);
     1443        aimbs_getle8(servdata); /* msgflags */
    14451444
    14461445        aim_bstream_advance(servdata, 0x04); /* status code and priority code */
  • protocols/oscar/misc.c

    r87dddee r6e9ae72  
    310310{
    311311        aim_frame_t *fr;
    312         aim_snacid_t snacid;
    313312        aim_tlvlist_t *tl = NULL;
    314313
     
    330329                return -ENOMEM;
    331330
    332         snacid = aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0);
     331        aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0);
    333332
    334333        aim_putsnac(&fr->data, 0x0002, 0x000f, 0x0000, 0);
  • protocols/oscar/oscar.c

    r87dddee r6e9ae72  
    10721072static void gaim_icq_authgrant(void *data_) {
    10731073        struct icq_auth *data = data_;
    1074         char *uin, message;
     1074        char *uin;
    10751075        struct oscar_data *od = (struct oscar_data *)data->ic->proto_data;
    10761076       
    10771077        uin = g_strdup_printf("%u", data->uin);
    1078         message = 0;
    10791078        aim_ssi_auth_reply(od->sess, od->conn, uin, 1, "");
     1079        // char *message = 0;
    10801080        // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message);
    10811081        imcb_ask_add(data->ic, uin, NULL);
     
    12191219static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) {
    12201220        va_list ap;
    1221         guint16 chan, nummissed, reason;
     1221        guint16 nummissed, reason;
    12221222        aim_userinfo_t *userinfo;
    12231223
    12241224        va_start(ap, fr);
    1225         chan = (guint16)va_arg(ap, unsigned int);
     1225        va_arg(ap, unsigned int); /* chan */
    12261226        userinfo = va_arg(ap, aim_userinfo_t *);
    12271227        nummissed = (guint16)va_arg(ap, unsigned int);
     
    13351335
    13361336static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) {
    1337         char *msg;
    13381337        guint16 id;
    13391338        va_list ap;
     
    13411340        va_start(ap, fr);
    13421341        id  = (guint16)va_arg(ap, unsigned int);
    1343         msg = va_arg(ap, char *);
     1342        va_arg(ap, char *); /* msg */
    13441343        va_end(ap);
    13451344
     
    13611360        switch(type) {
    13621361                case 0x0002: {
    1363                         guint8 maxrooms;
    1364                         struct aim_chat_exchangeinfo *exchanges;
    1365                         int exchangecount; // i;
    1366 
    1367                         maxrooms = (guint8)va_arg(ap, unsigned int);
    1368                         exchangecount = va_arg(ap, int);
    1369                         exchanges = va_arg(ap, struct aim_chat_exchangeinfo *);
     1362                        va_arg(ap, unsigned int); /* maxrooms */
     1363                        va_arg(ap, int); /* exchangecount */
     1364                        va_arg(ap, struct aim_chat_exchangeinfo *); /* exchanges */
    13701365                        va_end(ap);
    13711366
     
    13801375                        break;
    13811376                case 0x0008: {
    1382                         char *fqcn, *name, *ck;
    1383                         guint16 instance, flags, maxmsglen, maxoccupancy, unknown, exchange;
    1384                         guint8 createperms;
    1385                         guint32 createtime;
    1386 
    1387                         fqcn = va_arg(ap, char *);
     1377                        char *ck;
     1378                        guint16 instance, exchange;
     1379
     1380                        va_arg(ap, char *); /* fqcn */
    13881381                        instance = (guint16)va_arg(ap, unsigned int);
    13891382                        exchange = (guint16)va_arg(ap, unsigned int);
    1390                         flags = (guint16)va_arg(ap, unsigned int);
    1391                         createtime = va_arg(ap, guint32);
    1392                         maxmsglen = (guint16)va_arg(ap, unsigned int);
    1393                         maxoccupancy = (guint16)va_arg(ap, unsigned int);
    1394                         createperms = (guint8)va_arg(ap, int);
    1395                         unknown = (guint16)va_arg(ap, unsigned int);
    1396                         name = va_arg(ap, char *);
     1383                        va_arg(ap, unsigned int); /* flags */
     1384                        va_arg(ap, guint32); /* createtime */
     1385                        va_arg(ap, unsigned int); /* maxmsglen */
     1386                        va_arg(ap, unsigned int); /* maxoccupancy */
     1387                        va_arg(ap, int); /* createperms */
     1388                        va_arg(ap, unsigned int); /* unknown */
     1389                        va_arg(ap, char *); /* name */
    13971390                        ck = va_arg(ap, char *);
    13981391                        va_end(ap);
     
    14561449static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) {
    14571450        va_list ap;
    1458         aim_userinfo_t *userinfo;
    1459         struct aim_chat_roominfo *roominfo;
    1460         char *roomname;
    1461         int usercount;
    1462         char *roomdesc;
    1463         guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
    1464         guint32 creationtime;
     1451        guint16 maxmsglen, maxvisiblemsglen;
    14651452        struct im_connection *ic = sess->aux_data;
    14661453        struct chat_connection *ccon = find_oscar_chat_by_conn(ic, fr->conn);
    14671454
    14681455        va_start(ap, fr);
    1469         roominfo = va_arg(ap, struct aim_chat_roominfo *);
    1470         roomname = va_arg(ap, char *);
    1471         usercount= va_arg(ap, int);
    1472         userinfo = va_arg(ap, aim_userinfo_t *);
    1473         roomdesc = va_arg(ap, char *);
    1474         unknown_c9 = (guint16)va_arg(ap, int);
    1475         creationtime = (guint32)va_arg(ap, unsigned long);
     1456        va_arg(ap, struct aim_chat_roominfo *); /* roominfo */
     1457        va_arg(ap, char *); /* roomname */
     1458        va_arg(ap, int); /* usercount */
     1459        va_arg(ap, aim_userinfo_t *); /* userinfo */
     1460        va_arg(ap, char *); /* roomdesc */
     1461        va_arg(ap, int); /* unknown_c9 */
     1462        va_arg(ap, unsigned long); /* creationtime */
    14761463        maxmsglen = (guint16)va_arg(ap, int);
    1477         unknown_d2 = (guint16)va_arg(ap, int);
    1478         unknown_d5 = (guint16)va_arg(ap, int);
     1464        va_arg(ap, int); /* unknown_d2 */
     1465        va_arg(ap, int); /* unknown_d5 */
    14791466        maxvisiblemsglen = (guint16)va_arg(ap, int);
    14801467        va_end(ap);
     
    15171504#endif
    15181505        va_list ap;
    1519         guint16 code, rateclass;
    1520         guint32 windowsize, clear, alert, limit, disconnect, currentavg, maxavg;
     1506        guint16 code;
     1507        guint32 windowsize, clear, currentavg;
    15211508
    15221509        va_start(ap, fr);
    15231510        code = (guint16)va_arg(ap, unsigned int);
    1524         rateclass= (guint16)va_arg(ap, unsigned int);
     1511        va_arg(ap, unsigned int); /* rateclass */
    15251512        windowsize = (guint32)va_arg(ap, unsigned long);
    15261513        clear = (guint32)va_arg(ap, unsigned long);
    1527         alert = (guint32)va_arg(ap, unsigned long);
    1528         limit = (guint32)va_arg(ap, unsigned long);
    1529         disconnect = (guint32)va_arg(ap, unsigned long);
     1514        va_arg(ap, unsigned long); /* alert */
     1515        va_arg(ap, unsigned long); /* limit */
     1516        va_arg(ap, unsigned long); /* disconnect */
    15301517        currentavg = (guint32)va_arg(ap, unsigned long);
    1531         maxavg = (guint32)va_arg(ap, unsigned long);
     1518        va_arg(ap, unsigned long); /* maxavg */
    15321519        va_end(ap);
    15331520
     
    21022089                                aim_ssi_addbuddies( sess, fr->conn, OSCAR_GROUP, &list, 1, 1 );
    21032090                        }
     2091                        else if( st == 0x0A )
     2092                        {
     2093                                imcb_error( sess->aux_data, "Buddy %s is already in your list", list );
     2094                        }
    21042095                        else
    21052096                        {
     
    24132404        struct im_connection * ic = sess->aux_data;
    24142405        va_list ap;
    2415         guint16 type1, type2;
     2406        guint16 type2;
    24162407        char * sn;
    24172408
    24182409        va_start(ap, fr);
    2419         type1 = va_arg(ap, int);
     2410        va_arg(ap, int); /* type1 */
    24202411        sn = va_arg(ap, char*);
    24212412        type2 = va_arg(ap, int);
     
    25372528
    25382529        if((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) {
    2539                 int st;
    2540                
    2541                 st = aim_chatnav_createroom(od->sess, cur, room, exchange_number);
     2530                aim_chatnav_createroom(od->sess, cur, room, exchange_number);
    25422531               
    25432532                return ret;
     
    25662555        static int chat_id = 0;
    25672556        char * chatname, *s;
    2568         struct groupchat *c;
    25692557       
    25702558        chatname = g_strdup_printf("%s%s%d", isdigit(*ic->acc->user) ? "icq" : "",
     
    25752563                        *s = '0';
    25762564       
    2577         c = imcb_chat_new(ic, chatname);
    25782565        ret = oscar_chat_join_internal(ic, chatname, NULL, NULL, 4);
    25792566        aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0);
     
    25812568        g_free(chatname);
    25822569       
    2583         return NULL;
     2570        return ret;
    25842571}
    25852572
  • protocols/oscar/rxqueue.c

    r87dddee r6e9ae72  
    388388         */
    389389        if (aimbs_get8(&flaphdr) != 0x2a) {
    390                 guint8 start;
    391 
    392390                aim_bstream_rewind(&flaphdr);
    393                 start = aimbs_get8(&flaphdr);
     391                aimbs_get8(&flaphdr);
    394392                imcb_error(sess->aux_data, "FLAP framing disrupted");
    395393                aim_conn_close(conn);
  • protocols/oscar/service.c

    r87dddee r6e9ae72  
    563563        groupcount = aimbs_get16(bs);
    564564        for (i = 0; i < groupcount; i++) {
    565                 guint16 group;
    566 
    567                 group = aimbs_get16(bs);
     565                aimbs_get16(bs);
    568566
    569567                imcb_error(sess->aux_data, "bifurcated migration unsupported");
     
    701699static int hostversions(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
    702700{
    703         int vercount;
    704701        guint8 *versions;
    705702
    706703        /* This is frivolous. (Thank you SmarterChild.) */
    707         vercount = aim_bstream_empty(bs)/4;
     704        aim_bstream_empty(bs); /* == vercount * 4 */
    708705        versions = aimbs_getraw(bs, aim_bstream_empty(bs));
    709706        g_free(versions);
     
    731728        aim_tlvlist_t *tl = NULL;
    732729        guint32 data;
    733         int tlvlen;
    734730        struct im_connection *ic = sess ? sess->aux_data : NULL;
    735731
     
    739735                data |= AIM_ICQ_STATE_WEBAWARE;
    740736
    741         tlvlen = aim_addtlvtochain32(&tl, 0x0006, data);
     737        aim_addtlvtochain32(&tl, 0x0006, data); /* tlvlen */
    742738
    743739        if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 8)))
  • protocols/purple/purple.c

    r87dddee r6e9ae72  
    181181                        /** No way to talk to the user right now, invent one when
    182182                        this becomes important.
    183                         irc_usermsg( acc->irc, "Setting with unknown type: %s (%d) Expect stuff to break..\n",
     183                        irc_rootmsg( acc->irc, "Setting with unknown type: %s (%d) Expect stuff to break..\n",
    184184                                     name, purple_account_option_get_type( o ) );
    185185                        */
     
    750750                if( bud->server_alias )
    751751                        imcb_rename_buddy( ic, bud->name, bud->server_alias );
     752                else if( bud->alias )
     753                        imcb_rename_buddy( ic, bud->name, bud->alias );
    752754               
    753755                if( group )
  • protocols/twitter/twitter.c

    r87dddee r6e9ae72  
    3030
    3131#define twitter_msg( ic, fmt... ) \
    32         do {                                                        \
    33                 struct twitter_data *td = ic->proto_data;           \
    34                 if( td->home_timeline_gc )                          \
    35                         imcb_chat_log( td->home_timeline_gc, fmt ); \
    36                 else                                                \
    37                         imcb_log( ic, fmt );                        \
     32        do {                                            \
     33                struct twitter_data *td = ic->proto_data;   \
     34                if( td->timeline_gc )                       \
     35                        imcb_chat_log( td->timeline_gc, fmt ); \
     36                else                                        \
     37                        imcb_log( ic, fmt );                    \
    3838        } while( 0 );
    3939
     
    5252
    5353        // Do stuff..
    54         twitter_get_home_timeline(ic, -1);
     54        twitter_get_timeline(ic, -1);
    5555
    5656        // If we are still logged in run this function again after timeout.
     
    6969        // Queue the main_loop
    7070        // Save the return value, so we can remove the timeout on logout.
    71         td->main_loop_id = b_timeout_add(60000, twitter_main_loop, ic);
     71        td->main_loop_id =
     72            b_timeout_add(set_getint(&ic->acc->set, "fetch_interval") * 1000, twitter_main_loop, ic);
    7273}
    7374
     
    7778{
    7879        struct twitter_data *td = ic->proto_data;
     80
     81        td->flags &= ~TWITTER_DOING_TIMELINE;
    7982
    8083        if (set_getbool(&ic->acc->set, "oauth") && !td->oauth_info)
     
    9093
    9194static const struct oauth_service twitter_oauth = {
    92         "http://api.twitter.com/oauth/request_token",
    93         "http://api.twitter.com/oauth/access_token",
     95        "https://api.twitter.com/oauth/request_token",
     96        "https://api.twitter.com/oauth/access_token",
    9497        "https://api.twitter.com/oauth/authorize",
    9598        .consumer_key = "xsDNKJuNZYkZyMcu914uEA",
     
    98101
    99102static const struct oauth_service identica_oauth = {
    100         "http://identi.ca/api/oauth/request_token",
    101         "http://identi.ca/api/oauth/access_token",
     103        "https://identi.ca/api/oauth/request_token",
     104        "https://identi.ca/api/oauth/access_token",
    102105        "https://identi.ca/api/oauth/authorize",
    103106        .consumer_key = "e147ff789fcbd8a5a07963afbb43f9da",
     
    216219                def_oauth = "true";
    217220        } else {                /* if( strcmp( acc->prpl->name, "identica" ) == 0 ) */
    218 
    219221                def_url = IDENTICA_API_URL;
    220222                def_oauth = "false";
     
    228230        s = set_add(&acc->set, "commands", "true", set_eval_bool, acc);
    229231
     232        s = set_add(&acc->set, "fetch_interval", "60", set_eval_int, acc);
     233        s->flags |= ACC_SET_OFFLINE_ONLY;
     234
     235        s = set_add(&acc->set, "fetch_mentions", "true", set_eval_bool, acc);
     236
    230237        s = set_add(&acc->set, "message_length", "140", set_eval_int, acc);
    231238
     
    235242        s = set_add(&acc->set, "show_ids", "false", set_eval_bool, acc);
    236243        s->flags |= ACC_SET_OFFLINE_ONLY;
     244
     245        s = set_add(&acc->set, "show_old_mentions", "true", set_eval_bool, acc);
    237246
    238247        s = set_add(&acc->set, "oauth", def_oauth, set_eval_bool, acc);
     
    317326        b_event_remove(td->main_loop_id);
    318327
    319         if (td->home_timeline_gc)
    320                 imcb_chat_free(td->home_timeline_gc);
     328        if (td->timeline_gc)
     329                imcb_chat_free(td->timeline_gc);
    321330
    322331        if (td) {
     
    404413        struct twitter_data *td = c->ic->proto_data;
    405414
    406         if (c != td->home_timeline_gc)
     415        if (c != td->timeline_gc)
    407416                return;         /* WTF? */
    408417
    409418        /* If the user leaves the channel: Fine. Rejoin him/her once new
    410419           tweets come in. */
    411         imcb_chat_free(td->home_timeline_gc);
    412         td->home_timeline_gc = NULL;
     420        imcb_chat_free(td->timeline_gc);
     421        td->timeline_gc = NULL;
    413422}
    414423
     
    465474                guint64 id;
    466475
    467                 if (cmd[1])
    468                         id = g_ascii_strtoull(cmd[1], NULL, 10);
    469                 else
    470                         id = td->last_status_id;
    471 
    472                 /* TODO: User feedback. */
    473                 if (id)
     476                if (cmd[1] == NULL)
     477                        twitter_status_destroy(ic, td->last_status_id);
     478                else if (sscanf(cmd[1], "%" G_GUINT64_FORMAT, &id) == 1) {
     479                        if (id < TWITTER_LOG_LENGTH && td->log)
     480                                id = td->log[id].id;
     481                       
    474482                        twitter_status_destroy(ic, id);
    475                 else
     483                } else
    476484                        twitter_msg(ic, "Could not undo last action");
    477485
     
    491499                guint64 id;
    492500
    493                 if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) &&
     501                if (g_str_has_prefix(cmd[1], "#") &&
     502                    sscanf(cmd[1] + 1, "%" G_GUINT64_FORMAT, &id) == 1) {
     503                        if (id < TWITTER_LOG_LENGTH && td->log)
     504                                id = td->log[id].id;
     505                } else if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) &&
    494506                    (tud = bu->data) && tud->last_id)
    495507                        id = tud->last_id;
    496                 else {
    497                         id = g_ascii_strtoull(cmd[1], NULL, 10);
     508                else if (sscanf(cmd[1], "%" G_GUINT64_FORMAT, &id) == 1){
    498509                        if (id < TWITTER_LOG_LENGTH && td->log)
    499510                                id = td->log[id].id;
     
    514525                guint64 id = 0;
    515526
    516                 if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) &&
     527                if (g_str_has_prefix(cmd[1], "#") &&
     528                    sscanf(cmd[1] + 1, "%" G_GUINT64_FORMAT, &id) == 1 &&
     529                    (id < TWITTER_LOG_LENGTH) && td->log) {
     530                        bu = td->log[id].bu;
     531                        if (g_slist_find(ic->bee->users, bu))
     532                                id = td->log[id].id;
     533                        else
     534                                bu = NULL;
     535                } else if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) &&
    517536                    (tud = bu->data) && tud->last_id) {
    518537                        id = tud->last_id;
     
    525544                                bu = NULL;
    526545                }
     546
    527547                if (!id || !bu) {
    528548                        twitter_msg(ic, "User `%s' does not exist or didn't "
  • protocols/twitter/twitter.h

    r87dddee r6e9ae72  
    3636{
    3737        TWITTER_HAVE_FRIENDS = 1,
     38        TWITTER_DOING_TIMELINE = 0x10000,
     39        TWITTER_GOT_TIMELINE = 0x20000,
     40        TWITTER_GOT_MENTIONS = 0x40000,
    3841} twitter_flags_t;
    3942
     
    4447        char* user;
    4548        struct oauth_info *oauth_info;
     49
     50        gpointer home_timeline_obj;
     51        gpointer mentions_obj;
     52
     53        guint64 timeline_id;
     54
    4655        GSList *follow_ids;
    4756       
    48         guint64 home_timeline_id;
    4957        guint64 last_status_id; /* For undo */
    5058        gint main_loop_id;
    51         struct groupchat *home_timeline_gc;
     59        struct groupchat *timeline_gc;
    5260        gint http_fails;
    5361        twitter_flags_t flags;
  • protocols/twitter/twitter_lib.c

    r87dddee r6e9ae72  
    7878        if (txu == NULL)
    7979                return;
     80
    8081        g_free(txu->name);
    8182        g_free(txu->screen_name);
     
    8384}
    8485
    85 
    8686/**
    8787 * Frees a twitter_xml_status struct.
     
    8989static void txs_free(struct twitter_xml_status *txs)
    9090{
     91        if (txs == NULL)
     92                return;
     93
    9194        g_free(txs->text);
    9295        txu_free(txs->user);
     
    103106        if (txl == NULL)
    104107                return;
    105         for (l = txl->list; l; l = g_slist_next(l))
    106                 if (txl->type == TXL_STATUS)
     108
     109        for (l = txl->list; l; l = g_slist_next(l)) {
     110                if (txl->type == TXL_STATUS) {
    107111                        txs_free((struct twitter_xml_status *) l->data);
    108                 else if (txl->type == TXL_ID)
     112                } else if (txl->type == TXL_ID) {
    109113                        g_free(l->data);
    110                 else if (txl->type == TXL_USER)
     114                } else if (txl->type == TXL_USER) {
    111115                        txu_free(l->data);
     116                }
     117        }
     118
    112119        g_slist_free(txl->list);
    113120        g_free(txl);
     
    115122
    116123/**
    117  * Add a buddy if it is not allready added, set the status to logged in.
     124 * Compare status elements
     125 */
     126static gint twitter_compare_elements(gconstpointer a, gconstpointer b)
     127{
     128        struct twitter_xml_status *a_status = (struct twitter_xml_status *) a;
     129        struct twitter_xml_status *b_status = (struct twitter_xml_status *) b;
     130
     131        if (a_status->created_at < b_status->created_at) {
     132                return -1;
     133        } else if (a_status->created_at > b_status->created_at) {
     134                return 1;
     135        } else {
     136                return 0;
     137        }
     138}
     139
     140/**
     141 * Add a buddy if it is not already added, set the status to logged in.
    118142 */
    119143static void twitter_add_buddy(struct im_connection *ic, char *name, const char *fullname)
     
    132156                           exact Twitter username. */
    133157                        imcb_buddy_nick_hint(ic, name, name);
    134                         imcb_chat_add_buddy(td->home_timeline_gc, name);
     158                        imcb_chat_add_buddy(td->timeline_gc, name);
    135159                } else if (g_strcasecmp(mode, "many") == 0)
    136160                        imcb_buddy_status(ic, name, OPT_LOGGED_IN, NULL, NULL);
     
    260284
    261285        /* Create the room now that we "logged in". */
    262         if (!td->home_timeline_gc && g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "chat") == 0)
     286        if (!td->timeline_gc && g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "chat") == 0)
    263287                twitter_groupchat_init(ic);
    264288
     
    436460{
    437461        struct xt_node *child, *rt = NULL;
    438         gboolean truncated = FALSE;
    439462
    440463        // Walk over the nodes children.
     
    442465                if (g_strcasecmp("text", child->name) == 0) {
    443466                        txs->text = g_memdup(child->text, child->text_len + 1);
    444                 } else if (g_strcasecmp("truncated", child->name) == 0 && child->text) {
    445                         truncated = bool2int(child->text);
    446467                } else if (g_strcasecmp("retweeted_status", child->name) == 0) {
    447468                        rt = child;
     
    464485        }
    465486
    466         /* If it's a truncated retweet, get the original because dots suck. */
    467         if (truncated && rt) {
     487        /* If it's a (truncated) retweet, get the original. Even if the API claims it
     488           wasn't truncated because it may be lying. */
     489        if (rt) {
    468490                struct twitter_xml_status *rtxs = g_new0(struct twitter_xml_status, 1);
    469491                if (twitter_xt_get_status(rt, rtxs) != XT_HANDLED) {
     
    475497                txs->text = g_strdup_printf("RT @%s: %s", rtxs->user->screen_name, rtxs->text);
    476498                txs_free(rtxs);
     499        } else {
     500                struct xt_node *urls, *url;
     501               
     502                urls = xt_find_path(node, "entities/urls");
     503                for (url = urls ? urls->children : NULL; url; url = url->next) {
     504                        /* "short" is a reserved word. :-P */
     505                        struct xt_node *kort = xt_find_node(url->children, "url");
     506                        struct xt_node *disp = xt_find_node(url->children, "display_url");
     507                        char *pos, *new;
     508                       
     509                        if (!kort || !kort->text || !disp || !disp->text ||
     510                            !(pos = strstr(txs->text, kort->text)))
     511                                continue;
     512                       
     513                        *pos = '\0';
     514                        new = g_strdup_printf("%s%s &lt;%s&gt;%s", txs->text, kort->text,
     515                                              disp->text, pos + strlen(kort->text));
     516                       
     517                        g_free(txs->text);
     518                        txs->text = new;
     519                }
    477520        }
    478521
     
    520563
    521564        return XT_HANDLED;
    522 }
    523 
    524 static void twitter_http_get_home_timeline(struct http_request *req);
    525 
    526 /**
    527  * Get the timeline.
    528  */
    529 void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor)
    530 {
    531         struct twitter_data *td = ic->proto_data;
    532 
    533         char *args[4];
    534         args[0] = "cursor";
    535         args[1] = g_strdup_printf("%lld", (long long) next_cursor);
    536         if (td->home_timeline_id) {
    537                 args[2] = "since_id";
    538                 args[3] = g_strdup_printf("%llu", (long long unsigned int) td->home_timeline_id);
    539         }
    540 
    541         twitter_http(ic, TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, args,
    542                      td->home_timeline_id ? 4 : 2);
    543 
    544         g_free(args[1]);
    545         if (td->home_timeline_id) {
    546                 g_free(args[3]);
    547         }
    548565}
    549566
     
    586603        GSList *l;
    587604
    588         td->home_timeline_gc = gc = imcb_chat_new(ic, "home/timeline");
     605        td->timeline_gc = gc = imcb_chat_new(ic, "twitter/timeline");
    589606
    590607        name_hint = g_strdup_printf("%s_%s", td->prefix, ic->acc->user);
     
    595612                bee_user_t *bu = l->data;
    596613                if (bu->ic == ic)
    597                         imcb_chat_add_buddy(td->home_timeline_gc, bu->handle);
     614                        imcb_chat_add_buddy(td->timeline_gc, bu->handle);
    598615        }
    599616}
     
    608625        struct twitter_xml_status *status;
    609626        struct groupchat *gc;
     627        guint64 last_id = 0;
    610628
    611629        // Create a new groupchat if it does not exsist.
    612         if (!td->home_timeline_gc)
     630        if (!td->timeline_gc)
    613631                twitter_groupchat_init(ic);
    614632
    615         gc = td->home_timeline_gc;
     633        gc = td->timeline_gc;
    616634        if (!gc->joined)
    617635                imcb_chat_add_buddy(gc, ic->acc->user);
     
    621639
    622640                status = l->data;
    623                 if (status->user == NULL || status->text == NULL)
     641                if (status->user == NULL || status->text == NULL || last_id == status->id)
    624642                        continue;
    625643
    626                 twitter_add_buddy(ic, status->user->screen_name, status->user->name);
     644                last_id = status->id;
    627645
    628646                strip_html(status->text);
     647
    629648                msg = twitter_msg_add_id(ic, status, "");
    630649
    631650                // Say it!
    632                 if (g_strcasecmp(td->user, status->user->screen_name) == 0)
     651                if (g_strcasecmp(td->user, status->user->screen_name) == 0) {
    633652                        imcb_chat_log(gc, "You: %s", msg ? msg : status->text);
    634                 else
     653                } else {
     654                        twitter_add_buddy(ic, status->user->screen_name, status->user->name);
     655
    635656                        imcb_chat_msg(gc, status->user->screen_name,
    636657                                      msg ? msg : status->text, 0, status->created_at);
     658                }
    637659
    638660                g_free(msg);
    639661
    640                 // Update the home_timeline_id to hold the highest id, so that by the next request
     662                // Update the timeline_id to hold the highest id, so that by the next request
    641663                // we won't pick up the updates already in the list.
    642                 td->home_timeline_id = MAX(td->home_timeline_id, status->id);
     664                td->timeline_id = MAX(td->timeline_id, status->id);
    643665        }
    644666}
     
    654676        char from[MAX_STRING];
    655677        gboolean mode_one;
     678        guint64 last_id = 0;
    656679
    657680        mode_one = g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "one") == 0;
     
    666689
    667690                status = l->data;
     691                if (status->user == NULL || status->text == NULL || last_id == status->id)
     692                        continue;
     693
     694                last_id = status->id;
    668695
    669696                strip_html(status->text);
     
    680707                               text ? text : status->text, 0, status->created_at);
    681708
    682                 // Update the home_timeline_id to hold the highest id, so that by the next request
     709                // Update the timeline_id to hold the highest id, so that by the next request
    683710                // we won't pick up the updates already in the list.
    684                 td->home_timeline_id = MAX(td->home_timeline_id, status->id);
     711                td->timeline_id = MAX(td->timeline_id, status->id);
    685712
    686713                g_free(text);
    687714                g_free(prefix);
     715        }
     716}
     717
     718static void twitter_http_get_home_timeline(struct http_request *req);
     719static void twitter_http_get_mentions(struct http_request *req);
     720
     721/**
     722 * Get the timeline with optionally mentions
     723 */
     724void twitter_get_timeline(struct im_connection *ic, gint64 next_cursor)
     725{
     726        struct twitter_data *td = ic->proto_data;
     727        gboolean include_mentions = set_getbool(&ic->acc->set, "fetch_mentions");
     728
     729        if (td->flags & TWITTER_DOING_TIMELINE) {
     730                return;
     731        }
     732
     733        td->flags |= TWITTER_DOING_TIMELINE;
     734
     735        twitter_get_home_timeline(ic, next_cursor);
     736
     737        if (include_mentions) {
     738                twitter_get_mentions(ic, next_cursor);
     739        }
     740}
     741
     742/**
     743 * Call this one after receiving timeline/mentions. Show to user once we have
     744 * both.
     745 */
     746void twitter_flush_timeline(struct im_connection *ic)
     747{
     748        struct twitter_data *td = ic->proto_data;
     749        gboolean include_mentions = set_getbool(&ic->acc->set, "fetch_mentions");
     750        gboolean show_old_mentions = set_getbool(&ic->acc->set, "show_old_mentions");
     751        struct twitter_xml_list *home_timeline = td->home_timeline_obj;
     752        struct twitter_xml_list *mentions = td->mentions_obj;
     753        GSList *output = NULL;
     754        GSList *l;
     755
     756        if (!(td->flags & TWITTER_GOT_TIMELINE)) {
     757                return;
     758        }
     759
     760        if (include_mentions && !(td->flags & TWITTER_GOT_MENTIONS)) {
     761                return;
     762        }
     763
     764        if (home_timeline && home_timeline->list) {
     765                for (l = home_timeline->list; l; l = g_slist_next(l)) {
     766                        output = g_slist_insert_sorted(output, l->data, twitter_compare_elements);
     767                }
     768        }
     769
     770        if (include_mentions && mentions && mentions->list) {
     771                for (l = mentions->list; l; l = g_slist_next(l)) {
     772                        if (!show_old_mentions && output && twitter_compare_elements(l->data, output->data) < 0) {
     773                                continue;
     774                        }
     775
     776                        output = g_slist_insert_sorted(output, l->data, twitter_compare_elements);
     777                }
     778        }
     779
     780        // See if the user wants to see the messages in a groupchat window or as private messages.
     781        if (g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "chat") == 0)
     782                twitter_groupchat(ic, output);
     783        else
     784                twitter_private_message_chat(ic, output);
     785
     786        g_slist_free(output);
     787
     788        if (home_timeline && home_timeline->list) {
     789                txl_free(home_timeline);
     790        }
     791
     792        if (mentions && mentions->list) {
     793                txl_free(mentions);
     794        }
     795
     796        td->flags &= ~(TWITTER_DOING_TIMELINE | TWITTER_GOT_TIMELINE | TWITTER_GOT_MENTIONS);
     797}
     798
     799/**
     800 * Get the timeline.
     801 */
     802void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor)
     803{
     804        struct twitter_data *td = ic->proto_data;
     805
     806        td->home_timeline_obj = NULL;
     807        td->flags &= ~TWITTER_GOT_TIMELINE;
     808
     809        char *args[6];
     810        args[0] = "cursor";
     811        args[1] = g_strdup_printf("%lld", (long long) next_cursor);
     812        args[2] = "include_entities";
     813        args[3] = "true";
     814        if (td->timeline_id) {
     815                args[4] = "since_id";
     816                args[5] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id);
     817        }
     818
     819        if (twitter_http(ic, TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, args,
     820                     td->timeline_id ? 6 : 4) == NULL) {
     821                if (++td->http_fails >= 5)
     822                        imcb_error(ic, "Could not retrieve %s: %s",
     823                                   TWITTER_HOME_TIMELINE_URL, "connection failed");
     824                td->flags |= TWITTER_GOT_TIMELINE;
     825                twitter_flush_timeline(ic);
     826        }
     827
     828        g_free(args[1]);
     829        if (td->timeline_id) {
     830                g_free(args[5]);
     831        }
     832}
     833
     834/**
     835 * Get mentions.
     836 */
     837void twitter_get_mentions(struct im_connection *ic, gint64 next_cursor)
     838{
     839        struct twitter_data *td = ic->proto_data;
     840
     841        td->mentions_obj = NULL;
     842        td->flags &= ~TWITTER_GOT_MENTIONS;
     843
     844        char *args[6];
     845        args[0] = "cursor";
     846        args[1] = g_strdup_printf("%lld", (long long) next_cursor);
     847        args[2] = "include_entities";
     848        args[3] = "true";
     849        if (td->timeline_id) {
     850                args[4] = "since_id";
     851                args[5] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id);
     852        }
     853
     854        if (twitter_http(ic, TWITTER_MENTIONS_URL, twitter_http_get_mentions, ic, 0, args,
     855                     td->timeline_id ? 6 : 4) == NULL) {
     856                if (++td->http_fails >= 5)
     857                        imcb_error(ic, "Could not retrieve %s: %s",
     858                                   TWITTER_MENTIONS_URL, "connection failed");
     859                td->flags |= TWITTER_GOT_MENTIONS;
     860                twitter_flush_timeline(ic);
     861        }
     862
     863        g_free(args[1]);
     864        if (td->timeline_id) {
     865                g_free(args[5]);
    688866        }
    689867}
     
    713891                imcb_error(ic, "Authentication failure");
    714892                imc_logout(ic, FALSE);
    715                 return;
     893                goto end;
    716894        } else {
    717895                // It didn't go well, output the error and return.
     
    720898                                   TWITTER_HOME_TIMELINE_URL, twitter_parse_error(req));
    721899
    722                 return;
     900                goto end;
    723901        }
    724902
     
    733911        xt_free(parser);
    734912
    735         // See if the user wants to see the messages in a groupchat window or as private messages.
    736         if (txl->list == NULL);
    737         else if (g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "chat") == 0)
    738                 twitter_groupchat(ic, txl->list);
    739         else
    740                 twitter_private_message_chat(ic, txl->list);
    741 
    742         // Free the structure. 
    743         txl_free(txl);
     913        td->home_timeline_obj = txl;
     914
     915      end:
     916        td->flags |= TWITTER_GOT_TIMELINE;
     917
     918        twitter_flush_timeline(ic);
     919}
     920
     921/**
     922 * Callback for getting mentions.
     923 */
     924static void twitter_http_get_mentions(struct http_request *req)
     925{
     926        struct im_connection *ic = req->data;
     927        struct twitter_data *td;
     928        struct xt_parser *parser;
     929        struct twitter_xml_list *txl;
     930
     931        // Check if the connection is still active.
     932        if (!g_slist_find(twitter_connections, ic))
     933                return;
     934
     935        td = ic->proto_data;
     936
     937        // Check if the HTTP request went well.
     938        if (req->status_code == 200) {
     939                td->http_fails = 0;
     940                if (!(ic->flags & OPT_LOGGED_IN))
     941                        imcb_connected(ic);
     942        } else if (req->status_code == 401) {
     943                imcb_error(ic, "Authentication failure");
     944                imc_logout(ic, FALSE);
     945                goto end;
     946        } else {
     947                // It didn't go well, output the error and return.
     948                if (++td->http_fails >= 5)
     949                        imcb_error(ic, "Could not retrieve %s: %s",
     950                                   TWITTER_MENTIONS_URL, twitter_parse_error(req));
     951
     952                goto end;
     953        }
     954
     955        txl = g_new0(struct twitter_xml_list, 1);
     956        txl->list = NULL;
     957
     958        // Parse the data.
     959        parser = xt_new(NULL, txl);
     960        xt_feed(parser, req->reply_body, req->body_size);
     961        // The root <statuses> node should hold the list of statuses <status>
     962        twitter_xt_get_status_list(ic, parser->root, txl);
     963        xt_free(parser);
     964
     965        td->mentions_obj = txl;
     966
     967      end:
     968        td->flags |= TWITTER_GOT_MENTIONS;
     969
     970        twitter_flush_timeline(ic);
    744971}
    745972
  • protocols/twitter/twitter_lib.h

    r87dddee r6e9ae72  
    7676#define TWITTER_BLOCKS_DESTROY_URL "/blocks/destroy/"
    7777
     78void twitter_get_timeline(struct im_connection *ic, gint64 next_cursor);
    7879void twitter_get_friends_ids(struct im_connection *ic, gint64 next_cursor);
    7980void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor);
     81void twitter_get_mentions(struct im_connection *ic, gint64 next_cursor);
    8082void twitter_get_statuses_friends(struct im_connection *ic, gint64 next_cursor);
    8183
  • protocols/yahoo/libyahoo2.c

    r87dddee r6e9ae72  
    18091809        struct yahoo_input_data *yid = had->yid;
    18101810        struct yahoo_data *yd = yid->yd;
    1811         struct http_request *req;
    18121811        char *login, *passwd, *chal;
    18131812        char *url;
     
    18231822                               (int) time(NULL), login, passwd, chal);
    18241823       
    1825         req = http_dorequest_url(url, yahoo_https_auth_token_finish, had);
     1824        http_dorequest_url(url, yahoo_https_auth_token_finish, had);
    18261825       
    18271826        g_free(url);
     
    18701869static void yahoo_https_auth_init(struct yahoo_https_auth_data *had)
    18711870{
    1872         struct http_request *req;
    18731871        char *url;
    18741872       
     
    18761874                              (int) time(NULL), had->token);
    18771875       
    1878         req = http_dorequest_url(url, yahoo_https_auth_finish, had);
     1876        http_dorequest_url(url, yahoo_https_auth_finish, had);
    18791877       
    18801878        g_free(url);
     
    19901988{
    19911989        struct yahoo_data *yd = yid->yd;
    1992         char *login_id;
    1993         char *handle;
    19941990        char *url = NULL;
    19951991        int login_status = -1;
     
    20001996                struct yahoo_pair *pair = l->data;
    20011997                if (pair->key == 0)
    2002                         login_id = pair->value;
     1998                        ; /* login_id */
    20031999                else if (pair->key == 1)
    2004                         handle = pair->value;
     2000                        ; /* handle */
    20052001                else if (pair->key == 20)
    20062002                        url = pair->value;
     
    20892085        char *msg = NULL;
    20902086        char *name = NULL;
    2091         long tm = 0L;
    20922087        int state = YAHOO_STATUS_AVAILABLE;
    2093         int online = 0;
    20942088        int away = 0;
    20952089        int idle = 0;
     
    21112105                        state = strtol(pair->value, NULL, 10);
    21122106                else if (pair->key == 15)
    2113                         tm = strtol(pair->value, NULL, 10);
     2107                        ; /* tm */
    21142108                else if (pair->key == 13)
    2115                         online = strtol(pair->value, NULL, 10);
     2109                        ; /* online */
    21162110                else if (pair->key == 47)
    21172111                        away = strtol(pair->value, NULL, 10);
     
    21402134        char *where = NULL;
    21412135        int status = 0;
    2142         char *me = NULL;
    21432136
    21442137        struct yahoo_buddy *bud = NULL;
     
    21482141                struct yahoo_pair *pair = l->data;
    21492142                if (pair->key == 1)
    2150                         me = pair->value;
     2143                        ; /* Me... don't care */
    21512144                if (pair->key == 7)
    21522145                        who = pair->value;
     
    22042197        char *who = NULL;
    22052198        char *where = NULL;
    2206         int unk_66 = 0;
    2207         char *me = NULL;
    22082199        struct yahoo_buddy *bud;
    22092200
     
    22142205                struct yahoo_pair *pair = l->data;
    22152206                if (pair->key == 1)
    2216                         me = pair->value;
     2207                        ; /* Me... don't care */
    22172208                else if (pair->key == 7)
    22182209                        who = pair->value;
     
    22202211                        where = pair->value;
    22212212                else if (pair->key == 66)
    2222                         unk_66 = strtol(pair->value, NULL, 10);
     2213                        ; /* unk_66 */
    22232214                else
    22242215                        DEBUG_MSG(("unknown key: %d = %s", pair->key,
     
    22562247        struct yahoo_packet *pkt)
    22572248{
    2258         char *who = NULL;
    2259         int status = 0;
    2260         char *me = NULL;
    2261         int un_ignore = 0;
    2262 
    22632249        YList *l;
    22642250        for (l = pkt->hash; l; l = l->next) {
    22652251                struct yahoo_pair *pair = l->data;
    22662252                if (pair->key == 0)
    2267                         who = pair->value;
     2253                        ; /* who */
    22682254                if (pair->key == 1)
    2269                         me = pair->value;
     2255                        ; /* Me... don't care */
    22702256                if (pair->key == 13)    /* 1 == ignore, 2 == unignore */
    2271                         un_ignore = strtol(pair->value, NULL, 10);
     2257                        ;
    22722258                if (pair->key == 66)
    2273                         status = strtol(pair->value, NULL, 10);
     2259                        ; /* status */
    22742260        }
    22752261
     
    22932279        char *me = NULL;
    22942280        char *room = NULL;
    2295         char *voice_room = NULL;
    22962281
    22972282        YList *l;
     
    23032288                        me = pair->value;
    23042289                if (pair->key == 13)
    2305                         voice_room = pair->value;
     2290                        ; /* voice room */
    23062291                if (pair->key == 57)
    23072292                        room = pair->value;
     
    24382423        struct yahoo_packet *pkt)
    24392424{
    2440         char *me = NULL;
    24412425        char *key = NULL;
    24422426        char *who = NULL;
     
    24472431                struct yahoo_pair *pair = l->data;
    24482432                if (pair->key == 5)
    2449                         me = pair->value;
     2433                        ; /* me */
    24502434                if (pair->key == 61)
    24512435                        key = pair->value;
     
    33693353        struct yahoo_webcam *wcm = y->wcm;
    33703354        struct yahoo_input_data *yid;
    3371         struct yahoo_server_settings *yss;
    33723355
    33733356        if (!wcm || !wcm->server || !wcm->key)
     
    33813364        yid->wcm = y->wcm;
    33823365        y->wcm = NULL;
    3383 
    3384         yss = y->yd->server_settings;
    33853366
    33863367        yid->wcd = y_new0(struct yahoo_webcam_data, 1);
     
    49754956        YList *l;
    49764957        struct send_file_data *sfd;
    4977         char *who = NULL;
    4978         char *filename = NULL;
    49794958        char *id = NULL;
    49804959        char *token = NULL;
     
    49844963                switch (pair->key) {
    49854964                case 4:
    4986                         who = pair->value;
     4965                        /* who */
    49874966                        break;
    49884967                case 5:
     
    49984977                        break;
    49994978                case 27:
    5000                         filename = pair->value;
     4979                        /* filename */
    50014980                        break;
    50024981                }
     
    50235002{
    50245003        YList *l;
    5025         char *who = NULL;
    5026         char *filename = NULL;
    50275004        char *id = NULL;
    50285005        char *token = NULL;
     
    50365013                case 1:
    50375014                case 4:
    5038                         who = pair->value;
     5015                        /* who */
    50395016                        break;
    50405017                case 5:
     
    50535030                        break;
    50545031                case 27:
    5055                         filename = pair->value;
     5032                        /* filename */
    50565033                        break;
    50575034                }
Note: See TracChangeset for help on using the changeset viewer.