- Timestamp:
- 2011-12-17T13:50:01Z (13 years ago)
- 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. - Location:
- protocols
- Files:
-
- 22 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/io.c
r87dddee r6e9ae72 212 212 this is an old server that can't do SASL 213 213 authentication. */ 214 if( !s asl_supported( ic ) )214 if( !set_getbool( &ic->acc->set, "sasl") || !sasl_supported( ic ) ) 215 215 { 216 216 /* If there's no version= tag, we suppose … … 375 375 other way. jabber.com doesn't seem to do SASL while it pretends 376 376 to be XMPP 1.0 compliant! */ 377 else if( !( jd->flags & JFLAG_AUTHENTICATED ) && s asl_supported( ic ) )377 else if( !( jd->flags & JFLAG_AUTHENTICATED ) && set_getbool( &ic->acc->set, "sasl") && sasl_supported( ic ) ) 378 378 { 379 379 if( !jabber_init_iq_auth( ic ) ) -
protocols/jabber/jabber.c
r87dddee r6e9ae72 84 84 s->flags |= ACC_SET_OFFLINE_ONLY; 85 85 86 s = set_add( &acc->set, "sasl", "true", set_eval_bool, acc ); 87 s->flags |= ACC_SET_OFFLINE_ONLY | SET_HIDDEN_DEFAULT; 88 86 89 s = set_add( &acc->set, "user_agent", "BitlBee", NULL, acc ); 87 90 -
protocols/jabber/s5bytestream.c
r87dddee r6e9ae72 877 877 878 878 if( ( ( host = strchr( proxy, ',' ) ) == 0 ) || 879 ( ( port = strchr( host+1, ',' ) ) == 0 ) ) { 879 ( ( port = strchr( host+1, ',' ) ) == 0 ) ) 880 { 880 881 imcb_log( ic, "Error parsing proxy setting: \"%s\" (ignored)", proxy ); 881 882 return NULL; … … 889 890 sh->jid = g_strdup( jid ); 890 891 sh->host = g_strdup( host ); 891 strcpy( sh->port, port );892 g_snprintf( sh->port, sizeof( sh->port ), "%s", port ); 892 893 893 894 return sh; … … 915 916 sh->jid = g_strdup( tf->ini_jid ); 916 917 sh->host = g_strdup( host ); 917 strcpy( sh->port, port );918 g_snprintf( sh->port, sizeof( sh->port ), "%s", port ); 918 919 bt->streamhosts = g_slist_append( bt->streamhosts, sh ); 919 920 -
protocols/msn/ns.c
r87dddee r6e9ae72 480 480 else 481 481 { 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)" ); 483 484 } 484 485 -
protocols/msn/sb.c
r87dddee r6e9ae72 308 308 struct msn_switchboard *sb = data; 309 309 struct im_connection *ic; 310 struct msn_data *md;311 310 char buf[1024]; 312 311 … … 316 315 317 316 ic = sb->ic; 318 md = ic->proto_data;319 317 320 318 if( source != sb->fd ) … … 675 673 struct im_connection *ic = sb->ic; 676 674 char *body; 677 int blen = 0;678 675 679 676 if( !num_parts ) … … 681 678 682 679 if( ( body = strstr( msg, "\r\n\r\n" ) ) ) 683 {684 680 body += 4; 685 blen = msglen - ( body - msg );686 }687 681 688 682 if( strcmp( cmd[0], "MSG" ) == 0 ) -
protocols/msn/soap.c
r87dddee r6e9ae72 210 210 { 211 211 char *s; 212 int st;213 212 214 213 if( !getenv( "BITLBEE_DEBUG" ) ) 215 214 return; 216 215 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 ) 223 225 { 224 226 struct xt_node *xt = xt_from_string( payload ); … … 227 229 xt_free_node( xt ); 228 230 } 229 #endif230 231 } 231 232 … … 661 662 662 663 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 ); 664 665 665 666 return XT_HANDLED; … … 808 809 809 810 if( getenv( "BITLBEE_DEBUG" ) ) 810 printf("%s %s\n", id, name );811 fprintf( stderr, "%s %s\n", id, name ); 811 812 812 813 return XT_HANDLED; … … 869 870 870 871 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 ); 872 873 873 874 return XT_HANDLED; -
protocols/nogaim.c
r87dddee r6e9ae72 216 216 if( a ) 217 217 /* 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 ); 219 219 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 ); 221 221 222 222 g_free( text ); -
protocols/oscar/chat.c
r87dddee r6e9ae72 384 384 char *roomname = NULL; 385 385 struct aim_chat_roominfo roominfo; 386 guint16 tlvcount = 0;387 386 aim_tlvlist_t *tlvlist; 388 387 char *roomdesc = NULL; … … 401 400 } 402 401 403 tlvcount = aimbs_get16(bs);402 aimbs_get16(bs); /* tlv count */ 404 403 405 404 /* -
protocols/oscar/chatnav.c
r87dddee r6e9ae72 139 139 * Type 0x0002: Unknown 140 140 */ 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 ; 147 143 148 144 /* … … 205 201 */ 206 202 if (aim_gettlv(innerlist, 0x00d5, 1)) { 207 guint8 createperms; 208 209 createperms = aim_gettlv8(innerlist, 0x00d5, 1); 203 aim_gettlv8(innerlist, 0x00d5, 1); /* createperms */ 210 204 } 211 205 -
protocols/oscar/icq.c
r87dddee r6e9ae72 235 235 aim_tlv_t *datatlv; 236 236 aim_bstream_t qbs; 237 guint32 ouruin; 238 guint16 cmdlen, cmd, reqid; 237 guint16 cmd, reqid; 239 238 240 239 if (!(tl = aim_readtlvchain(bs)) || !(datatlv = aim_gettlv(tl, 0x0001, 1))) { … … 246 245 aim_bstream_init(&qbs, datatlv->value, datatlv->length); 247 246 248 cmdlen = aimbs_getle16(&qbs);249 ouruin = aimbs_getle32(&qbs);247 aimbs_getle16(&qbs); /* cmdlen */ 248 aimbs_getle32(&qbs); /* ouruin */ 250 249 cmd = aimbs_getle16(&qbs); 251 250 reqid = aimbs_getle16(&qbs); -
protocols/oscar/im.c
r87dddee r6e9ae72 919 919 int i, ret = 0; 920 920 aim_rxcallback_t userfunc; 921 guint8 cookie[8];922 921 guint16 channel; 923 922 aim_tlvlist_t *tlvlist; … … 931 930 /* ICBM Cookie. */ 932 931 for (i = 0; i < 8; i++) 933 cookie[i] =aimbs_get8(bs);932 aimbs_get8(bs); 934 933 935 934 /* Channel ID */ … … 1414 1413 { 1415 1414 guint16 hdrlen, msglen, dc; 1416 guint8 msgtype , msgflags;1415 guint8 msgtype; 1417 1416 guint8 *plugin; 1418 1417 int i = 0, tmp = 0; … … 1442 1441 1443 1442 msgtype = aimbs_getle8(servdata); 1444 msgflags = aimbs_getle8(servdata);1443 aimbs_getle8(servdata); /* msgflags */ 1445 1444 1446 1445 aim_bstream_advance(servdata, 0x04); /* status code and priority code */ -
protocols/oscar/misc.c
r87dddee r6e9ae72 310 310 { 311 311 aim_frame_t *fr; 312 aim_snacid_t snacid;313 312 aim_tlvlist_t *tl = NULL; 314 313 … … 330 329 return -ENOMEM; 331 330 332 snacid =aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0);331 aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0); 333 332 334 333 aim_putsnac(&fr->data, 0x0002, 0x000f, 0x0000, 0); -
protocols/oscar/oscar.c
r87dddee r6e9ae72 1072 1072 static void gaim_icq_authgrant(void *data_) { 1073 1073 struct icq_auth *data = data_; 1074 char *uin , message;1074 char *uin; 1075 1075 struct oscar_data *od = (struct oscar_data *)data->ic->proto_data; 1076 1076 1077 1077 uin = g_strdup_printf("%u", data->uin); 1078 message = 0;1079 1078 aim_ssi_auth_reply(od->sess, od->conn, uin, 1, ""); 1079 // char *message = 0; 1080 1080 // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message); 1081 1081 imcb_ask_add(data->ic, uin, NULL); … … 1219 1219 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { 1220 1220 va_list ap; 1221 guint16 chan,nummissed, reason;1221 guint16 nummissed, reason; 1222 1222 aim_userinfo_t *userinfo; 1223 1223 1224 1224 va_start(ap, fr); 1225 chan = (guint16)va_arg(ap, unsigned int);1225 va_arg(ap, unsigned int); /* chan */ 1226 1226 userinfo = va_arg(ap, aim_userinfo_t *); 1227 1227 nummissed = (guint16)va_arg(ap, unsigned int); … … 1335 1335 1336 1336 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { 1337 char *msg;1338 1337 guint16 id; 1339 1338 va_list ap; … … 1341 1340 va_start(ap, fr); 1342 1341 id = (guint16)va_arg(ap, unsigned int); 1343 msg = va_arg(ap, char *);1342 va_arg(ap, char *); /* msg */ 1344 1343 va_end(ap); 1345 1344 … … 1361 1360 switch(type) { 1362 1361 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 */ 1370 1365 va_end(ap); 1371 1366 … … 1380 1375 break; 1381 1376 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 */ 1388 1381 instance = (guint16)va_arg(ap, unsigned int); 1389 1382 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 */ 1397 1390 ck = va_arg(ap, char *); 1398 1391 va_end(ap); … … 1456 1449 static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) { 1457 1450 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; 1465 1452 struct im_connection *ic = sess->aux_data; 1466 1453 struct chat_connection *ccon = find_oscar_chat_by_conn(ic, fr->conn); 1467 1454 1468 1455 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 */ 1476 1463 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 */ 1479 1466 maxvisiblemsglen = (guint16)va_arg(ap, int); 1480 1467 va_end(ap); … … 1517 1504 #endif 1518 1505 va_list ap; 1519 guint16 code , rateclass;1520 guint32 windowsize, clear, alert, limit, disconnect, currentavg, maxavg;1506 guint16 code; 1507 guint32 windowsize, clear, currentavg; 1521 1508 1522 1509 va_start(ap, fr); 1523 1510 code = (guint16)va_arg(ap, unsigned int); 1524 rateclass= (guint16)va_arg(ap, unsigned int);1511 va_arg(ap, unsigned int); /* rateclass */ 1525 1512 windowsize = (guint32)va_arg(ap, unsigned long); 1526 1513 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 */ 1530 1517 currentavg = (guint32)va_arg(ap, unsigned long); 1531 maxavg = (guint32)va_arg(ap, unsigned long);1518 va_arg(ap, unsigned long); /* maxavg */ 1532 1519 va_end(ap); 1533 1520 … … 2102 2089 aim_ssi_addbuddies( sess, fr->conn, OSCAR_GROUP, &list, 1, 1 ); 2103 2090 } 2091 else if( st == 0x0A ) 2092 { 2093 imcb_error( sess->aux_data, "Buddy %s is already in your list", list ); 2094 } 2104 2095 else 2105 2096 { … … 2413 2404 struct im_connection * ic = sess->aux_data; 2414 2405 va_list ap; 2415 guint16 type 1, type2;2406 guint16 type2; 2416 2407 char * sn; 2417 2408 2418 2409 va_start(ap, fr); 2419 type1 = va_arg(ap, int);2410 va_arg(ap, int); /* type1 */ 2420 2411 sn = va_arg(ap, char*); 2421 2412 type2 = va_arg(ap, int); … … 2537 2528 2538 2529 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); 2542 2531 2543 2532 return ret; … … 2566 2555 static int chat_id = 0; 2567 2556 char * chatname, *s; 2568 struct groupchat *c;2569 2557 2570 2558 chatname = g_strdup_printf("%s%s%d", isdigit(*ic->acc->user) ? "icq" : "", … … 2575 2563 *s = '0'; 2576 2564 2577 c = imcb_chat_new(ic, chatname);2578 2565 ret = oscar_chat_join_internal(ic, chatname, NULL, NULL, 4); 2579 2566 aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0); … … 2581 2568 g_free(chatname); 2582 2569 2583 return NULL;2570 return ret; 2584 2571 } 2585 2572 -
protocols/oscar/rxqueue.c
r87dddee r6e9ae72 388 388 */ 389 389 if (aimbs_get8(&flaphdr) != 0x2a) { 390 guint8 start;391 392 390 aim_bstream_rewind(&flaphdr); 393 start =aimbs_get8(&flaphdr);391 aimbs_get8(&flaphdr); 394 392 imcb_error(sess->aux_data, "FLAP framing disrupted"); 395 393 aim_conn_close(conn); -
protocols/oscar/service.c
r87dddee r6e9ae72 563 563 groupcount = aimbs_get16(bs); 564 564 for (i = 0; i < groupcount; i++) { 565 guint16 group; 566 567 group = aimbs_get16(bs); 565 aimbs_get16(bs); 568 566 569 567 imcb_error(sess->aux_data, "bifurcated migration unsupported"); … … 701 699 static int hostversions(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 702 700 { 703 int vercount;704 701 guint8 *versions; 705 702 706 703 /* This is frivolous. (Thank you SmarterChild.) */ 707 vercount = aim_bstream_empty(bs)/4;704 aim_bstream_empty(bs); /* == vercount * 4 */ 708 705 versions = aimbs_getraw(bs, aim_bstream_empty(bs)); 709 706 g_free(versions); … … 731 728 aim_tlvlist_t *tl = NULL; 732 729 guint32 data; 733 int tlvlen;734 730 struct im_connection *ic = sess ? sess->aux_data : NULL; 735 731 … … 739 735 data |= AIM_ICQ_STATE_WEBAWARE; 740 736 741 tlvlen = aim_addtlvtochain32(&tl, 0x0006, data);737 aim_addtlvtochain32(&tl, 0x0006, data); /* tlvlen */ 742 738 743 739 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 8))) -
protocols/purple/purple.c
r87dddee r6e9ae72 181 181 /** No way to talk to the user right now, invent one when 182 182 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", 184 184 name, purple_account_option_get_type( o ) ); 185 185 */ … … 750 750 if( bud->server_alias ) 751 751 imcb_rename_buddy( ic, bud->name, bud->server_alias ); 752 else if( bud->alias ) 753 imcb_rename_buddy( ic, bud->name, bud->alias ); 752 754 753 755 if( group ) -
protocols/twitter/twitter.c
r87dddee r6e9ae72 30 30 31 31 #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 ); \ 38 38 } while( 0 ); 39 39 … … 52 52 53 53 // Do stuff.. 54 twitter_get_ home_timeline(ic, -1);54 twitter_get_timeline(ic, -1); 55 55 56 56 // If we are still logged in run this function again after timeout. … … 69 69 // Queue the main_loop 70 70 // 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); 72 73 } 73 74 … … 77 78 { 78 79 struct twitter_data *td = ic->proto_data; 80 81 td->flags &= ~TWITTER_DOING_TIMELINE; 79 82 80 83 if (set_getbool(&ic->acc->set, "oauth") && !td->oauth_info) … … 90 93 91 94 static 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", 94 97 "https://api.twitter.com/oauth/authorize", 95 98 .consumer_key = "xsDNKJuNZYkZyMcu914uEA", … … 98 101 99 102 static 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", 102 105 "https://identi.ca/api/oauth/authorize", 103 106 .consumer_key = "e147ff789fcbd8a5a07963afbb43f9da", … … 216 219 def_oauth = "true"; 217 220 } else { /* if( strcmp( acc->prpl->name, "identica" ) == 0 ) */ 218 219 221 def_url = IDENTICA_API_URL; 220 222 def_oauth = "false"; … … 228 230 s = set_add(&acc->set, "commands", "true", set_eval_bool, acc); 229 231 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 230 237 s = set_add(&acc->set, "message_length", "140", set_eval_int, acc); 231 238 … … 235 242 s = set_add(&acc->set, "show_ids", "false", set_eval_bool, acc); 236 243 s->flags |= ACC_SET_OFFLINE_ONLY; 244 245 s = set_add(&acc->set, "show_old_mentions", "true", set_eval_bool, acc); 237 246 238 247 s = set_add(&acc->set, "oauth", def_oauth, set_eval_bool, acc); … … 317 326 b_event_remove(td->main_loop_id); 318 327 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); 321 330 322 331 if (td) { … … 404 413 struct twitter_data *td = c->ic->proto_data; 405 414 406 if (c != td-> home_timeline_gc)415 if (c != td->timeline_gc) 407 416 return; /* WTF? */ 408 417 409 418 /* If the user leaves the channel: Fine. Rejoin him/her once new 410 419 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; 413 422 } 414 423 … … 465 474 guint64 id; 466 475 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 474 482 twitter_status_destroy(ic, id); 475 else483 } else 476 484 twitter_msg(ic, "Could not undo last action"); 477 485 … … 491 499 guint64 id; 492 500 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])) && 494 506 (tud = bu->data) && tud->last_id) 495 507 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){ 498 509 if (id < TWITTER_LOG_LENGTH && td->log) 499 510 id = td->log[id].id; … … 514 525 guint64 id = 0; 515 526 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])) && 517 536 (tud = bu->data) && tud->last_id) { 518 537 id = tud->last_id; … … 525 544 bu = NULL; 526 545 } 546 527 547 if (!id || !bu) { 528 548 twitter_msg(ic, "User `%s' does not exist or didn't " -
protocols/twitter/twitter.h
r87dddee r6e9ae72 36 36 { 37 37 TWITTER_HAVE_FRIENDS = 1, 38 TWITTER_DOING_TIMELINE = 0x10000, 39 TWITTER_GOT_TIMELINE = 0x20000, 40 TWITTER_GOT_MENTIONS = 0x40000, 38 41 } twitter_flags_t; 39 42 … … 44 47 char* user; 45 48 struct oauth_info *oauth_info; 49 50 gpointer home_timeline_obj; 51 gpointer mentions_obj; 52 53 guint64 timeline_id; 54 46 55 GSList *follow_ids; 47 56 48 guint64 home_timeline_id;49 57 guint64 last_status_id; /* For undo */ 50 58 gint main_loop_id; 51 struct groupchat * home_timeline_gc;59 struct groupchat *timeline_gc; 52 60 gint http_fails; 53 61 twitter_flags_t flags; -
protocols/twitter/twitter_lib.c
r87dddee r6e9ae72 78 78 if (txu == NULL) 79 79 return; 80 80 81 g_free(txu->name); 81 82 g_free(txu->screen_name); … … 83 84 } 84 85 85 86 86 /** 87 87 * Frees a twitter_xml_status struct. … … 89 89 static void txs_free(struct twitter_xml_status *txs) 90 90 { 91 if (txs == NULL) 92 return; 93 91 94 g_free(txs->text); 92 95 txu_free(txs->user); … … 103 106 if (txl == NULL) 104 107 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) { 107 111 txs_free((struct twitter_xml_status *) l->data); 108 else if (txl->type == TXL_ID)112 } else if (txl->type == TXL_ID) { 109 113 g_free(l->data); 110 else if (txl->type == TXL_USER)114 } else if (txl->type == TXL_USER) { 111 115 txu_free(l->data); 116 } 117 } 118 112 119 g_slist_free(txl->list); 113 120 g_free(txl); … … 115 122 116 123 /** 117 * Add a buddy if it is not allready added, set the status to logged in. 124 * Compare status elements 125 */ 126 static 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. 118 142 */ 119 143 static void twitter_add_buddy(struct im_connection *ic, char *name, const char *fullname) … … 132 156 exact Twitter username. */ 133 157 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); 135 159 } else if (g_strcasecmp(mode, "many") == 0) 136 160 imcb_buddy_status(ic, name, OPT_LOGGED_IN, NULL, NULL); … … 260 284 261 285 /* 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) 263 287 twitter_groupchat_init(ic); 264 288 … … 436 460 { 437 461 struct xt_node *child, *rt = NULL; 438 gboolean truncated = FALSE;439 462 440 463 // Walk over the nodes children. … … 442 465 if (g_strcasecmp("text", child->name) == 0) { 443 466 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);446 467 } else if (g_strcasecmp("retweeted_status", child->name) == 0) { 447 468 rt = child; … … 464 485 } 465 486 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) { 468 490 struct twitter_xml_status *rtxs = g_new0(struct twitter_xml_status, 1); 469 491 if (twitter_xt_get_status(rt, rtxs) != XT_HANDLED) { … … 475 497 txs->text = g_strdup_printf("RT @%s: %s", rtxs->user->screen_name, rtxs->text); 476 498 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 <%s>%s", txs->text, kort->text, 515 disp->text, pos + strlen(kort->text)); 516 517 g_free(txs->text); 518 txs->text = new; 519 } 477 520 } 478 521 … … 520 563 521 564 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 }548 565 } 549 566 … … 586 603 GSList *l; 587 604 588 td-> home_timeline_gc = gc = imcb_chat_new(ic, "home/timeline");605 td->timeline_gc = gc = imcb_chat_new(ic, "twitter/timeline"); 589 606 590 607 name_hint = g_strdup_printf("%s_%s", td->prefix, ic->acc->user); … … 595 612 bee_user_t *bu = l->data; 596 613 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); 598 615 } 599 616 } … … 608 625 struct twitter_xml_status *status; 609 626 struct groupchat *gc; 627 guint64 last_id = 0; 610 628 611 629 // Create a new groupchat if it does not exsist. 612 if (!td-> home_timeline_gc)630 if (!td->timeline_gc) 613 631 twitter_groupchat_init(ic); 614 632 615 gc = td-> home_timeline_gc;633 gc = td->timeline_gc; 616 634 if (!gc->joined) 617 635 imcb_chat_add_buddy(gc, ic->acc->user); … … 621 639 622 640 status = l->data; 623 if (status->user == NULL || status->text == NULL )641 if (status->user == NULL || status->text == NULL || last_id == status->id) 624 642 continue; 625 643 626 twitter_add_buddy(ic, status->user->screen_name, status->user->name);644 last_id = status->id; 627 645 628 646 strip_html(status->text); 647 629 648 msg = twitter_msg_add_id(ic, status, ""); 630 649 631 650 // Say it! 632 if (g_strcasecmp(td->user, status->user->screen_name) == 0) 651 if (g_strcasecmp(td->user, status->user->screen_name) == 0) { 633 652 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 635 656 imcb_chat_msg(gc, status->user->screen_name, 636 657 msg ? msg : status->text, 0, status->created_at); 658 } 637 659 638 660 g_free(msg); 639 661 640 // Update the home_timeline_id to hold the highest id, so that by the next request662 // Update the timeline_id to hold the highest id, so that by the next request 641 663 // 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); 643 665 } 644 666 } … … 654 676 char from[MAX_STRING]; 655 677 gboolean mode_one; 678 guint64 last_id = 0; 656 679 657 680 mode_one = g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "one") == 0; … … 666 689 667 690 status = l->data; 691 if (status->user == NULL || status->text == NULL || last_id == status->id) 692 continue; 693 694 last_id = status->id; 668 695 669 696 strip_html(status->text); … … 680 707 text ? text : status->text, 0, status->created_at); 681 708 682 // Update the home_timeline_id to hold the highest id, so that by the next request709 // Update the timeline_id to hold the highest id, so that by the next request 683 710 // 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); 685 712 686 713 g_free(text); 687 714 g_free(prefix); 715 } 716 } 717 718 static void twitter_http_get_home_timeline(struct http_request *req); 719 static void twitter_http_get_mentions(struct http_request *req); 720 721 /** 722 * Get the timeline with optionally mentions 723 */ 724 void 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 */ 746 void 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 */ 802 void 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 */ 837 void 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]); 688 866 } 689 867 } … … 713 891 imcb_error(ic, "Authentication failure"); 714 892 imc_logout(ic, FALSE); 715 return;893 goto end; 716 894 } else { 717 895 // It didn't go well, output the error and return. … … 720 898 TWITTER_HOME_TIMELINE_URL, twitter_parse_error(req)); 721 899 722 return;900 goto end; 723 901 } 724 902 … … 733 911 xt_free(parser); 734 912 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 */ 924 static 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); 744 971 } 745 972 -
protocols/twitter/twitter_lib.h
r87dddee r6e9ae72 76 76 #define TWITTER_BLOCKS_DESTROY_URL "/blocks/destroy/" 77 77 78 void twitter_get_timeline(struct im_connection *ic, gint64 next_cursor); 78 79 void twitter_get_friends_ids(struct im_connection *ic, gint64 next_cursor); 79 80 void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor); 81 void twitter_get_mentions(struct im_connection *ic, gint64 next_cursor); 80 82 void twitter_get_statuses_friends(struct im_connection *ic, gint64 next_cursor); 81 83 -
protocols/yahoo/libyahoo2.c
r87dddee r6e9ae72 1809 1809 struct yahoo_input_data *yid = had->yid; 1810 1810 struct yahoo_data *yd = yid->yd; 1811 struct http_request *req;1812 1811 char *login, *passwd, *chal; 1813 1812 char *url; … … 1823 1822 (int) time(NULL), login, passwd, chal); 1824 1823 1825 req =http_dorequest_url(url, yahoo_https_auth_token_finish, had);1824 http_dorequest_url(url, yahoo_https_auth_token_finish, had); 1826 1825 1827 1826 g_free(url); … … 1870 1869 static void yahoo_https_auth_init(struct yahoo_https_auth_data *had) 1871 1870 { 1872 struct http_request *req;1873 1871 char *url; 1874 1872 … … 1876 1874 (int) time(NULL), had->token); 1877 1875 1878 req =http_dorequest_url(url, yahoo_https_auth_finish, had);1876 http_dorequest_url(url, yahoo_https_auth_finish, had); 1879 1877 1880 1878 g_free(url); … … 1990 1988 { 1991 1989 struct yahoo_data *yd = yid->yd; 1992 char *login_id;1993 char *handle;1994 1990 char *url = NULL; 1995 1991 int login_status = -1; … … 2000 1996 struct yahoo_pair *pair = l->data; 2001 1997 if (pair->key == 0) 2002 login_id = pair->value;1998 ; /* login_id */ 2003 1999 else if (pair->key == 1) 2004 handle = pair->value;2000 ; /* handle */ 2005 2001 else if (pair->key == 20) 2006 2002 url = pair->value; … … 2089 2085 char *msg = NULL; 2090 2086 char *name = NULL; 2091 long tm = 0L;2092 2087 int state = YAHOO_STATUS_AVAILABLE; 2093 int online = 0;2094 2088 int away = 0; 2095 2089 int idle = 0; … … 2111 2105 state = strtol(pair->value, NULL, 10); 2112 2106 else if (pair->key == 15) 2113 tm = strtol(pair->value, NULL, 10);2107 ; /* tm */ 2114 2108 else if (pair->key == 13) 2115 online = strtol(pair->value, NULL, 10);2109 ; /* online */ 2116 2110 else if (pair->key == 47) 2117 2111 away = strtol(pair->value, NULL, 10); … … 2140 2134 char *where = NULL; 2141 2135 int status = 0; 2142 char *me = NULL;2143 2136 2144 2137 struct yahoo_buddy *bud = NULL; … … 2148 2141 struct yahoo_pair *pair = l->data; 2149 2142 if (pair->key == 1) 2150 me = pair->value;2143 ; /* Me... don't care */ 2151 2144 if (pair->key == 7) 2152 2145 who = pair->value; … … 2204 2197 char *who = NULL; 2205 2198 char *where = NULL; 2206 int unk_66 = 0;2207 char *me = NULL;2208 2199 struct yahoo_buddy *bud; 2209 2200 … … 2214 2205 struct yahoo_pair *pair = l->data; 2215 2206 if (pair->key == 1) 2216 me = pair->value;2207 ; /* Me... don't care */ 2217 2208 else if (pair->key == 7) 2218 2209 who = pair->value; … … 2220 2211 where = pair->value; 2221 2212 else if (pair->key == 66) 2222 unk_66 = strtol(pair->value, NULL, 10);2213 ; /* unk_66 */ 2223 2214 else 2224 2215 DEBUG_MSG(("unknown key: %d = %s", pair->key, … … 2256 2247 struct yahoo_packet *pkt) 2257 2248 { 2258 char *who = NULL;2259 int status = 0;2260 char *me = NULL;2261 int un_ignore = 0;2262 2263 2249 YList *l; 2264 2250 for (l = pkt->hash; l; l = l->next) { 2265 2251 struct yahoo_pair *pair = l->data; 2266 2252 if (pair->key == 0) 2267 who = pair->value;2253 ; /* who */ 2268 2254 if (pair->key == 1) 2269 me = pair->value;2255 ; /* Me... don't care */ 2270 2256 if (pair->key == 13) /* 1 == ignore, 2 == unignore */ 2271 un_ignore = strtol(pair->value, NULL, 10);2257 ; 2272 2258 if (pair->key == 66) 2273 status = strtol(pair->value, NULL, 10);2259 ; /* status */ 2274 2260 } 2275 2261 … … 2293 2279 char *me = NULL; 2294 2280 char *room = NULL; 2295 char *voice_room = NULL;2296 2281 2297 2282 YList *l; … … 2303 2288 me = pair->value; 2304 2289 if (pair->key == 13) 2305 voice_room = pair->value;2290 ; /* voice room */ 2306 2291 if (pair->key == 57) 2307 2292 room = pair->value; … … 2438 2423 struct yahoo_packet *pkt) 2439 2424 { 2440 char *me = NULL;2441 2425 char *key = NULL; 2442 2426 char *who = NULL; … … 2447 2431 struct yahoo_pair *pair = l->data; 2448 2432 if (pair->key == 5) 2449 me = pair->value;2433 ; /* me */ 2450 2434 if (pair->key == 61) 2451 2435 key = pair->value; … … 3369 3353 struct yahoo_webcam *wcm = y->wcm; 3370 3354 struct yahoo_input_data *yid; 3371 struct yahoo_server_settings *yss;3372 3355 3373 3356 if (!wcm || !wcm->server || !wcm->key) … … 3381 3364 yid->wcm = y->wcm; 3382 3365 y->wcm = NULL; 3383 3384 yss = y->yd->server_settings;3385 3366 3386 3367 yid->wcd = y_new0(struct yahoo_webcam_data, 1); … … 4975 4956 YList *l; 4976 4957 struct send_file_data *sfd; 4977 char *who = NULL;4978 char *filename = NULL;4979 4958 char *id = NULL; 4980 4959 char *token = NULL; … … 4984 4963 switch (pair->key) { 4985 4964 case 4: 4986 who = pair->value;4965 /* who */ 4987 4966 break; 4988 4967 case 5: … … 4998 4977 break; 4999 4978 case 27: 5000 filename = pair->value;4979 /* filename */ 5001 4980 break; 5002 4981 } … … 5023 5002 { 5024 5003 YList *l; 5025 char *who = NULL;5026 char *filename = NULL;5027 5004 char *id = NULL; 5028 5005 char *token = NULL; … … 5036 5013 case 1: 5037 5014 case 4: 5038 who = pair->value;5015 /* who */ 5039 5016 break; 5040 5017 case 5: … … 5053 5030 break; 5054 5031 case 27: 5055 filename = pair->value;5032 /* filename */ 5056 5033 break; 5057 5034 }
Note: See TracChangeset
for help on using the changeset viewer.