Changeset c5bc47b for protocols/yahoo/libyahoo2.c
- Timestamp:
- 2009-10-17T17:24:52Z (15 years ago)
- Branches:
- master
- Children:
- c48a033
- Parents:
- 0c41177 (diff), 2e44b1f (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/yahoo/libyahoo2.c
r0c41177 rc5bc47b 89 89 90 90 #include "base64.h" 91 #include "http_client.h" 91 92 92 93 #ifdef USE_STRUCT_CALLBACKS … … 169 170 YAHOO_SERVICE_GOTGROUPRENAME, /* < 1, 36(old), 37(new) */ 170 171 YAHOO_SERVICE_SYSMESSAGE = 0x14, 172 YAHOO_SERVICE_SKINNAME = 0x15, 171 173 YAHOO_SERVICE_PASSTHROUGH2 = 0x16, 172 174 YAHOO_SERVICE_CONFINVITE = 0x18, … … 192 194 YAHOO_SERVICE_LIST, 193 195 YAHOO_SERVICE_AUTH = 0x57, 196 YAHOO_SERVICE_AUTHBUDDY = 0x6d, 194 197 YAHOO_SERVICE_ADDBUDDY = 0x83, 195 198 YAHOO_SERVICE_REMBUDDY, … … 197 200 YAHOO_SERVICE_REJECTCONTACT, 198 201 YAHOO_SERVICE_GROUPRENAME = 0x89, /* > 1, 65(new), 66(0), 67(old) */ 202 YAHOO_SERVICE_Y7_PING = 0x8A, /* 0 - id and that's it?? */ 199 203 YAHOO_SERVICE_CHATONLINE = 0x96, /* > 109(id), 1, 6(abcde) < 0,1*/ 200 204 YAHOO_SERVICE_CHATGOTO, … … 202 206 YAHOO_SERVICE_CHATLEAVE, 203 207 YAHOO_SERVICE_CHATEXIT = 0x9b, 208 YAHOO_SERVICE_CHATADDINVITE = 0x9d, 204 209 YAHOO_SERVICE_CHATLOGOUT = 0xa0, 205 210 YAHOO_SERVICE_CHATPING, … … 209 214 YAHOO_SERVICE_PICTURE = 0xbe, 210 215 YAHOO_SERVICE_PICTURE_UPDATE = 0xc1, 211 YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2 216 YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2, 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, 212 229 }; 213 230 … … 733 750 734 751 memcpy(data + pos, "YMSG", 4); pos += 4; 735 pos += yahoo_put16(data + pos, 0x000c);752 pos += yahoo_put16(data + pos, YAHOO_PROTO_VER); 736 753 pos += yahoo_put16(data + pos, 0x0000); 737 754 pos += yahoo_put16(data + pos, pktlen + extra_pad); … … 747 764 yahoo_send_data(yid->fd, data, len); 748 765 else 749 yahoo_add_to_send_queue(yid, data, len);766 yahoo_add_to_send_queue(yid, data, len); 750 767 FREE(data); 751 768 } … … 1467 1484 1468 1485 if (u->name != NULL) { 1469 if (pkt->service == YAHOO_SERVICE_LOGOFF || u->flags == 0) {1486 if (pkt->service == YAHOO_SERVICE_LOGOFF) { /* || u->flags == 0) { Not in YMSG16 */ 1470 1487 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0); 1471 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 1472 1495 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, u->state, u->msg, u->away, u->idle, u->mobile); 1473 1496 } … … 1477 1500 y_list_free_1(t); 1478 1501 FREE(u); 1502 } 1503 } 1504 1505 static void yahoo_process_buddy_list(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 1506 { 1507 struct yahoo_data *yd = yid->yd; 1508 YList *l; 1509 int last_packet = 0; 1510 char *cur_group = NULL; 1511 struct yahoo_buddy *newbud = NULL; 1512 1513 /* we could be getting multiple packets here */ 1514 for (l = pkt->hash; l; l = l->next) { 1515 struct yahoo_pair *pair = l->data; 1516 1517 switch(pair->key) { 1518 case 300: 1519 case 301: 1520 case 302: 1521 case 303: 1522 if ( 315 == atoi(pair->value) ) 1523 last_packet = 1; 1524 break; 1525 case 65: 1526 g_free(cur_group); 1527 cur_group = strdup(pair->value); 1528 break; 1529 case 7: 1530 newbud = y_new0(struct yahoo_buddy, 1); 1531 newbud->id = strdup(pair->value); 1532 if(cur_group) 1533 newbud->group = strdup(cur_group); 1534 else { 1535 struct yahoo_buddy *lastbud = (struct yahoo_buddy *)y_list_nth( 1536 yd->buddies, y_list_length(yd->buddies)-1)->data; 1537 newbud->group = strdup(lastbud->group); 1538 } 1539 1540 yd->buddies = y_list_append(yd->buddies, newbud); 1541 1542 break; 1543 } 1544 } 1545 1546 g_free(cur_group); 1547 1548 /* we could be getting multiple packets here */ 1549 if (last_packet) 1550 return; 1551 1552 YAHOO_CALLBACK(ext_yahoo_got_buddies)(yd->client_id, yd->buddies); 1553 1554 /*** We login at the very end of the packet communication */ 1555 if (!yd->logged_in) { 1556 yd->logged_in = TRUE; 1557 if(yd->current_status < 0) 1558 yd->current_status = yd->initial_status; 1559 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_OK, NULL); 1479 1560 } 1480 1561 } … … 1549 1630 } 1550 1631 1551 if(yd->cookie_y && yd->cookie_t && yd->cookie_c)1632 if(yd->cookie_y && yd->cookie_t) 1552 1633 YAHOO_CALLBACK(ext_yahoo_got_cookies)(yd->client_id); 1553 1634 … … 2226 2307 } 2227 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 2356 static void yahoo_process_auth_0x10(struct yahoo_input_data *yid, const char *seed, const char *sn) 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; 2372 char *url; 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); 2385 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); 2493 } 2494 2228 2495 static void yahoo_process_auth(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 2229 2496 { … … 2253 2520 case 1: 2254 2521 yahoo_process_auth_0x0b(yid, seed, sn); 2522 break; 2523 case 2: 2524 yahoo_process_auth_0x10(yid, seed, sn); 2255 2525 break; 2256 2526 default: … … 2408 2678 2409 2679 yd->buddies = y_list_append(yd->buddies, bud); 2410 2680 2411 2681 /* Possibly called already, but at least the call above doesn't 2412 2682 seem to happen every time (not anytime I tried). */ … … 2415 2685 2416 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); 2417 2707 } 2418 2708 … … 2628 2918 2629 2919 YList *l; 2630 yahoo_dump_unhandled(pkt);2920 // yahoo_dump_unhandled(pkt); 2631 2921 for (l = pkt->hash; l; l = l->next) { 2632 2922 struct yahoo_pair *pair = l->data; … … 2650 2940 { 2651 2941 DEBUG_MSG(("yahoo_packet_process: 0x%02x", pkt->service)); 2942 yahoo_dump_unhandled(pkt); 2652 2943 switch (pkt->service) 2653 2944 { … … 2661 2952 case YAHOO_SERVICE_IDACT: 2662 2953 case YAHOO_SERVICE_IDDEACT: 2954 case YAHOO_SERVICE_Y6_STATUS_UPDATE: 2955 case YAHOO_SERVICE_YMSG15_STATUS: 2663 2956 yahoo_process_status(yid, pkt); 2664 2957 break; … … 2674 2967 yahoo_process_mail(yid, pkt); 2675 2968 break; 2969 case YAHOO_SERVICE_REJECTCONTACT: 2676 2970 case YAHOO_SERVICE_NEWCONTACT: 2677 2971 yahoo_process_contact(yid, pkt); … … 2714 3008 yahoo_process_buddyadd(yid, pkt); 2715 3009 break; 3010 case YAHOO_SERVICE_CONTACT_YMSG13: 3011 yahoo_process_contact_ymsg13(yid,pkt); 3012 break; 2716 3013 case YAHOO_SERVICE_REMBUDDY: 2717 3014 yahoo_process_buddydel(yid, pkt); … … 2742 3039 case YAHOO_SERVICE_CHATLOGOFF: 2743 3040 case YAHOO_SERVICE_CHATMSG: 2744 case YAHOO_SERVICE_REJECTCONTACT:2745 3041 case YAHOO_SERVICE_PEERTOPEER: 2746 3042 WARNING(("unhandled service 0x%02x", pkt->service)); … … 2756 3052 yahoo_process_picture_upload(yid, pkt); 2757 3053 break; 3054 case YAHOO_SERVICE_YMSG15_BUDDY_LIST: /* Buddy List */ 3055 yahoo_process_buddy_list(yid, pkt); 2758 3056 default: 2759 3057 WARNING(("unknown service 0x%02x", pkt->service)); … … 3539 3837 yahoo_process_webcam_connection, 3540 3838 yahoo_process_chatcat_connection, 3541 yahoo_process_search_connection 3839 yahoo_process_search_connection, 3542 3840 }; 3543 3841 … … 3557 3855 } while(len == -1 && errno == EINTR); 3558 3856 3559 if(len == -1 && errno == EAGAIN) /* we'll try again later */3857 if(len == -1 && (errno == EAGAIN||errno == EINTR)) /* we'll try again later */ 3560 3858 return 1; 3561 3859 … … 3760 4058 3761 4059 yahoo_packet_hash(pkt, 5, who); 3762 yahoo_packet_hash(pkt, 4, from?from:yd->user);4060 yahoo_packet_hash(pkt, 1, from?from:yd->user); 3763 4061 yahoo_packet_hash(pkt, 14, " "); 3764 4062 yahoo_packet_hash(pkt, 13, typ ? "1" : "0"); … … 3775 4073 struct yahoo_data *yd; 3776 4074 struct yahoo_packet *pkt = NULL; 3777 int service;4075 int old_status; 3778 4076 char s[4]; 3779 4077 … … 3783 4081 yd = yid->yd; 3784 4082 3785 if (msg) { 4083 old_status = yd->current_status; 4084 4085 if (msg && strncmp(msg,"Invisible",9)) { 3786 4086 yd->current_status = YAHOO_STATUS_CUSTOM; 3787 4087 } else { … … 3789 4089 } 3790 4090 3791 if (yd->current_status == YAHOO_STATUS_AVAILABLE) 3792 service = YAHOO_SERVICE_ISBACK; 3793 else 3794 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); 3795 4104 3796 if ((away == 2) && (yd->current_status == YAHOO_STATUS_AVAILABLE)) { 3797 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_BRB, yd->session_id); 3798 yahoo_packet_hash(pkt, 10, "999"); 3799 yahoo_packet_hash(pkt, 47, "2"); 3800 }else { 3801 pkt = yahoo_packet_new(service, YAHOO_STATUS_AVAILABLE, yd->session_id); 3802 snprintf(s, sizeof(s), "%d", yd->current_status); 3803 yahoo_packet_hash(pkt, 10, s); 3804 if (yd->current_status == YAHOO_STATUS_CUSTOM) { 3805 yahoo_packet_hash(pkt, 19, msg); 3806 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 3807 } else { 3808 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 3809 } 3810 3811 3812 3813 } 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"); 3814 4112 3815 4113 yahoo_send_packet(yid, pkt, 0); 3816 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 } 3817 4122 } 3818 4123 … … 3829 4134 LOG(("yahoo_logoff: current status: %d", yd->current_status)); 3830 4135 3831 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. */ 3832 4140 pkt = yahoo_packet_new(YAHOO_SERVICE_LOGOFF, YAHOO_STATUS_AVAILABLE, yd->session_id); 3833 4141 yd->current_status = -1; … … 4062 4370 return; 4063 4371 4064 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id); 4065 yahoo_packet_hash(pkt, 1, yd->user); 4066 yahoo_packet_hash(pkt, 7, who); 4067 yahoo_packet_hash(pkt, 65, group); 4372 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YPACKET_STATUS_DEFAULT, yd->session_id); 4373 4068 4374 if (msg != NULL) /* add message/request "it's me add me" */ 4069 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 4070 4390 yahoo_send_packet(yid, pkt, 0); 4071 4391 yahoo_packet_free(pkt); … … 4089 4409 yahoo_send_packet(yid, pkt, 0); 4090 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 4091 4454 } 4092 4455
Note: See TracChangeset
for help on using the changeset viewer.