Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/yahoo/libyahoo2.c

    r99c8f13 r823de9d  
    6969#ifdef __MINGW32__
    7070# include <winsock2.h>
     71# define write(a,b,c) send(a,b,c,0)
     72# define read(a,b,c)  recv(a,b,c,0)
    7173#endif
    7274
     
    8991
    9092#include "base64.h"
    91 #include "http_client.h"
    9293
    9394#ifdef USE_STRUCT_CALLBACKS
     
    170171        YAHOO_SERVICE_GOTGROUPRENAME, /* < 1, 36(old), 37(new) */
    171172        YAHOO_SERVICE_SYSMESSAGE = 0x14,
    172         YAHOO_SERVICE_SKINNAME = 0x15,
    173173        YAHOO_SERVICE_PASSTHROUGH2 = 0x16,
    174174        YAHOO_SERVICE_CONFINVITE = 0x18,
     
    194194        YAHOO_SERVICE_LIST,
    195195        YAHOO_SERVICE_AUTH = 0x57,
    196         YAHOO_SERVICE_AUTHBUDDY = 0x6d,
    197196        YAHOO_SERVICE_ADDBUDDY = 0x83,
    198197        YAHOO_SERVICE_REMBUDDY,
     
    200199        YAHOO_SERVICE_REJECTCONTACT,
    201200        YAHOO_SERVICE_GROUPRENAME = 0x89, /* > 1, 65(new), 66(0), 67(old) */
    202         YAHOO_SERVICE_Y7_PING = 0x8A, /* 0 - id and that's it?? */
    203201        YAHOO_SERVICE_CHATONLINE = 0x96, /* > 109(id), 1, 6(abcde) < 0,1*/
    204202        YAHOO_SERVICE_CHATGOTO,
     
    206204        YAHOO_SERVICE_CHATLEAVE,
    207205        YAHOO_SERVICE_CHATEXIT = 0x9b,
    208         YAHOO_SERVICE_CHATADDINVITE = 0x9d,
    209206        YAHOO_SERVICE_CHATLOGOUT = 0xa0,
    210207        YAHOO_SERVICE_CHATPING,
     
    214211        YAHOO_SERVICE_PICTURE = 0xbe,
    215212        YAHOO_SERVICE_PICTURE_UPDATE = 0xc1,
    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,
     213        YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2
    229214};
    230215
     
    750735
    751736        memcpy(data + pos, "YMSG", 4); pos += 4;
    752         pos += yahoo_put16(data + pos, YAHOO_PROTO_VER);
     737        pos += yahoo_put16(data + pos, 0x000c);
    753738        pos += yahoo_put16(data + pos, 0x0000);
    754739        pos += yahoo_put16(data + pos, pktlen + extra_pad);
     
    764749                yahoo_send_data(yid->fd, data, len);
    765750        else
    766                 yahoo_add_to_send_queue(yid, data, len);
     751        yahoo_add_to_send_queue(yid, data, len);
    767752        FREE(data);
    768753}
     
    14841469
    14851470                if (u->name != NULL) {
    1486                         if (pkt->service == YAHOO_SERVICE_LOGOFF) { /* || u->flags == 0) { Not in YMSG16 */
     1471                        if (pkt->service == YAHOO_SERVICE_LOGOFF || u->flags == 0) {
    14871472                                YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0);
    14881473                        } 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 
    14951474                                YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, u->state, u->msg, u->away, u->idle, u->mobile);
    14961475                        }
     
    15001479                y_list_free_1(t);
    15011480                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);
    15601481        }
    15611482}
     
    16301551                        }
    16311552
    1632                         if(yd->cookie_y && yd->cookie_t)
     1553                        if(yd->cookie_y && yd->cookie_t && yd->cookie_c)
    16331554                                YAHOO_CALLBACK(ext_yahoo_got_cookies)(yd->client_id);
    16341555
     
    23072228}
    23082229
    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 
    24952230static void yahoo_process_auth(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
    24962231{
     
    25202255                case 1:
    25212256                        yahoo_process_auth_0x0b(yid, seed, sn);
    2522                         break;
    2523                 case 2:
    2524                         yahoo_process_auth_0x10(yid, seed, sn);
    25252257                        break;
    25262258                default:
     
    26782410               
    26792411                yd->buddies = y_list_append(yd->buddies, bud);
    2680        
     2412               
    26812413                /* Possibly called already, but at least the call above doesn't
    26822414                   seem to happen every time (not anytime I tried). */
     
    26852417
    26862418/*      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);
    27072419}
    27082420
     
    29182630
    29192631        YList *l;
    2920         // yahoo_dump_unhandled(pkt);
     2632        yahoo_dump_unhandled(pkt);
    29212633        for (l = pkt->hash; l; l = l->next) {
    29222634                struct yahoo_pair *pair = l->data;
     
    29402652{
    29412653        DEBUG_MSG(("yahoo_packet_process: 0x%02x", pkt->service));
    2942         yahoo_dump_unhandled(pkt);
    29432654        switch (pkt->service)
    29442655        {
     
    29522663        case YAHOO_SERVICE_IDACT:
    29532664        case YAHOO_SERVICE_IDDEACT:
    2954         case YAHOO_SERVICE_Y6_STATUS_UPDATE:
    2955         case YAHOO_SERVICE_YMSG15_STATUS:
    29562665                yahoo_process_status(yid, pkt);
    29572666                break;
     
    29672676                yahoo_process_mail(yid, pkt);
    29682677                break;
    2969         case YAHOO_SERVICE_REJECTCONTACT:
    29702678        case YAHOO_SERVICE_NEWCONTACT:
    29712679                yahoo_process_contact(yid, pkt);
     
    30082716                yahoo_process_buddyadd(yid, pkt);
    30092717                break;
    3010         case YAHOO_SERVICE_CONTACT_YMSG13:
    3011                 yahoo_process_contact_ymsg13(yid,pkt);
    3012                 break;
    30132718        case YAHOO_SERVICE_REMBUDDY:
    30142719                yahoo_process_buddydel(yid, pkt);
     
    30392744        case YAHOO_SERVICE_CHATLOGOFF:
    30402745        case YAHOO_SERVICE_CHATMSG:
     2746        case YAHOO_SERVICE_REJECTCONTACT:
    30412747        case YAHOO_SERVICE_PEERTOPEER:
    30422748                WARNING(("unhandled service 0x%02x", pkt->service));
     
    30522758                yahoo_process_picture_upload(yid, pkt);
    30532759                break; 
    3054         case YAHOO_SERVICE_YMSG15_BUDDY_LIST:   /* Buddy List */
    3055                 yahoo_process_buddy_list(yid, pkt);
    30562760        default:
    30572761                WARNING(("unknown service 0x%02x", pkt->service));
     
    38373541        yahoo_process_webcam_connection,
    38383542        yahoo_process_chatcat_connection,
    3839         yahoo_process_search_connection,
     3543        yahoo_process_search_connection
    38403544};
    38413545
     
    38553559        } while(len == -1 && errno == EINTR);
    38563560
    3857         if(len == -1 && (errno == EAGAIN||errno == EINTR))      /* we'll try again later */
     3561        if(len == -1 && errno == EAGAIN)        /* we'll try again later */
    38583562                return 1;
    38593563
     
    40583762
    40593763        yahoo_packet_hash(pkt, 5, who);
    4060         yahoo_packet_hash(pkt, 1, from?from:yd->user);
     3764        yahoo_packet_hash(pkt, 4, from?from:yd->user);
    40613765        yahoo_packet_hash(pkt, 14, " ");
    40623766        yahoo_packet_hash(pkt, 13, typ ? "1" : "0");
     
    40733777        struct yahoo_data *yd;
    40743778        struct yahoo_packet *pkt = NULL;
    4075         int old_status;
     3779        int service;
    40763780        char s[4];
    40773781
     
    40813785        yd = yid->yd;
    40823786
    4083         old_status = yd->current_status;
    4084 
    4085         if (msg && strncmp(msg,"Invisible",9)) {
     3787        if (msg) {
    40863788                yd->current_status = YAHOO_STATUS_CUSTOM;
    40873789        } else {
     
    40893791        }
    40903792
    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);
     3793        if (yd->current_status == YAHOO_STATUS_AVAILABLE)
     3794                service = YAHOO_SERVICE_ISBACK;
     3795        else
     3796                service = YAHOO_SERVICE_ISAWAY;
    41043797         
    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");
     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        }
    41123816
    41133817        yahoo_send_packet(yid, pkt, 0);
    41143818        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         }
    41223819}
    41233820
     
    41343831        LOG(("yahoo_logoff: current status: %d", yd->current_status));
    41353832
    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. */
     3833        if(yd->current_status != -1) {
    41403834                pkt = yahoo_packet_new(YAHOO_SERVICE_LOGOFF, YAHOO_STATUS_AVAILABLE, yd->session_id);
    41413835                yd->current_status = -1;
     
    43704064                return;
    43714065
    4372         pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YPACKET_STATUS_DEFAULT, yd->session_id);
    4373 
     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);
    43744070        if (msg != NULL) /* add message/request "it's me add me" */
    43754071                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 
    43904072        yahoo_send_packet(yid, pkt, 0);
    43914073        yahoo_packet_free(pkt);
     
    44094091        yahoo_send_packet(yid, pkt, 0);
    44104092        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 
    44544093}
    44554094
Note: See TracChangeset for help on using the changeset viewer.