Changeset 4e04194
- Timestamp:
- 2009-11-23T23:00:54Z (15 years ago)
- Branches:
- master
- Children:
- cd741d8
- Parents:
- b3117f2 (diff), fb51d85 (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. - Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
account.c
rb3117f2 r4e04194 27 27 #include "bitlbee.h" 28 28 #include "account.h" 29 #include "chat.h" 29 30 30 31 account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass ) -
bitlbee.h
rb3117f2 r4e04194 33 33 34 34 #define PACKAGE "BitlBee" 35 #define BITLBEE_VERSION "1.2. 3"35 #define BITLBEE_VERSION "1.2.4" 36 36 #define VERSION BITLBEE_VERSION 37 37 … … 129 129 #include "account.h" 130 130 #include "nick.h" 131 #include "chat.h"132 131 #include "conf.h" 133 132 #include "log.h" -
chat.c
rb3117f2 r4e04194 25 25 26 26 #include "bitlbee.h" 27 #include "chat.h" 27 28 28 29 struct chat *chat_add( irc_t *irc, account_t *acc, char *handle, char *channel ) -
chat.h
rb3117f2 r4e04194 24 24 */ 25 25 26 #ifndef _CHAT_H 27 #define _CHAT_H 28 26 29 struct chat 27 30 { … … 45 48 46 49 int chat_join( irc_t *irc, struct chat *c, const char *password ); 50 51 #endif -
doc/CHANGES
rb3117f2 r4e04194 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 login 12 time is now possible. 13 * Note that the old way of starting groupchats (/join #nickname) is now 14 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 kinds 18 of Google Talk chatrooms. 19 - Fixed numerous stability/reliability bugs over the last year. 20 21 Finished 17 Oct 2009 5 22 6 23 Version 1.2.3: -
doc/user-guide/commands.xml
rb3117f2 r4e04194 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> 177 181 </description> 178 182 -
doc/user-guide/misc.xml
rb3117f2 r4e04194 77 77 78 78 <para> 79 Some protocols (like Jabber) also support named groupchats. BitlBee now supports these too. You can use the <emphasis>chat add</emphasis> command to join them. See <emphasis>help chat _add</emphasis> for more information.79 Some protocols (like Jabber) also support named groupchats. BitlBee now supports these too. You can use the <emphasis>chat add</emphasis> command to join them. See <emphasis>help chat add</emphasis> for more information. 80 80 </para> 81 81 -
irc_commands.c
rb3117f2 r4e04194 27 27 #include "bitlbee.h" 28 28 #include "ipc.h" 29 #include "chat.h" 29 30 30 31 static void irc_cmd_pass( irc_t *irc, char **cmd ) -
lib/misc.c
rb3117f2 r4e04194 46 46 #endif 47 47 48 #include "md5.h" 48 49 #include "ssl_client.h" 49 50 -
protocols/jabber/iq.c
rb3117f2 r4e04194 51 51 { 52 52 if( !( ( c = xt_find_node( node->children, "query" ) ) || 53 ( c = xt_find_node( node->children, "ping" ) ) ) || /* O_o WHAT is wrong with just <query/> ????? */53 ( c = xt_find_node( node->children, "ping" ) ) ) || 54 54 !( s = xt_find_attr( c, "xmlns" ) ) ) 55 55 { 56 imcb_log( ic, "Warning: Received incomplete IQ-%s packet", type ); 56 /* Sigh. Who decided to suddenly invent new elements 57 instead of just sticking with <query/>? */ 57 58 return XT_HANDLED; 58 59 } -
protocols/jabber/jabber.h
rb3117f2 r4e04194 27 27 #include <glib.h> 28 28 29 #include "bitlbee.h" 30 #include "md5.h" 29 31 #include "xmltree.h" 30 #include "bitlbee.h"31 32 32 33 extern GSList *jabber_connections; -
protocols/nogaim.c
rb3117f2 r4e04194 33 33 34 34 #define BITLBEE_CORE 35 #include <ctype.h> 36 35 37 #include "nogaim.h" 36 #include <ctype.h>38 #include "chat.h" 37 39 38 40 static int remove_chat_buddy_silent( struct groupchat *b, const char *handle ); … … 522 524 } 523 525 524 /* prpl.c */ 525 526 struct show_got_added_data 526 527 struct imcb_ask_cb_data 527 528 { 528 529 struct im_connection *ic; … … 530 531 }; 531 532 532 void show_got_added_no( void *data ) 533 { 534 g_free( ((struct show_got_added_data*)data)->handle ); 533 static void imcb_ask_auth_cb_no( void *data ) 534 { 535 struct imcb_ask_cb_data *cbd = data; 536 537 cbd->ic->acc->prpl->auth_deny( cbd->ic, cbd->handle ); 538 539 g_free( cbd->handle ); 540 g_free( cbd ); 541 } 542 543 static void imcb_ask_auth_cb_yes( void *data ) 544 { 545 struct imcb_ask_cb_data *cbd = data; 546 547 cbd->ic->acc->prpl->auth_allow( cbd->ic, cbd->handle ); 548 549 g_free( cbd->handle ); 550 g_free( cbd ); 551 } 552 553 void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname ) 554 { 555 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); 556 char *s, *realname_ = NULL; 557 558 if( realname != NULL ) 559 realname_ = g_strdup_printf( " (%s)", realname ); 560 561 s = g_strdup_printf( "The user %s%s wants to add you to his/her buddy list.", 562 handle, realname_ ?: "" ); 563 564 g_free( realname_ ); 565 566 data->ic = ic; 567 data->handle = g_strdup( handle ); 568 query_add( ic->irc, ic, s, imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data ); 569 } 570 571 572 static void imcb_ask_add_cb_no( void *data ) 573 { 574 g_free( ((struct imcb_ask_cb_data*)data)->handle ); 535 575 g_free( data ); 536 576 } 537 577 538 void show_got_added_yes( void *data ) 539 { 540 struct show_got_added_data *sga = data; 541 542 sga->ic->acc->prpl->add_buddy( sga->ic, sga->handle, NULL ); 543 /* imcb_add_buddy( sga->ic, NULL, sga->handle, sga->handle ); */ 544 545 return show_got_added_no( data ); 546 } 547 548 void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ) 549 { 550 struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 ); 578 static void imcb_ask_add_cb_yes( void *data ) 579 { 580 struct imcb_ask_cb_data *cbd = data; 581 582 cbd->ic->acc->prpl->add_buddy( cbd->ic, cbd->handle, NULL ); 583 584 return imcb_ask_add_cb_no( data ); 585 } 586 587 void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ) 588 { 589 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); 551 590 char *s; 552 591 … … 559 598 data->ic = ic; 560 599 data->handle = g_strdup( handle ); 561 query_add( ic->irc, ic, s, show_got_added_yes, show_got_added_no, data );600 query_add( ic->irc, ic, s, imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data ); 562 601 } 563 602 -
protocols/nogaim.h
rb3117f2 r4e04194 39 39 #define _NOGAIM_H 40 40 41 #include <stdint.h> 42 41 43 #include "bitlbee.h" 42 44 #include "account.h" 43 45 #include "proxy.h" 44 46 #include "query.h" 45 #include "md5.h"46 47 47 48 #define BUDDY_ALIAS_MAXLEN 388 /* because MSN names can be 387 characters */ … … 224 225 * - Most protocols will just want to set this to g_strcasecmp().*/ 225 226 int (* handle_cmp) (const char *who1, const char *who2); 227 228 /* Implement these callbacks if you want to use imcb_ask_auth() */ 229 void (* auth_allow) (struct im_connection *, const char *who); 230 void (* auth_deny) (struct im_connection *, const char *who); 226 231 }; 227 232 … … 252 257 /* To tell the user an error, ie. before logging out when an error occurs. */ 253 258 G_MODULE_EXPORT void imcb_error( struct im_connection *ic, char *format, ... ) G_GNUC_PRINTF( 2, 3 ); 259 254 260 /* To ask a your about something. 255 261 * - 'msg' is the question. … … 258 264 */ 259 265 G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont ); 260 G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ); 266 267 /* Two common questions you may want to ask: 268 * - X added you to his contact list, allow? 269 * - X is not in your contact list, want to add? 270 */ 271 G_MODULE_EXPORT void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname ); 272 G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ); 261 273 262 274 /* Buddy management */ -
protocols/yahoo/libyahoo2.c
rb3117f2 r4e04194 90 90 #include "base64.h" 91 91 #include "http_client.h" 92 93 static void yahoo_process_auth_response(struct http_request *req);94 92 95 93 #ifdef USE_STRUCT_CALLBACKS … … 212 210 YAHOO_SERVICE_CHATPING, 213 211 YAHOO_SERVICE_COMMENT = 0xa8, 214 YAHOO_SERVICE_GAME_INVITE = 0xb7, 215 YAHOO_SERVICE_STEALTH_PERM = 0xb9, 216 YAHOO_SERVICE_STEALTH_SESSION = 0xba, 217 YAHOO_SERVICE_AVATAR = 0xbc, 212 YAHOO_SERVICE_STEALTH = 0xb9, 218 213 YAHOO_SERVICE_PICTURE_CHECKSUM = 0xbd, 219 214 YAHOO_SERVICE_PICTURE = 0xbe, 220 215 YAHOO_SERVICE_PICTURE_UPDATE = 0xc1, 221 216 YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2, 222 YAHOO_SERVICE_YAB_UPDATE = 0xc4, 223 YAHOO_SERVICE_Y6_VISIBLE_TOGGLE = 0xc5, /* YMSG13, key 13: 2 = invisible, 1 = visible */ 224 YAHOO_SERVICE_Y6_STATUS_UPDATE = 0xc6, /* YMSG13 */ 225 YAHOO_SERVICE_PICTURE_STATUS = 0xc7, /* YMSG13, key 213: 0 = none, 1 = avatar, 2 = picture */ 226 YAHOO_SERVICE_VERIFY_ID_EXISTS = 0xc8, 227 YAHOO_SERVICE_AUDIBLE = 0xd0, 228 YAHOO_SERVICE_Y7_PHOTO_SHARING = 0xd2, 229 YAHOO_SERVICE_Y7_CONTACT_DETAILS = 0xd3,/* YMSG13 */ 230 YAHOO_SERVICE_Y7_CHAT_SESSION = 0xd4, 231 YAHOO_SERVICE_Y7_AUTHORIZATION = 0xd6, /* YMSG13 */ 232 YAHOO_SERVICE_Y7_FILETRANSFER = 0xdc, /* YMSG13 */ 233 YAHOO_SERVICE_Y7_FILETRANSFERINFO, /* YMSG13 */ 234 YAHOO_SERVICE_Y7_FILETRANSFERACCEPT, /* YMSG13 */ 235 YAHOO_SERVICE_Y7_MINGLE = 0xe1, /* YMSG13 */ 236 YAHOO_SERVICE_Y7_CHANGE_GROUP = 0xe7, /* YMSG13 */ 237 YAHOO_SERVICE_Y8_STATUS = 0xf0, /* YMSG15 */ 238 YAHOO_SERVICE_Y8_LIST = 0Xf1, /* YMSG15 */ 239 YAHOO_SERVICE_WEBLOGIN = 0x0226, 240 YAHOO_SERVICE_SMS_MSG = 0x02ea 217 YAHOO_SERVICE_Y6_VISIBILITY=0xc5, 218 YAHOO_SERVICE_Y6_STATUS_UPDATE=0xc6, 219 YAHOO_PHOTOSHARE_INIT=0xd2, 220 YAHOO_SERVICE_CONTACT_YMSG13=0xd6, 221 YAHOO_PHOTOSHARE_PREV=0xd7, 222 YAHOO_PHOTOSHARE_KEY=0xd8, 223 YAHOO_PHOTOSHARE_TRANS=0xda, 224 YAHOO_FILE_TRANSFER_INIT_YMSG13=0xdc, 225 YAHOO_FILE_TRANSFER_GET_YMSG13=0xdd, 226 YAHOO_FILE_TRANSFER_PUT_YMSG13=0xde, 227 YAHOO_SERVICE_YMSG15_STATUS=0xf0, 228 YAHOO_SERVICE_YMSG15_BUDDY_LIST=0xf1, 241 229 }; 242 230 … … 776 764 yahoo_send_data(yid->fd, data, len); 777 765 else 778 yahoo_add_to_send_queue(yid, data, len);766 yahoo_add_to_send_queue(yid, data, len); 779 767 FREE(data); 780 768 } … … 1496 1484 1497 1485 if (u->name != NULL) { 1498 if (pkt->service == YAHOO_SERVICE_LOGOFF || u->flags == 0) {1486 if (pkt->service == YAHOO_SERVICE_LOGOFF) { /* || u->flags == 0) { Not in YMSG16 */ 1499 1487 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0); 1500 1488 } else { 1489 /* Key 47 always seems to be 1 for YMSG16 */ 1490 if(!u->state) 1491 u->away = 0; 1492 else 1493 u->away = 1; 1494 1501 1495 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, u->state, u->msg, u->away, u->idle, u->mobile); 1502 1496 } … … 2313 2307 } 2314 2308 2309 struct yahoo_https_auth_data 2310 { 2311 struct yahoo_input_data *yid; 2312 char *token; 2313 char *chal; 2314 }; 2315 2316 static void yahoo_https_auth_token_init(struct yahoo_https_auth_data *had); 2317 static void yahoo_https_auth_token_finish(struct http_request *req); 2318 static void yahoo_https_auth_init(struct yahoo_https_auth_data *had); 2319 static void yahoo_https_auth_finish(struct http_request *req); 2320 2321 /* Extract a value from a login.yahoo.com response. Assume CRLF-linebreaks 2322 and FAIL miserably if they're not there... */ 2323 static char *yahoo_ha_find_key(char *response, char *key) 2324 { 2325 char *s, *end; 2326 int len = strlen(key); 2327 2328 s = response; 2329 do { 2330 if (strncmp(s, key, len) == 0 && s[len] == '=') { 2331 s += len + 1; 2332 if ((end = strchr(s, '\r'))) 2333 return g_strndup(s, end - s); 2334 else 2335 return g_strdup(s); 2336 } 2337 2338 if ((s = strchr(s, '\n'))) 2339 s ++; 2340 } while (s && *s); 2341 2342 return NULL; 2343 } 2344 2345 static enum yahoo_status yahoo_https_status_parse(int code) 2346 { 2347 switch (code) 2348 { 2349 case 1212: return YAHOO_LOGIN_PASSWD; 2350 case 1213: return YAHOO_LOGIN_LOCK; 2351 case 1235: return YAHOO_LOGIN_UNAME; 2352 default: return (enum yahoo_status) code; 2353 } 2354 } 2355 2315 2356 static void yahoo_process_auth_0x10(struct yahoo_input_data *yid, const char *seed, const char *sn) 2316 2357 { 2358 struct yahoo_https_auth_data *had = g_new0(struct yahoo_https_auth_data, 1); 2359 2360 had->yid = yid; 2361 had->chal = g_strdup(seed); 2362 2363 yahoo_https_auth_token_init(had); 2364 } 2365 2366 static void yahoo_https_auth_token_init(struct yahoo_https_auth_data *had) 2367 { 2368 struct yahoo_input_data *yid = had->yid; 2369 struct yahoo_data *yd = yid->yd; 2370 struct http_request *req; 2371 char *login, *passwd, *chal; 2317 2372 char *url; 2318 2319 yid->yd->login_cookie = strdup(seed); 2320 2321 url = g_strdup_printf( 2322 "https://login.yahoo.com/config/pwtoken_get?" 2323 "src=ymsgr&ts=&login=%s&passwd=%s&chal=%s", 2324 yid->yd->user, yid->yd->password, seed); 2325 2326 http_dorequest_url(url, yahoo_process_auth_response, yid); 2373 2374 login = g_strndup(yd->user, 3 * strlen(yd->user)); 2375 http_encode(login); 2376 passwd = g_strndup(yd->password, 3 * strlen(yd->password)); 2377 http_encode(passwd); 2378 chal = g_strndup(had->chal, 3 * strlen(had->chal)); 2379 http_encode(chal); 2380 2381 url = g_strdup_printf("https://login.yahoo.com/config/pwtoken_get?src=ymsgr&ts=%d&login=%s&passwd=%s&chal=%s", 2382 (int) time(NULL), login, passwd, chal); 2383 2384 req = http_dorequest_url(url, yahoo_https_auth_token_finish, had); 2327 2385 2328 2386 g_free(url); 2387 g_free(chal); 2388 g_free(passwd); 2389 g_free(login); 2390 } 2391 2392 static void yahoo_https_auth_token_finish(struct http_request *req) 2393 { 2394 struct yahoo_https_auth_data *had = req->data; 2395 struct yahoo_input_data *yid = had->yid; 2396 struct yahoo_data *yd = yid->yd; 2397 int st; 2398 2399 if (req->status_code != 200) { 2400 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 2000 + req->status_code, NULL); 2401 goto fail; 2402 } 2403 2404 if (sscanf(req->reply_body, "%d", &st) != 1 || st != 0) { 2405 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, yahoo_https_status_parse(st), NULL); 2406 goto fail; 2407 } 2408 2409 if ((had->token = yahoo_ha_find_key(req->reply_body, "ymsgr")) == NULL) { 2410 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 3001, NULL); 2411 goto fail; 2412 } 2413 2414 return yahoo_https_auth_init(had); 2415 2416 fail: 2417 g_free(had->token); 2418 g_free(had->chal); 2419 g_free(had); 2420 } 2421 2422 static void yahoo_https_auth_init(struct yahoo_https_auth_data *had) 2423 { 2424 struct http_request *req; 2425 char *url; 2426 2427 url = g_strdup_printf("https://login.yahoo.com/config/pwtoken_login?src=ymsgr&ts=%d&token=%s", 2428 (int) time(NULL), had->token); 2429 2430 req = http_dorequest_url(url, yahoo_https_auth_finish, had); 2431 2432 g_free(url); 2433 } 2434 2435 static void yahoo_https_auth_finish(struct http_request *req) 2436 { 2437 struct yahoo_https_auth_data *had = req->data; 2438 struct yahoo_input_data *yid = had->yid; 2439 struct yahoo_data *yd = yid->yd; 2440 struct yahoo_packet *pack; 2441 char *crumb; 2442 int st; 2443 2444 md5_byte_t result[16]; 2445 md5_state_t ctx; 2446 2447 unsigned char yhash[32]; 2448 2449 if (req->status_code != 200) { 2450 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 2000 + req->status_code, NULL); 2451 goto fail; 2452 } 2453 2454 if (sscanf(req->reply_body, "%d", &st) != 1 || st != 0) { 2455 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, yahoo_https_status_parse(st), NULL); 2456 goto fail; 2457 } 2458 2459 if ((yd->cookie_y = yahoo_ha_find_key(req->reply_body, "Y")) == NULL || 2460 (yd->cookie_t = yahoo_ha_find_key(req->reply_body, "T")) == NULL || 2461 (crumb = yahoo_ha_find_key(req->reply_body, "crumb")) == NULL) { 2462 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 3002, NULL); 2463 goto fail; 2464 } 2465 2466 md5_init(&ctx); 2467 md5_append(&ctx, (unsigned char*) crumb, 11); 2468 md5_append(&ctx, (unsigned char*) had->chal, strlen(had->chal)); 2469 md5_finish(&ctx, result); 2470 to_y64(yhash, result, 16); 2471 2472 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->initial_status, yd->session_id); 2473 yahoo_packet_hash(pack, 1, yd->user); 2474 yahoo_packet_hash(pack, 0, yd->user); 2475 yahoo_packet_hash(pack, 277, yd->cookie_y); 2476 yahoo_packet_hash(pack, 278, yd->cookie_t); 2477 yahoo_packet_hash(pack, 307, (char*) yhash); 2478 yahoo_packet_hash(pack, 244, "524223"); 2479 yahoo_packet_hash(pack, 2, yd->user); 2480 yahoo_packet_hash(pack, 2, "1"); 2481 yahoo_packet_hash(pack, 98, "us"); 2482 yahoo_packet_hash(pack, 135, "7.5.0.647"); 2483 2484 yahoo_send_packet(yid, pack, 0); 2485 2486 yahoo_packet_free(pack); 2487 2488 fail: 2489 g_free(crumb); 2490 g_free(had->token); 2491 g_free(had->chal); 2492 g_free(had); 2329 2493 } 2330 2494 … … 2358 2522 break; 2359 2523 case 2: 2360 /* HTTPS */2361 2524 yahoo_process_auth_0x10(yid, seed, sn); 2362 2525 break; … … 2515 2678 2516 2679 yd->buddies = y_list_append(yd->buddies, bud); 2517 2680 2518 2681 /* Possibly called already, but at least the call above doesn't 2519 2682 seem to happen every time (not anytime I tried). */ … … 2522 2685 2523 2686 /* YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, who, status, NULL, (status==YAHOO_STATUS_AVAILABLE?0:1)); */ 2687 } 2688 2689 static void yahoo_process_contact_ymsg13(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 2690 { 2691 char* who=NULL; 2692 char* me=NULL; 2693 char* msg=NULL; 2694 YList *l; 2695 for (l = pkt->hash; l; l = l->next) { 2696 struct yahoo_pair *pair = l->data; 2697 if (pair->key == 4) 2698 who = pair->value; 2699 else if (pair->key == 5) 2700 me = pair->value; 2701 else 2702 DEBUG_MSG(("unknown key: %d = %s", pair->key, pair->value)); 2703 } 2704 2705 if(pkt->status==3) 2706 YAHOO_CALLBACK(ext_yahoo_contact_auth_request)(yid->yd->client_id, me, who, msg); 2524 2707 } 2525 2708 … … 2735 2918 2736 2919 YList *l; 2737 yahoo_dump_unhandled(pkt);2920 // yahoo_dump_unhandled(pkt); 2738 2921 for (l = pkt->hash; l; l = l->next) { 2739 2922 struct yahoo_pair *pair = l->data; … … 2757 2940 { 2758 2941 DEBUG_MSG(("yahoo_packet_process: 0x%02x", pkt->service)); 2942 yahoo_dump_unhandled(pkt); 2759 2943 switch (pkt->service) 2760 2944 { … … 2769 2953 case YAHOO_SERVICE_IDDEACT: 2770 2954 case YAHOO_SERVICE_Y6_STATUS_UPDATE: 2771 case YAHOO_SERVICE_Y 8_STATUS:2955 case YAHOO_SERVICE_YMSG15_STATUS: 2772 2956 yahoo_process_status(yid, pkt); 2773 2957 break; … … 2783 2967 yahoo_process_mail(yid, pkt); 2784 2968 break; 2969 case YAHOO_SERVICE_REJECTCONTACT: 2785 2970 case YAHOO_SERVICE_NEWCONTACT: 2786 2971 yahoo_process_contact(yid, pkt); … … 2823 3008 yahoo_process_buddyadd(yid, pkt); 2824 3009 break; 3010 case YAHOO_SERVICE_CONTACT_YMSG13: 3011 yahoo_process_contact_ymsg13(yid,pkt); 3012 break; 2825 3013 case YAHOO_SERVICE_REMBUDDY: 2826 3014 yahoo_process_buddydel(yid, pkt); … … 2851 3039 case YAHOO_SERVICE_CHATLOGOFF: 2852 3040 case YAHOO_SERVICE_CHATMSG: 2853 case YAHOO_SERVICE_REJECTCONTACT:2854 3041 case YAHOO_SERVICE_PEERTOPEER: 2855 3042 WARNING(("unhandled service 0x%02x", pkt->service)); … … 2865 3052 yahoo_process_picture_upload(yid, pkt); 2866 3053 break; 2867 case YAHOO_SERVICE_Y 8_LIST: /* Buddy List */3054 case YAHOO_SERVICE_YMSG15_BUDDY_LIST: /* Buddy List */ 2868 3055 yahoo_process_buddy_list(yid, pkt); 2869 3056 default: … … 3643 3830 } 3644 3831 3645 /* #define LOG(x...) printf x */3646 3647 static void yahoo_process_auth_response(struct http_request *req)3648 {3649 char *line_end;3650 char *token;3651 char *cookie;3652 3653 int error_code = 0;3654 int is_ymsgr = 0;3655 3656 struct yahoo_input_data *yid = req->data;3657 3658 char crypt_hash[25];3659 3660 md5_byte_t result[16];3661 md5_state_t ctx;3662 3663 struct yahoo_packet *packet = NULL;3664 3665 if (y_list_find(inputs, yid) == NULL)3666 return;3667 3668 if (req->status_code != 200) {3669 error_code = 3000 + req->status_code;3670 goto FAIL;3671 }3672 3673 token = req->reply_body;3674 line_end = strstr(token, "\r\n");3675 3676 if (line_end) {3677 *line_end = '\0';3678 3679 line_end += 2;3680 }3681 3682 if (sscanf(token, "%d", &error_code) != 1) {3683 error_code = 3000;3684 goto FAIL;3685 }3686 3687 switch(error_code) {3688 case 0:3689 /* successful */3690 break;3691 3692 case 1212:3693 LOG(("Incorrect ID or password\n"));3694 error_code = YAHOO_LOGIN_PASSWD;3695 goto FAIL;3696 3697 case 1213:3698 LOG(("Security lock from too many failed login attempts\n"));3699 error_code = YAHOO_LOGIN_LOCK;3700 goto FAIL;3701 3702 case 1214:3703 LOG(("Security lock\n"));3704 goto FAIL;3705 3706 case 1235:3707 LOG(("User ID not taken yet\n"));3708 error_code = YAHOO_LOGIN_UNAME;3709 goto FAIL;3710 3711 case 1216:3712 LOG(("Seems to be a lock, but shows the same generic User ID/Password failure\n"));3713 goto FAIL;3714 3715 default:3716 /* Unknown error code */3717 LOG(("Unknown Error\n"));3718 goto FAIL;3719 }3720 3721 if ( !strncmp(line_end, "ymsgr=", 6) ) {3722 is_ymsgr = 1;3723 }3724 else if ( strncmp(line_end, "crumb=", 6) ) {3725 LOG(("Oops! There was no ymsgr=. Where do I get my token from now :("));3726 LOG(("I got this:\n\n%s\n",line_end));3727 error_code = 2201;3728 goto FAIL;3729 }3730 3731 token = line_end+6;3732 3733 line_end = strstr(token, "\r\n");3734 3735 if(line_end) {3736 *line_end = '\0';3737 line_end += 2;3738 }3739 3740 /* Go for the crumb */3741 if(is_ymsgr) {3742 char *url;3743 3744 url = g_strdup_printf(3745 "https://login.yahoo.com/config/pwtoken_login?"3746 "src=ymsgr&ts=&token=%s", token);3747 3748 http_dorequest_url(url, yahoo_process_auth_response, yid);3749 3750 g_free(url);3751 3752 return;3753 }3754 3755 /* token is actually crumb */3756 3757 if(!line_end) {3758 /* We did not get our cookies. Cry. */3759 }3760 3761 if((cookie = strstr(req->reply_headers, "Set-Cookie: Y=")) &&3762 (line_end = strstr(cookie + 14, "\r\n"))) {3763 *line_end = '\0';3764 yid->yd->cookie_y = strdup(cookie + 14);3765 *line_end = ';';3766 } else {3767 /* Cry. */3768 LOG(("NO Y Cookie!"));3769 error_code = 2202;3770 goto FAIL;3771 }3772 3773 if((cookie = strstr(req->reply_headers, "Set-Cookie: T=")) &&3774 (line_end = strstr(cookie + 14, "\r\n"))) {3775 *line_end = '\0';3776 yid->yd->cookie_t = strdup(cookie + 14);3777 *line_end = ';';3778 } else {3779 /* Cry. */3780 LOG(("NO T Cookie!"));3781 error_code = 2203;3782 goto FAIL;3783 }3784 3785 md5_init(&ctx);3786 md5_append(&ctx, (md5_byte_t *)token, strlen(token));3787 md5_append(&ctx, (md5_byte_t *)yid->yd->login_cookie, strlen(yid->yd->login_cookie));3788 md5_finish(&ctx, result);3789 3790 to_y64((unsigned char*)crypt_hash, result, 16);3791 3792 packet = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yid->yd->initial_status, yid->yd->session_id);3793 yahoo_packet_hash(packet, 1, yid->yd->user);3794 yahoo_packet_hash(packet, 0, yid->yd->user);3795 yahoo_packet_hash(packet, 277, yid->yd->cookie_y);3796 yahoo_packet_hash(packet, 278, yid->yd->cookie_t);3797 yahoo_packet_hash(packet, 307, crypt_hash);3798 yahoo_packet_hash(packet, 244, "2097087"); /* Rekkanoryo says this is the build number */3799 yahoo_packet_hash(packet, 2, yid->yd->user);3800 yahoo_packet_hash(packet, 2, "1");3801 yahoo_packet_hash(packet, 98, "us"); /* TODO Put country code */3802 yahoo_packet_hash(packet, 135, "9.0.0.1389");3803 3804 yahoo_send_packet(yid, packet, 0);3805 3806 yahoo_packet_free(packet);3807 3808 /* We don't need this anymore */3809 free(yid->yd->login_cookie);3810 yid->yd->login_cookie = NULL;3811 3812 return;3813 3814 FAIL:3815 YAHOO_CALLBACK(ext_yahoo_login_response)(yid->yd->client_id, error_code, NULL);3816 }3817 3818 3819 3832 static void (*yahoo_process_connection[])(struct yahoo_input_data *, int over) = { 3820 3833 yahoo_process_pager_connection, … … 4045 4058 4046 4059 yahoo_packet_hash(pkt, 5, who); 4047 yahoo_packet_hash(pkt, 4, from?from:yd->user);4060 yahoo_packet_hash(pkt, 1, from?from:yd->user); 4048 4061 yahoo_packet_hash(pkt, 14, " "); 4049 4062 yahoo_packet_hash(pkt, 13, typ ? "1" : "0"); … … 4060 4073 struct yahoo_data *yd; 4061 4074 struct yahoo_packet *pkt = NULL; 4062 int service;4075 int old_status; 4063 4076 char s[4]; 4064 4077 … … 4068 4081 yd = yid->yd; 4069 4082 4070 if (msg) { 4083 old_status = yd->current_status; 4084 4085 if (msg && strncmp(msg,"Invisible",9)) { 4071 4086 yd->current_status = YAHOO_STATUS_CUSTOM; 4072 4087 } else { … … 4074 4089 } 4075 4090 4076 if (yd->current_status == YAHOO_STATUS_AVAILABLE) 4077 service = YAHOO_SERVICE_ISBACK; 4078 else 4079 service = YAHOO_SERVICE_ISAWAY; 4091 /* Thank you libpurple :) */ 4092 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { 4093 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBILITY, YAHOO_STATUS_AVAILABLE, 0); 4094 yahoo_packet_hash(pkt, 13, "2"); 4095 yahoo_send_packet(yid, pkt, 0); 4096 yahoo_packet_free(pkt); 4097 4098 return; 4099 } 4100 4101 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, yd->current_status, yd->session_id); 4102 snprintf(s, sizeof(s), "%d", yd->current_status); 4103 yahoo_packet_hash(pkt, 10, s); 4080 4104 4081 if ((away == 2) && (yd->current_status == YAHOO_STATUS_AVAILABLE)) { 4082 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_BRB, yd->session_id); 4083 yahoo_packet_hash(pkt, 10, "999"); 4084 yahoo_packet_hash(pkt, 47, "2"); 4085 }else { 4086 pkt = yahoo_packet_new(service, YAHOO_STATUS_AVAILABLE, yd->session_id); 4087 snprintf(s, sizeof(s), "%d", yd->current_status); 4088 yahoo_packet_hash(pkt, 10, s); 4089 if (yd->current_status == YAHOO_STATUS_CUSTOM) { 4090 yahoo_packet_hash(pkt, 19, msg); 4091 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 4092 } else { 4093 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 4094 } 4095 4096 4097 4098 } 4105 if (yd->current_status == YAHOO_STATUS_CUSTOM) { 4106 yahoo_packet_hash(pkt, 19, msg); 4107 } else { 4108 yahoo_packet_hash(pkt, 19, ""); 4109 } 4110 4111 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 4099 4112 4100 4113 yahoo_send_packet(yid, pkt, 0); 4101 4114 yahoo_packet_free(pkt); 4115 4116 if(old_status == YAHOO_STATUS_INVISIBLE) { 4117 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBILITY, YAHOO_STATUS_AVAILABLE, 0); 4118 yahoo_packet_hash(pkt, 13, "1"); 4119 yahoo_send_packet(yid, pkt, 0); 4120 yahoo_packet_free(pkt); 4121 } 4102 4122 } 4103 4123 … … 4114 4134 LOG(("yahoo_logoff: current status: %d", yd->current_status)); 4115 4135 4116 if(yd->current_status != -1) { 4136 if(yd->current_status != -1 && 0) { 4137 /* Meh. Don't send this. The event handlers are not going to 4138 get to do this so it'll just leak memory. And the TCP 4139 connection reset will hopefully be clear enough. */ 4117 4140 pkt = yahoo_packet_new(YAHOO_SERVICE_LOGOFF, YAHOO_STATUS_AVAILABLE, yd->session_id); 4118 4141 yd->current_status = -1; … … 4347 4370 return; 4348 4371 4349 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id); 4350 yahoo_packet_hash(pkt, 1, yd->user); 4351 yahoo_packet_hash(pkt, 7, who); 4352 yahoo_packet_hash(pkt, 65, group); 4372 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YPACKET_STATUS_DEFAULT, yd->session_id); 4373 4353 4374 if (msg != NULL) /* add message/request "it's me add me" */ 4354 4375 yahoo_packet_hash(pkt, 14, msg); 4376 else 4377 yahoo_packet_hash(pkt,14,""); 4378 4379 yahoo_packet_hash(pkt, 65, group); 4380 yahoo_packet_hash(pkt, 97, "1"); 4381 yahoo_packet_hash(pkt, 1, yd->user); 4382 yahoo_packet_hash(pkt, 302, "319"); 4383 yahoo_packet_hash(pkt, 300, "319"); 4384 yahoo_packet_hash(pkt, 7, who); 4385 yahoo_packet_hash(pkt, 334, "0"); 4386 yahoo_packet_hash(pkt, 301, "319"); 4387 yahoo_packet_hash(pkt, 303, "319"); 4388 4389 4355 4390 yahoo_send_packet(yid, pkt, 0); 4356 4391 yahoo_packet_free(pkt); … … 4374 4409 yahoo_send_packet(yid, pkt, 0); 4375 4410 yahoo_packet_free(pkt); 4411 } 4412 4413 void yahoo_accept_buddy_ymsg13(int id,const char* me,const char* who){ 4414 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); 4415 struct yahoo_data *yd; 4416 4417 if(!yid) 4418 return; 4419 yd = yid->yd; 4420 4421 struct yahoo_packet* pkt=NULL; 4422 pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0); 4423 4424 yahoo_packet_hash(pkt,1,me ?: yd->user); 4425 yahoo_packet_hash(pkt,5,who); 4426 yahoo_packet_hash(pkt,13,"1"); 4427 yahoo_packet_hash(pkt,334,"0"); 4428 yahoo_send_packet(yid, pkt, 0); 4429 yahoo_packet_free(pkt); 4430 } 4431 4432 void yahoo_reject_buddy_ymsg13(int id,const char* me,const char* who,const char* msg){ 4433 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); 4434 struct yahoo_data *yd; 4435 4436 if(!yid) 4437 return; 4438 yd = yid->yd; 4439 4440 struct yahoo_packet* pkt=NULL; 4441 pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0); 4442 4443 yahoo_packet_hash(pkt,1,me ?: yd->user); 4444 yahoo_packet_hash(pkt,5,who); 4445 // yahoo_packet_hash(pkt,241,YAHOO_PROTO_VER); 4446 yahoo_packet_hash(pkt,13,"2"); 4447 yahoo_packet_hash(pkt,334,"0"); 4448 yahoo_packet_hash(pkt,97,"1"); 4449 yahoo_packet_hash(pkt,14,msg?:""); 4450 4451 yahoo_send_packet(yid, pkt, 0); 4452 yahoo_packet_free(pkt); 4453 4376 4454 } 4377 4455 … … 4431 4509 return; 4432 4510 4433 pkt = yahoo_packet_new(YAHOO_SERVICE_STEALTH _PERM, YAHOO_STATUS_AVAILABLE, yd->session_id);4511 pkt = yahoo_packet_new(YAHOO_SERVICE_STEALTH, YAHOO_STATUS_AVAILABLE, yd->session_id); 4434 4512 yahoo_packet_hash(pkt, 1, yd->user); 4435 4513 yahoo_packet_hash(pkt, 7, who); -
protocols/yahoo/yahoo.c
rb3117f2 r4e04194 254 254 static GList *byahoo_away_states( struct im_connection *ic ) 255 255 { 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 ); 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 } 270 273 271 274 return m; … … 346 349 347 350 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 ); 348 365 } 349 366 … … 373 390 ret->handle_cmp = g_strcasecmp; 374 391 392 ret->auth_allow = byahoo_auth_allow; 393 ret->auth_deny = byahoo_auth_deny; 394 375 395 register_protocol(ret); 376 396 } … … 452 472 struct byahoo_write_ready_data *d = data; 453 473 454 yahoo_write_ready( d->id, d->fd, d->data ); 455 456 return FALSE; 474 return yahoo_write_ready( d->id, d->fd, d->data ); 457 475 } 458 476 … … 922 940 } 923 941 942 void ext_yahoo_contact_auth_request( int id, const char *myid, const char *who, const char *msg ) 943 { 944 struct im_connection *ic = byahoo_get_ic_by_id( id ); 945 946 imcb_ask_auth( ic, who, NULL ); 947 } 948 924 949 void ext_yahoo_contact_added( int id, const char *myid, const char *who, const char *msg ) 925 950 { 926 /* Groups schmoups. If I want to handle groups properly I can get the927 buddy data from some internal libyahoo2 structure. */928 imcb_add_buddy( byahoo_get_ic_by_id( id ), (char*) who, NULL );951 struct im_connection *ic = byahoo_get_ic_by_id( id ); 952 953 imcb_add_buddy( ic, (char*) who, NULL ); 929 954 } 930 955 -
protocols/yahoo/yahoo2.h
rb3117f2 r4e04194 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 219 222 #include "yahoo_httplib.h" 220 223 -
protocols/yahoo/yahoo2_callbacks.h
rb3117f2 r4e04194 361 361 362 362 /* 363 * Name: ext_yahoo_contact_auth_request 364 * Called when a contact wants to add you to his/her contact list 365 * Params: 366 * id - the id that identifies the server connection 367 * myid - the identity s/he added 368 * who - who did it 369 * msg - any message sent 370 */ 371 void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_auth_request)(int id, const char *myid, const char *who, const char *msg); 372 373 374 /* 363 375 * Name: ext_yahoo_contact_added 364 376 * Called when a contact is added to your list -
protocols/yahoo/yahoo2_types.h
rb3117f2 r4e04194 57 57 YAHOO_LOGIN_LOCK = 14, 58 58 YAHOO_LOGIN_DUPL = 99, 59 YAHOO_LOGIN_SOCK = -1 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 60 73 }; 61 74 … … 133 146 #define YAHOO_CHAT_MALE 0x8000 134 147 #define YAHOO_CHAT_FEMALE 0x10000 135 #define YAHOO_CHAT_FEMALE 0x10000136 148 #define YAHOO_CHAT_DUNNO 0x400 137 149 #define YAHOO_CHAT_WEBCAM 0x10 -
root_commands.c
rb3117f2 r4e04194 29 29 #include "bitlbee.h" 30 30 #include "help.h" 31 #include "chat.h" 31 32 32 33 #include <string.h> -
storage_xml.c
rb3117f2 r4e04194 29 29 #include "arc.h" 30 30 #include "md5.h" 31 #include "chat.h" 31 32 32 33 #if GLIB_CHECK_VERSION(2,8,0) -
user.c
rb3117f2 r4e04194 141 141 } 142 142 143 user_t *user_findhandle( struct im_connection *ic, c har *handle )143 user_t *user_findhandle( struct im_connection *ic, const char *handle ) 144 144 { 145 145 user_t *u; -
user.h
rb3117f2 r4e04194 56 56 int user_del( irc_t *irc, char *nick ); 57 57 G_MODULE_EXPORT user_t *user_find( irc_t *irc, char *nick ); 58 G_MODULE_EXPORT user_t *user_findhandle( struct im_connection *ic, c har *handle );58 G_MODULE_EXPORT user_t *user_findhandle( struct im_connection *ic, const char *handle ); 59 59 void user_rename( irc_t *irc, char *oldnick, char *newnick ); 60 60
Note: See TracChangeset
for help on using the changeset viewer.