Changes in / [3f81999:fc34fb5]
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.h
r3f81999 rfc34fb5 36 36 37 37 #define PACKAGE "BitlBee" 38 #define BITLBEE_VERSION "1.2. 4"38 #define BITLBEE_VERSION "1.2.3" 39 39 #define VERSION BITLBEE_VERSION 40 40 -
doc/CHANGES
r3f81999 rfc34fb5 3 3 4 4 http://bugs.bitlbee.org/bitlbee/timeline?daysback=90&changeset=on 5 6 Version 1.2.4:7 - Most important change (and main reason for releasing now): Upgraded Yahoo!8 module to a newer version to get it working again.9 - join_chat command replaced with the much better chat command:10 * Similar to how account replaced login/slist/logout. Add a chatroom once,11 then just /join it like any other room. Also automatic joining at login12 time is now possible.13 * Note that the old way of starting groupchats (/join #nickname) is now14 also deprecated, use "chat with" instead.15 * See "help chat" and "help chat add" for more information.16 - Rewrote bitlbee.conf parser to be less dumb.17 - Fixed compatibility (hopefully) with AIM mobile messages, certain kinds18 of Google Talk chatrooms.19 - Fixed numerous stability/reliability bugs over the last year.20 21 Finished 17 Oct 200922 5 23 6 Version 1.2.3: -
doc/user-guide/commands.xml
r3f81999 rfc34fb5 175 175 After adding a room to your list, you can simply use the IRC /join command to enter the room. Also, you can tell BitlBee to automatically join the room when you log in. (See <emphasis>chat set</emphasis>) 176 176 </para> 177 178 <para>179 Password-protected rooms work exactly like on IRC, by passing the password as an extra argument to /join.180 </para>181 177 </description> 182 178 -
irc_commands.c
r3f81999 rfc34fb5 415 415 if( g_hash_table_lookup_extended( irc->watches, nick, &okey, &ovalue ) ) 416 416 { 417 g_free( okey ); 417 418 g_hash_table_remove( irc->watches, okey ); 418 g_free( okey );419 419 420 420 irc_reply( irc, 602, "%s %s %s %d :%s", nick, "*", "*", 0, "Stopped watching" ); -
lib/ini.c
r3f81999 rfc34fb5 43 43 ini->cur = ini->file; 44 44 ini->c_section = ""; 45 46 close( fd );47 48 45 return ini; 49 46 } 50 47 48 g_free( ini ); 51 49 if( fd >= 0 ) 52 50 close( fd ); 53 54 ini_close( ini );55 51 56 52 return NULL; -
protocols/jabber/conference.c
r3f81999 rfc34fb5 234 234 ( strcmp( s, XMLNS_MUC_USER ) == 0 ) ) 235 235 { 236 struct xt_node *item; 237 238 item = xt_find_node( c->children, "item" ); 239 if( ( s = xt_find_attr( item, "jid" ) ) ) 236 c = xt_find_node( c->children, "item" ); 237 if( ( s = xt_find_attr( c, "jid" ) ) ) 240 238 { 241 239 /* Yay, found what we need. :-) */ … … 285 283 else if( type ) /* type can only be NULL or "unavailable" in this function */ 286 284 { 287 if( ( bud->flags & JBFLAG_IS_CHATROOM ) && bud->ext_jid ) 288 { 289 s = strchr( bud->ext_jid, '/' ); 290 if( s ) *s = 0; 291 imcb_chat_remove_buddy( chat, bud->ext_jid, NULL ); 292 if( bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS ) 293 imcb_remove_buddy( ic, bud->ext_jid, NULL ); 294 if( s ) *s = '/'; 295 } 285 s = strchr( bud->ext_jid, '/' ); 286 if( s ) *s = 0; 287 imcb_chat_remove_buddy( chat, bud->ext_jid, NULL ); 288 if( bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS ) 289 imcb_remove_buddy( ic, bud->ext_jid, NULL ); 290 if( s ) *s = '/'; 296 291 297 292 if( bud == jc->me ) -
protocols/jabber/iq.c
r3f81999 rfc34fb5 51 51 { 52 52 if( !( ( c = xt_find_node( node->children, "query" ) ) || 53 ( c = xt_find_node( node->children, "ping" ) ) ) || 53 ( c = xt_find_node( node->children, "ping" ) ) ) || /* O_o WHAT is wrong with just <query/> ????? */ 54 54 !( s = xt_find_attr( c, "xmlns" ) ) ) 55 55 { 56 /* Sigh. Who decided to suddenly invent new elements 57 instead of just sticking with <query/>? */ 56 imcb_log( ic, "Warning: Received incomplete IQ-%s packet", type ); 58 57 return XT_HANDLED; 59 58 } -
protocols/nogaim.c
r3f81999 rfc34fb5 506 506 } 507 507 508 509 struct imcb_ask_cb_data 508 /* prpl.c */ 509 510 struct show_got_added_data 510 511 { 511 512 struct im_connection *ic; … … 513 514 }; 514 515 515 static void imcb_ask_auth_cb_no( void *data ) 516 { 517 struct imcb_ask_cb_data *cbd = data; 518 519 cbd->ic->acc->prpl->auth_deny( cbd->ic, cbd->handle ); 520 521 g_free( cbd->handle ); 522 g_free( cbd ); 523 } 524 525 static void imcb_ask_auth_cb_yes( void *data ) 526 { 527 struct imcb_ask_cb_data *cbd = data; 528 529 cbd->ic->acc->prpl->auth_allow( cbd->ic, cbd->handle ); 530 531 g_free( cbd->handle ); 532 g_free( cbd ); 533 } 534 535 void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname ) 536 { 537 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); 538 char *s, *realname_ = NULL; 539 540 if( realname != NULL ) 541 realname_ = g_strdup_printf( " (%s)", realname ); 542 543 s = g_strdup_printf( "The user %s%s wants to add you to his/her buddy list.", 544 handle, realname_ ?: "" ); 545 546 g_free( realname_ ); 547 548 data->ic = ic; 549 data->handle = g_strdup( handle ); 550 query_add( ic->irc, ic, s, imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data ); 551 } 552 553 554 static void imcb_ask_add_cb_no( void *data ) 555 { 556 g_free( ((struct imcb_ask_cb_data*)data)->handle ); 516 void show_got_added_no( void *data ) 517 { 518 g_free( ((struct show_got_added_data*)data)->handle ); 557 519 g_free( data ); 558 520 } 559 521 560 static void imcb_ask_add_cb_yes( void *data ) 561 { 562 struct imcb_ask_cb_data *cbd = data; 563 564 cbd->ic->acc->prpl->add_buddy( cbd->ic, cbd->handle, NULL ); 565 566 return imcb_ask_add_cb_no( data ); 567 } 568 569 void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ) 570 { 571 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); 522 void show_got_added_yes( void *data ) 523 { 524 struct show_got_added_data *sga = data; 525 526 sga->ic->acc->prpl->add_buddy( sga->ic, sga->handle, NULL ); 527 /* imcb_add_buddy( sga->ic, NULL, sga->handle, sga->handle ); */ 528 529 return show_got_added_no( data ); 530 } 531 532 void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ) 533 { 534 struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 ); 572 535 char *s; 573 536 … … 580 543 data->ic = ic; 581 544 data->handle = g_strdup( handle ); 582 query_add( ic->irc, ic, s, imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data );545 query_add( ic->irc, ic, s, show_got_added_yes, show_got_added_no, data ); 583 546 } 584 547 -
protocols/nogaim.h
r3f81999 rfc34fb5 228 228 * - Most protocols will just want to set this to g_strcasecmp().*/ 229 229 int (* handle_cmp) (const char *who1, const char *who2); 230 231 /* Implement these callbacks if you want to use imcb_ask_auth() */232 void (* auth_allow) (struct im_connection *, const char *who);233 void (* auth_deny) (struct im_connection *, const char *who);234 230 }; 235 231 … … 260 256 /* To tell the user an error, ie. before logging out when an error occurs. */ 261 257 G_MODULE_EXPORT void imcb_error( struct im_connection *ic, char *format, ... ) G_GNUC_PRINTF( 2, 3 ); 262 263 258 /* To ask a your about something. 264 259 * - 'msg' is the question. … … 267 262 */ 268 263 G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont ); 269 270 /* Two common questions you may want to ask: 271 * - X added you to his contact list, allow? 272 * - X is not in your contact list, want to add? 273 */ 274 G_MODULE_EXPORT void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname ); 275 G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ); 264 G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ); 276 265 277 266 /* Buddy management */ -
protocols/oscar/aim.h
r3f81999 rfc34fb5 144 144 } 145 145 146 #define AIM_CLIENTINFO_KNOWNGOOD_5_1_3036 { \147 "AOL Instant Messenger, version 5.1.3036/WIN32", \148 0x0109, \149 0x0005, \150 0x0001, \151 0x0000, \152 0x0bdc, \153 "us", \154 "en", \155 }156 157 146 /* 158 147 * I would make 4.1.2010 the default, but they seem to have found … … 163 152 * around. (see login.c::memrequest()) 164 153 */ 165 #define AIM_CLIENTINFO_KNOWNGOOD AIM_CLIENTINFO_KNOWNGOOD_ 5_1_3036154 #define AIM_CLIENTINFO_KNOWNGOOD AIM_CLIENTINFO_KNOWNGOOD_3_5_1670 166 155 167 156 #ifndef TRUE -
protocols/yahoo/libyahoo2.c
r3f81999 rfc34fb5 91 91 92 92 #include "base64.h" 93 #include "http_client.h"94 93 95 94 #ifdef USE_STRUCT_CALLBACKS … … 172 171 YAHOO_SERVICE_GOTGROUPRENAME, /* < 1, 36(old), 37(new) */ 173 172 YAHOO_SERVICE_SYSMESSAGE = 0x14, 174 YAHOO_SERVICE_SKINNAME = 0x15,175 173 YAHOO_SERVICE_PASSTHROUGH2 = 0x16, 176 174 YAHOO_SERVICE_CONFINVITE = 0x18, … … 196 194 YAHOO_SERVICE_LIST, 197 195 YAHOO_SERVICE_AUTH = 0x57, 198 YAHOO_SERVICE_AUTHBUDDY = 0x6d,199 196 YAHOO_SERVICE_ADDBUDDY = 0x83, 200 197 YAHOO_SERVICE_REMBUDDY, … … 202 199 YAHOO_SERVICE_REJECTCONTACT, 203 200 YAHOO_SERVICE_GROUPRENAME = 0x89, /* > 1, 65(new), 66(0), 67(old) */ 204 YAHOO_SERVICE_Y7_PING = 0x8A, /* 0 - id and that's it?? */205 201 YAHOO_SERVICE_CHATONLINE = 0x96, /* > 109(id), 1, 6(abcde) < 0,1*/ 206 202 YAHOO_SERVICE_CHATGOTO, … … 208 204 YAHOO_SERVICE_CHATLEAVE, 209 205 YAHOO_SERVICE_CHATEXIT = 0x9b, 210 YAHOO_SERVICE_CHATADDINVITE = 0x9d,211 206 YAHOO_SERVICE_CHATLOGOUT = 0xa0, 212 207 YAHOO_SERVICE_CHATPING, … … 216 211 YAHOO_SERVICE_PICTURE = 0xbe, 217 212 YAHOO_SERVICE_PICTURE_UPDATE = 0xc1, 218 YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2, 219 YAHOO_SERVICE_Y6_VISIBILITY=0xc5, 220 YAHOO_SERVICE_Y6_STATUS_UPDATE=0xc6, 221 YAHOO_PHOTOSHARE_INIT=0xd2, 222 YAHOO_SERVICE_CONTACT_YMSG13=0xd6, 223 YAHOO_PHOTOSHARE_PREV=0xd7, 224 YAHOO_PHOTOSHARE_KEY=0xd8, 225 YAHOO_PHOTOSHARE_TRANS=0xda, 226 YAHOO_FILE_TRANSFER_INIT_YMSG13=0xdc, 227 YAHOO_FILE_TRANSFER_GET_YMSG13=0xdd, 228 YAHOO_FILE_TRANSFER_PUT_YMSG13=0xde, 229 YAHOO_SERVICE_YMSG15_STATUS=0xf0, 230 YAHOO_SERVICE_YMSG15_BUDDY_LIST=0xf1, 213 YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2 231 214 }; 232 215 … … 752 735 753 736 memcpy(data + pos, "YMSG", 4); pos += 4; 754 pos += yahoo_put16(data + pos, YAHOO_PROTO_VER);737 pos += yahoo_put16(data + pos, 0x000c); 755 738 pos += yahoo_put16(data + pos, 0x0000); 756 739 pos += yahoo_put16(data + pos, pktlen + extra_pad); … … 766 749 yahoo_send_data(yid->fd, data, len); 767 750 else 768 751 yahoo_add_to_send_queue(yid, data, len); 769 752 FREE(data); 770 753 } … … 1486 1469 1487 1470 if (u->name != NULL) { 1488 if (pkt->service == YAHOO_SERVICE_LOGOFF ) { /* || u->flags == 0) { Not in YMSG16 */1471 if (pkt->service == YAHOO_SERVICE_LOGOFF || u->flags == 0) { 1489 1472 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0); 1490 1473 } else { 1491 /* Key 47 always seems to be 1 for YMSG16 */1492 if(!u->state)1493 u->away = 0;1494 else1495 u->away = 1;1496 1497 1474 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, u->state, u->msg, u->away, u->idle, u->mobile); 1498 1475 } … … 1502 1479 y_list_free_1(t); 1503 1480 FREE(u); 1504 }1505 }1506 1507 static void yahoo_process_buddy_list(struct yahoo_input_data *yid, struct yahoo_packet *pkt)1508 {1509 struct yahoo_data *yd = yid->yd;1510 YList *l;1511 int last_packet = 0;1512 char *cur_group = NULL;1513 struct yahoo_buddy *newbud = NULL;1514 1515 /* we could be getting multiple packets here */1516 for (l = pkt->hash; l; l = l->next) {1517 struct yahoo_pair *pair = l->data;1518 1519 switch(pair->key) {1520 case 300:1521 case 301:1522 case 302:1523 case 303:1524 if ( 315 == atoi(pair->value) )1525 last_packet = 1;1526 break;1527 case 65:1528 g_free(cur_group);1529 cur_group = strdup(pair->value);1530 break;1531 case 7:1532 newbud = y_new0(struct yahoo_buddy, 1);1533 newbud->id = strdup(pair->value);1534 if(cur_group)1535 newbud->group = strdup(cur_group);1536 else {1537 struct yahoo_buddy *lastbud = (struct yahoo_buddy *)y_list_nth(1538 yd->buddies, y_list_length(yd->buddies)-1)->data;1539 newbud->group = strdup(lastbud->group);1540 }1541 1542 yd->buddies = y_list_append(yd->buddies, newbud);1543 1544 break;1545 }1546 }1547 1548 g_free(cur_group);1549 1550 /* we could be getting multiple packets here */1551 if (last_packet)1552 return;1553 1554 YAHOO_CALLBACK(ext_yahoo_got_buddies)(yd->client_id, yd->buddies);1555 1556 /*** We login at the very end of the packet communication */1557 if (!yd->logged_in) {1558 yd->logged_in = TRUE;1559 if(yd->current_status < 0)1560 yd->current_status = yd->initial_status;1561 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_OK, NULL);1562 1481 } 1563 1482 } … … 1632 1551 } 1633 1552 1634 if(yd->cookie_y && yd->cookie_t )1553 if(yd->cookie_y && yd->cookie_t && yd->cookie_c) 1635 1554 YAHOO_CALLBACK(ext_yahoo_got_cookies)(yd->client_id); 1636 1555 … … 2309 2228 } 2310 2229 2311 struct yahoo_https_auth_data2312 {2313 struct yahoo_input_data *yid;2314 char *token;2315 char *chal;2316 };2317 2318 static void yahoo_https_auth_token_init(struct yahoo_https_auth_data *had);2319 static void yahoo_https_auth_token_finish(struct http_request *req);2320 static void yahoo_https_auth_init(struct yahoo_https_auth_data *had);2321 static void yahoo_https_auth_finish(struct http_request *req);2322 2323 /* Extract a value from a login.yahoo.com response. Assume CRLF-linebreaks2324 and FAIL miserably if they're not there... */2325 static char *yahoo_ha_find_key(char *response, char *key)2326 {2327 char *s, *end;2328 int len = strlen(key);2329 2330 s = response;2331 do {2332 if (strncmp(s, key, len) == 0 && s[len] == '=') {2333 s += len + 1;2334 if ((end = strchr(s, '\r')))2335 return g_strndup(s, end - s);2336 else2337 return g_strdup(s);2338 }2339 2340 if ((s = strchr(s, '\n')))2341 s ++;2342 } while (s && *s);2343 2344 return NULL;2345 }2346 2347 static enum yahoo_status yahoo_https_status_parse(int code)2348 {2349 switch (code)2350 {2351 case 1212: return YAHOO_LOGIN_PASSWD;2352 case 1213: return YAHOO_LOGIN_LOCK;2353 case 1235: return YAHOO_LOGIN_UNAME;2354 default: return (enum yahoo_status) code;2355 }2356 }2357 2358 static void yahoo_process_auth_0x10(struct yahoo_input_data *yid, const char *seed, const char *sn)2359 {2360 struct yahoo_https_auth_data *had = g_new0(struct yahoo_https_auth_data, 1);2361 2362 had->yid = yid;2363 had->chal = g_strdup(seed);2364 2365 yahoo_https_auth_token_init(had);2366 }2367 2368 static void yahoo_https_auth_token_init(struct yahoo_https_auth_data *had)2369 {2370 struct yahoo_input_data *yid = had->yid;2371 struct yahoo_data *yd = yid->yd;2372 struct http_request *req;2373 char *login, *passwd, *chal;2374 char *url;2375 2376 login = g_strndup(yd->user, 3 * strlen(yd->user));2377 http_encode(login);2378 passwd = g_strndup(yd->password, 3 * strlen(yd->password));2379 http_encode(passwd);2380 chal = g_strndup(had->chal, 3 * strlen(had->chal));2381 http_encode(chal);2382 2383 url = g_strdup_printf("https://login.yahoo.com/config/pwtoken_get?src=ymsgr&ts=%d&login=%s&passwd=%s&chal=%s",2384 (int) time(NULL), login, passwd, chal);2385 2386 req = http_dorequest_url(url, yahoo_https_auth_token_finish, had);2387 2388 g_free(url);2389 g_free(chal);2390 g_free(passwd);2391 g_free(login);2392 }2393 2394 static void yahoo_https_auth_token_finish(struct http_request *req)2395 {2396 struct yahoo_https_auth_data *had = req->data;2397 struct yahoo_input_data *yid = had->yid;2398 struct yahoo_data *yd = yid->yd;2399 int st;2400 2401 if (req->status_code != 200) {2402 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 2000 + req->status_code, NULL);2403 goto fail;2404 }2405 2406 if (sscanf(req->reply_body, "%d", &st) != 1 || st != 0) {2407 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, yahoo_https_status_parse(st), NULL);2408 goto fail;2409 }2410 2411 if ((had->token = yahoo_ha_find_key(req->reply_body, "ymsgr")) == NULL) {2412 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 3001, NULL);2413 goto fail;2414 }2415 2416 return yahoo_https_auth_init(had);2417 2418 fail:2419 g_free(had->token);2420 g_free(had->chal);2421 g_free(had);2422 }2423 2424 static void yahoo_https_auth_init(struct yahoo_https_auth_data *had)2425 {2426 struct http_request *req;2427 char *url;2428 2429 url = g_strdup_printf("https://login.yahoo.com/config/pwtoken_login?src=ymsgr&ts=%d&token=%s",2430 (int) time(NULL), had->token);2431 2432 req = http_dorequest_url(url, yahoo_https_auth_finish, had);2433 2434 g_free(url);2435 }2436 2437 static void yahoo_https_auth_finish(struct http_request *req)2438 {2439 struct yahoo_https_auth_data *had = req->data;2440 struct yahoo_input_data *yid = had->yid;2441 struct yahoo_data *yd = yid->yd;2442 struct yahoo_packet *pack;2443 char *crumb;2444 int st;2445 2446 md5_byte_t result[16];2447 md5_state_t ctx;2448 2449 unsigned char yhash[32];2450 2451 if (req->status_code != 200) {2452 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 2000 + req->status_code, NULL);2453 goto fail;2454 }2455 2456 if (sscanf(req->reply_body, "%d", &st) != 1 || st != 0) {2457 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, yahoo_https_status_parse(st), NULL);2458 goto fail;2459 }2460 2461 if ((yd->cookie_y = yahoo_ha_find_key(req->reply_body, "Y")) == NULL ||2462 (yd->cookie_t = yahoo_ha_find_key(req->reply_body, "T")) == NULL ||2463 (crumb = yahoo_ha_find_key(req->reply_body, "crumb")) == NULL) {2464 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 3002, NULL);2465 goto fail;2466 }2467 2468 md5_init(&ctx);2469 md5_append(&ctx, (unsigned char*) crumb, 11);2470 md5_append(&ctx, (unsigned char*) had->chal, strlen(had->chal));2471 md5_finish(&ctx, result);2472 to_y64(yhash, result, 16);2473 2474 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->initial_status, yd->session_id);2475 yahoo_packet_hash(pack, 1, yd->user);2476 yahoo_packet_hash(pack, 0, yd->user);2477 yahoo_packet_hash(pack, 277, yd->cookie_y);2478 yahoo_packet_hash(pack, 278, yd->cookie_t);2479 yahoo_packet_hash(pack, 307, (char*) yhash);2480 yahoo_packet_hash(pack, 244, "524223");2481 yahoo_packet_hash(pack, 2, yd->user);2482 yahoo_packet_hash(pack, 2, "1");2483 yahoo_packet_hash(pack, 98, "us");2484 yahoo_packet_hash(pack, 135, "7.5.0.647");2485 2486 yahoo_send_packet(yid, pack, 0);2487 2488 yahoo_packet_free(pack);2489 2490 fail:2491 g_free(crumb);2492 g_free(had->token);2493 g_free(had->chal);2494 g_free(had);2495 }2496 2497 2230 static void yahoo_process_auth(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 2498 2231 { … … 2522 2255 case 1: 2523 2256 yahoo_process_auth_0x0b(yid, seed, sn); 2524 break;2525 case 2:2526 yahoo_process_auth_0x10(yid, seed, sn);2527 2257 break; 2528 2258 default: … … 2680 2410 2681 2411 yd->buddies = y_list_append(yd->buddies, bud); 2682 2412 2683 2413 /* Possibly called already, but at least the call above doesn't 2684 2414 seem to happen every time (not anytime I tried). */ … … 2687 2417 2688 2418 /* YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, who, status, NULL, (status==YAHOO_STATUS_AVAILABLE?0:1)); */ 2689 }2690 2691 static void yahoo_process_contact_ymsg13(struct yahoo_input_data *yid, struct yahoo_packet *pkt)2692 {2693 char* who=NULL;2694 char* me=NULL;2695 char* msg=NULL;2696 YList *l;2697 for (l = pkt->hash; l; l = l->next) {2698 struct yahoo_pair *pair = l->data;2699 if (pair->key == 4)2700 who = pair->value;2701 else if (pair->key == 5)2702 me = pair->value;2703 else2704 DEBUG_MSG(("unknown key: %d = %s", pair->key, pair->value));2705 }2706 2707 if(pkt->status==3)2708 YAHOO_CALLBACK(ext_yahoo_contact_auth_request)(yid->yd->client_id, me, who, msg);2709 2419 } 2710 2420 … … 2920 2630 2921 2631 YList *l; 2922 //yahoo_dump_unhandled(pkt);2632 yahoo_dump_unhandled(pkt); 2923 2633 for (l = pkt->hash; l; l = l->next) { 2924 2634 struct yahoo_pair *pair = l->data; … … 2942 2652 { 2943 2653 DEBUG_MSG(("yahoo_packet_process: 0x%02x", pkt->service)); 2944 yahoo_dump_unhandled(pkt);2945 2654 switch (pkt->service) 2946 2655 { … … 2954 2663 case YAHOO_SERVICE_IDACT: 2955 2664 case YAHOO_SERVICE_IDDEACT: 2956 case YAHOO_SERVICE_Y6_STATUS_UPDATE:2957 case YAHOO_SERVICE_YMSG15_STATUS:2958 2665 yahoo_process_status(yid, pkt); 2959 2666 break; … … 2969 2676 yahoo_process_mail(yid, pkt); 2970 2677 break; 2971 case YAHOO_SERVICE_REJECTCONTACT:2972 2678 case YAHOO_SERVICE_NEWCONTACT: 2973 2679 yahoo_process_contact(yid, pkt); … … 3010 2716 yahoo_process_buddyadd(yid, pkt); 3011 2717 break; 3012 case YAHOO_SERVICE_CONTACT_YMSG13:3013 yahoo_process_contact_ymsg13(yid,pkt);3014 break;3015 2718 case YAHOO_SERVICE_REMBUDDY: 3016 2719 yahoo_process_buddydel(yid, pkt); … … 3041 2744 case YAHOO_SERVICE_CHATLOGOFF: 3042 2745 case YAHOO_SERVICE_CHATMSG: 2746 case YAHOO_SERVICE_REJECTCONTACT: 3043 2747 case YAHOO_SERVICE_PEERTOPEER: 3044 2748 WARNING(("unhandled service 0x%02x", pkt->service)); … … 3054 2758 yahoo_process_picture_upload(yid, pkt); 3055 2759 break; 3056 case YAHOO_SERVICE_YMSG15_BUDDY_LIST: /* Buddy List */3057 yahoo_process_buddy_list(yid, pkt);3058 2760 default: 3059 2761 WARNING(("unknown service 0x%02x", pkt->service)); … … 3839 3541 yahoo_process_webcam_connection, 3840 3542 yahoo_process_chatcat_connection, 3841 yahoo_process_search_connection ,3543 yahoo_process_search_connection 3842 3544 }; 3843 3545 … … 3857 3559 } while(len == -1 && errno == EINTR); 3858 3560 3859 if(len == -1 && (errno == EAGAIN||errno == EINTR)) /* we'll try again later */3561 if(len == -1 && errno == EAGAIN) /* we'll try again later */ 3860 3562 return 1; 3861 3563 … … 4060 3762 4061 3763 yahoo_packet_hash(pkt, 5, who); 4062 yahoo_packet_hash(pkt, 1, from?from:yd->user);3764 yahoo_packet_hash(pkt, 4, from?from:yd->user); 4063 3765 yahoo_packet_hash(pkt, 14, " "); 4064 3766 yahoo_packet_hash(pkt, 13, typ ? "1" : "0"); … … 4075 3777 struct yahoo_data *yd; 4076 3778 struct yahoo_packet *pkt = NULL; 4077 int old_status;3779 int service; 4078 3780 char s[4]; 4079 3781 … … 4083 3785 yd = yid->yd; 4084 3786 4085 old_status = yd->current_status; 4086 4087 if (msg && strncmp(msg,"Invisible",9)) { 3787 if (msg) { 4088 3788 yd->current_status = YAHOO_STATUS_CUSTOM; 4089 3789 } else { … … 4091 3791 } 4092 3792 4093 /* Thank you libpurple :) */ 4094 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { 4095 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBILITY, YAHOO_STATUS_AVAILABLE, 0); 4096 yahoo_packet_hash(pkt, 13, "2"); 4097 yahoo_send_packet(yid, pkt, 0); 4098 yahoo_packet_free(pkt); 4099 4100 return; 4101 } 4102 4103 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, yd->current_status, yd->session_id); 4104 snprintf(s, sizeof(s), "%d", yd->current_status); 4105 yahoo_packet_hash(pkt, 10, s); 3793 if (yd->current_status == YAHOO_STATUS_AVAILABLE) 3794 service = YAHOO_SERVICE_ISBACK; 3795 else 3796 service = YAHOO_SERVICE_ISAWAY; 4106 3797 4107 if (yd->current_status == YAHOO_STATUS_CUSTOM) { 4108 yahoo_packet_hash(pkt, 19, msg); 4109 } else { 4110 yahoo_packet_hash(pkt, 19, ""); 4111 } 4112 4113 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 3798 if ((away == 2) && (yd->current_status == YAHOO_STATUS_AVAILABLE)) { 3799 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_BRB, yd->session_id); 3800 yahoo_packet_hash(pkt, 10, "999"); 3801 yahoo_packet_hash(pkt, 47, "2"); 3802 }else { 3803 pkt = yahoo_packet_new(service, YAHOO_STATUS_AVAILABLE, yd->session_id); 3804 snprintf(s, sizeof(s), "%d", yd->current_status); 3805 yahoo_packet_hash(pkt, 10, s); 3806 if (yd->current_status == YAHOO_STATUS_CUSTOM) { 3807 yahoo_packet_hash(pkt, 19, msg); 3808 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 3809 } else { 3810 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 3811 } 3812 3813 3814 3815 } 4114 3816 4115 3817 yahoo_send_packet(yid, pkt, 0); 4116 3818 yahoo_packet_free(pkt); 4117 4118 if(old_status == YAHOO_STATUS_INVISIBLE) {4119 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBILITY, YAHOO_STATUS_AVAILABLE, 0);4120 yahoo_packet_hash(pkt, 13, "1");4121 yahoo_send_packet(yid, pkt, 0);4122 yahoo_packet_free(pkt);4123 }4124 3819 } 4125 3820 … … 4136 3831 LOG(("yahoo_logoff: current status: %d", yd->current_status)); 4137 3832 4138 if(yd->current_status != -1 && 0) { 4139 /* Meh. Don't send this. The event handlers are not going to 4140 get to do this so it'll just leak memory. And the TCP 4141 connection reset will hopefully be clear enough. */ 3833 if(yd->current_status != -1) { 4142 3834 pkt = yahoo_packet_new(YAHOO_SERVICE_LOGOFF, YAHOO_STATUS_AVAILABLE, yd->session_id); 4143 3835 yd->current_status = -1; … … 4372 4064 return; 4373 4065 4374 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YPACKET_STATUS_DEFAULT, yd->session_id); 4375 4066 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id); 4067 yahoo_packet_hash(pkt, 1, yd->user); 4068 yahoo_packet_hash(pkt, 7, who); 4069 yahoo_packet_hash(pkt, 65, group); 4376 4070 if (msg != NULL) /* add message/request "it's me add me" */ 4377 4071 yahoo_packet_hash(pkt, 14, msg); 4378 else4379 yahoo_packet_hash(pkt,14,"");4380 4381 yahoo_packet_hash(pkt, 65, group);4382 yahoo_packet_hash(pkt, 97, "1");4383 yahoo_packet_hash(pkt, 1, yd->user);4384 yahoo_packet_hash(pkt, 302, "319");4385 yahoo_packet_hash(pkt, 300, "319");4386 yahoo_packet_hash(pkt, 7, who);4387 yahoo_packet_hash(pkt, 334, "0");4388 yahoo_packet_hash(pkt, 301, "319");4389 yahoo_packet_hash(pkt, 303, "319");4390 4391 4392 4072 yahoo_send_packet(yid, pkt, 0); 4393 4073 yahoo_packet_free(pkt); … … 4411 4091 yahoo_send_packet(yid, pkt, 0); 4412 4092 yahoo_packet_free(pkt); 4413 }4414 4415 void yahoo_accept_buddy_ymsg13(int id,const char* me,const char* who){4416 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);4417 struct yahoo_data *yd;4418 4419 if(!yid)4420 return;4421 yd = yid->yd;4422 4423 struct yahoo_packet* pkt=NULL;4424 pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0);4425 4426 yahoo_packet_hash(pkt,1,me ?: yd->user);4427 yahoo_packet_hash(pkt,5,who);4428 yahoo_packet_hash(pkt,13,"1");4429 yahoo_packet_hash(pkt,334,"0");4430 yahoo_send_packet(yid, pkt, 0);4431 yahoo_packet_free(pkt);4432 }4433 4434 void yahoo_reject_buddy_ymsg13(int id,const char* me,const char* who,const char* msg){4435 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);4436 struct yahoo_data *yd;4437 4438 if(!yid)4439 return;4440 yd = yid->yd;4441 4442 struct yahoo_packet* pkt=NULL;4443 pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0);4444 4445 yahoo_packet_hash(pkt,1,me ?: yd->user);4446 yahoo_packet_hash(pkt,5,who);4447 // yahoo_packet_hash(pkt,241,YAHOO_PROTO_VER);4448 yahoo_packet_hash(pkt,13,"2");4449 yahoo_packet_hash(pkt,334,"0");4450 yahoo_packet_hash(pkt,97,"1");4451 yahoo_packet_hash(pkt,14,msg?:"");4452 4453 yahoo_send_packet(yid, pkt, 0);4454 yahoo_packet_free(pkt);4455 4456 4093 } 4457 4094 -
protocols/yahoo/yahoo.c
r3f81999 rfc34fb5 254 254 static GList *byahoo_away_states( struct im_connection *ic ) 255 255 { 256 static GList *m = NULL; 257 258 if( m == NULL ) 259 { 260 m = g_list_append( m, "Available" ); 261 m = g_list_append( m, "Be Right Back" ); 262 m = g_list_append( m, "Busy" ); 263 m = g_list_append( m, "Not At Home" ); 264 m = g_list_append( m, "Not At Desk" ); 265 m = g_list_append( m, "Not In Office" ); 266 m = g_list_append( m, "On Phone" ); 267 m = g_list_append( m, "On Vacation" ); 268 m = g_list_append( m, "Out To Lunch" ); 269 m = g_list_append( m, "Stepped Out" ); 270 m = g_list_append( m, "Invisible" ); 271 m = g_list_append( m, GAIM_AWAY_CUSTOM ); 272 } 256 GList *m = NULL; 257 258 m = g_list_append( m, "Available" ); 259 m = g_list_append( m, "Be Right Back" ); 260 m = g_list_append( m, "Busy" ); 261 m = g_list_append( m, "Not At Home" ); 262 m = g_list_append( m, "Not At Desk" ); 263 m = g_list_append( m, "Not In Office" ); 264 m = g_list_append( m, "On Phone" ); 265 m = g_list_append( m, "On Vacation" ); 266 m = g_list_append( m, "Out To Lunch" ); 267 m = g_list_append( m, "Stepped Out" ); 268 m = g_list_append( m, "Invisible" ); 269 m = g_list_append( m, GAIM_AWAY_CUSTOM ); 273 270 274 271 return m; … … 349 346 350 347 return c; 351 }352 353 static void byahoo_auth_allow( struct im_connection *ic, const char *who )354 {355 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;356 357 yahoo_accept_buddy_ymsg13( yd->y2_id, NULL, who );358 }359 360 static void byahoo_auth_deny( struct im_connection *ic, const char *who )361 {362 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;363 364 yahoo_reject_buddy_ymsg13( yd->y2_id, NULL, who, NULL );365 348 } 366 349 … … 391 374 ret->handle_cmp = g_strcasecmp; 392 375 393 ret->auth_allow = byahoo_auth_allow;394 ret->auth_deny = byahoo_auth_deny;395 396 376 register_protocol(ret); 397 377 } … … 473 453 struct byahoo_write_ready_data *d = data; 474 454 475 return yahoo_write_ready( d->id, d->fd, d->data ); 455 yahoo_write_ready( d->id, d->fd, d->data ); 456 457 return FALSE; 476 458 } 477 459 … … 941 923 } 942 924 943 void ext_yahoo_contact_auth_request( int id, const char *myid, const char *who, const char *msg )944 {945 struct im_connection *ic = byahoo_get_ic_by_id( id );946 947 imcb_ask_auth( ic, who, NULL );948 }949 950 925 void ext_yahoo_contact_added( int id, const char *myid, const char *who, const char *msg ) 951 926 { 952 struct im_connection *ic = byahoo_get_ic_by_id( id );953 954 imcb_add_buddy( ic, (char*) who, NULL );927 /* Groups schmoups. If I want to handle groups properly I can get the 928 buddy data from some internal libyahoo2 structure. */ 929 imcb_add_buddy( byahoo_get_ic_by_id( id ), (char*) who, NULL ); 955 930 } 956 931 -
protocols/yahoo/yahoo2.h
r3f81999 rfc34fb5 217 217 void yahoo_buddyicon_request(int id, const char *who); 218 218 219 void yahoo_accept_buddy_ymsg13(int,const char*,const char*);220 void yahoo_reject_buddy_ymsg13(int,const char*,const char*,const char*);221 222 219 #include "yahoo_httplib.h" 223 220 -
protocols/yahoo/yahoo2_callbacks.h
r3f81999 rfc34fb5 361 361 362 362 /* 363 * Name: ext_yahoo_contact_auth_request364 * Called when a contact wants to add you to his/her contact list365 * Params:366 * id - the id that identifies the server connection367 * myid - the identity s/he added368 * who - who did it369 * msg - any message sent370 */371 void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_auth_request)(int id, const char *myid, const char *who, const char *msg);372 373 374 /*375 363 * Name: ext_yahoo_contact_added 376 364 * Called when a contact is added to your list -
protocols/yahoo/yahoo2_types.h
r3f81999 rfc34fb5 57 57 YAHOO_LOGIN_LOCK = 14, 58 58 YAHOO_LOGIN_DUPL = 99, 59 YAHOO_LOGIN_SOCK = -1, 60 }; 61 62 enum ypacket_status { 63 YPACKET_STATUS_DISCONNECTED = -1, 64 YPACKET_STATUS_DEFAULT = 0, 65 YPACKET_STATUS_SERVERACK = 1, 66 YPACKET_STATUS_GAME = 0x2, 67 YPACKET_STATUS_AWAY = 0x4, 68 YPACKET_STATUS_CONTINUED = 0x5, 69 YPACKET_STATUS_INVISIBLE = 12, 70 YPACKET_STATUS_NOTIFY = 0x16, /* TYPING */ 71 YPACKET_STATUS_WEBLOGIN = 0x5a55aa55, 72 YPACKET_STATUS_OFFLINE = 0x5a55aa56 59 YAHOO_LOGIN_SOCK = -1 73 60 }; 74 61 … … 98 85 }; 99 86 100 #define YAHOO_PROTO_VER 0x00 1087 #define YAHOO_PROTO_VER 0x000b 101 88 102 89 /* Yahoo style/color directives */ … … 128 115 YAHOO_CONNECTION_WEBCAM, 129 116 YAHOO_CONNECTION_CHATCAT, 130 YAHOO_CONNECTION_SEARCH, 131 YAHOO_CONNECTION_AUTH, 117 YAHOO_CONNECTION_SEARCH 132 118 }; 133 119 … … 145 131 /* chat member attribs */ 146 132 #define YAHOO_CHAT_MALE 0x8000 133 #define YAHOO_CHAT_FEMALE 0x10000 147 134 #define YAHOO_CHAT_FEMALE 0x10000 148 135 #define YAHOO_CHAT_DUNNO 0x400 -
root_commands.c
r3f81999 rfc34fb5 310 310 int st; 311 311 312 if( s &&checkflags && checkflags( irc, s ) == 0 )312 if( checkflags && checkflags( irc, s ) == 0 ) 313 313 return 0; 314 314 … … 1079 1079 else if( g_strcasecmp( cmd[1], "set" ) == 0 ) 1080 1080 { 1081 MIN_ARGS( 2 );1082 1083 1081 cmd_set_real( irc, cmd + 1, cmd_chat_set_findhead, NULL ); 1084 1082 }
Note: See TracChangeset
for help on using the changeset viewer.