comparison libgaim/protocols/yahoo/yahoo.c @ 14258:cb2714fdf274

[gaim-migrate @ 16940] up the protocol version, handle the new buddy list message (which i renamed the service for again), pretend auth type 2 is auth type 1, note when a buddy is an msn buddy, and possibly even send msn buddy messages correctly. I haven't really tested if everything works with the new protocol version, but I can always lower it again if bad things start happening and I don't have time to fix them before the release. I don't know if sending messages to msn users really works or not, it seems to be down server side at the moment. Someone test when msn gets it working again :P There's no way to add msn contacts to your yahoo account from within gaim. Not sure how we'll do the UI for that. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Mon, 21 Aug 2006 04:12:07 +0000
parents 60b1bc8dbf37
children 0ac0f16aa006
comparison
equal deleted inserted replaced
14257:14933d9055a0 14258:cb2714fdf274
465 } else if (c[0] == 'T') { 465 } else if (c[0] == 'T') {
466 if (yd->cookie_t) 466 if (yd->cookie_t)
467 g_free(yd->cookie_t); 467 g_free(yd->cookie_t);
468 yd->cookie_t = _getcookie(c); 468 yd->cookie_t = _getcookie(c);
469 } 469 }
470 }
471
472 static void yahoo_process_list_15(GaimConnection *gc, struct yahoo_packet *pkt)
473 {
474 GSList *l = pkt->hash;
475
476 GaimAccount *account = gaim_connection_get_account(gc);
477 GHashTable *ht;
478 char *grp = NULL;
479 char *norm_bud = NULL;
480
481 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free);
482
483 while (l) {
484 struct yahoo_pair *pair = l->data;
485 YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */
486 /* But what if you had no friends? */
487 GaimBuddy *b;
488 GaimGroup *g;
489
490
491 l = l->next;
492
493 switch (pair->key) {
494 case 302: /* what is this? it's always 318 before a group, 319 before a s/n */
495 case 300: /* ditto */
496 break;
497 case 65: /* This is the group */
498 g_free(grp);
499 grp = yahoo_string_decode(gc, pair->value, FALSE);
500 break;
501 case 7: /* buddy's s/n */
502 g_free(norm_bud);
503 norm_bud = g_strdup(gaim_normalize(account, pair->value));
504 f = yahoo_friend_find_or_new(gc, norm_bud);
505 if (!(b = gaim_find_buddy(account, norm_bud))) {
506 if (!(g = gaim_find_group(grp))) {
507 g = gaim_group_new(grp);
508 gaim_blist_add_group(g, NULL);
509 }
510 b = gaim_buddy_new(account, norm_bud, NULL);
511 gaim_blist_add_buddy(b, NULL, g, NULL);
512 }
513 yahoo_do_group_check(account, ht, norm_bud, grp);
514
515 break;
516 case 241: /* msn user */
517 if (f && *pair->value == '1')
518 f->msn = TRUE;
519 break;
520 /* case 242: */ /* this seems related to 241 */
521 /* break; */
522 }
523 }
524
525 g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL);
526 g_hash_table_destroy(ht);
527 g_free(grp);
528 g_free(norm_bud);
470 } 529 }
471 530
472 static void yahoo_process_list(GaimConnection *gc, struct yahoo_packet *pkt) 531 static void yahoo_process_list(GaimConnection *gc, struct yahoo_packet *pkt)
473 { 532 {
474 GSList *l = pkt->hash; 533 GSList *l = pkt->hash;
1708 switch (m) { 1767 switch (m) {
1709 case 0: 1768 case 0:
1710 yahoo_process_auth_old(gc, seed); 1769 yahoo_process_auth_old(gc, seed);
1711 break; 1770 break;
1712 case 1: 1771 case 1:
1772 case 2: /* This case seems to work, could probably use testing */
1713 yahoo_process_auth_new(gc, seed); 1773 yahoo_process_auth_new(gc, seed);
1714 break; 1774 break;
1715 default: 1775 default:
1716 buf = g_strdup_printf(_("The Yahoo server has requested the use of an unrecognized " 1776 buf = g_strdup_printf(_("The Yahoo server has requested the use of an unrecognized "
1717 "authentication method. This version of Gaim will likely not be able " 1777 "authentication method. This version of Gaim will likely not be able "
2040 case YAHOO_SERVICE_GAMELOGON: 2100 case YAHOO_SERVICE_GAMELOGON:
2041 case YAHOO_SERVICE_GAMELOGOFF: 2101 case YAHOO_SERVICE_GAMELOGOFF:
2042 case YAHOO_SERVICE_CHATLOGON: 2102 case YAHOO_SERVICE_CHATLOGON:
2043 case YAHOO_SERVICE_CHATLOGOFF: 2103 case YAHOO_SERVICE_CHATLOGOFF:
2044 case YAHOO_SERVICE_Y6_STATUS_UPDATE: 2104 case YAHOO_SERVICE_Y6_STATUS_UPDATE:
2105 case YAHOO_SERVICE_STATUS_15:
2045 yahoo_process_status(gc, pkt); 2106 yahoo_process_status(gc, pkt);
2046 break; 2107 break;
2047 case YAHOO_SERVICE_NOTIFY: 2108 case YAHOO_SERVICE_NOTIFY:
2048 yahoo_process_notify(gc, pkt); 2109 yahoo_process_notify(gc, pkt);
2049 break; 2110 break;
2064 case YAHOO_SERVICE_AUTHRESP: 2125 case YAHOO_SERVICE_AUTHRESP:
2065 yahoo_process_authresp(gc, pkt); 2126 yahoo_process_authresp(gc, pkt);
2066 break; 2127 break;
2067 case YAHOO_SERVICE_LIST: 2128 case YAHOO_SERVICE_LIST:
2068 yahoo_process_list(gc, pkt); 2129 yahoo_process_list(gc, pkt);
2130 break;
2131 case YAHOO_SERVICE_LIST_15:
2132 yahoo_process_list_15(gc, pkt);
2069 break; 2133 break;
2070 case YAHOO_SERVICE_AUTH: 2134 case YAHOO_SERVICE_AUTH:
2071 yahoo_process_auth(gc, pkt); 2135 yahoo_process_auth(gc, pkt);
2072 break; 2136 break;
2073 case YAHOO_SERVICE_ADDBUDDY: 2137 case YAHOO_SERVICE_ADDBUDDY:
3119 char *msg = yahoo_html_to_codes(what); 3183 char *msg = yahoo_html_to_codes(what);
3120 char *msg2; 3184 char *msg2;
3121 gboolean utf8 = TRUE; 3185 gboolean utf8 = TRUE;
3122 GaimWhiteboard *wb; 3186 GaimWhiteboard *wb;
3123 int ret = 1; 3187 int ret = 1;
3188 YahooFriend *f = NULL;
3124 3189
3125 msg2 = yahoo_string_encode(gc, msg, &utf8); 3190 msg2 = yahoo_string_encode(gc, msg, &utf8);
3126 3191
3127 yahoo_packet_hash(pkt, "ss", 1, gaim_connection_get_display_name(gc), 5, who); 3192 yahoo_packet_hash(pkt, "ss", 1, gaim_connection_get_display_name(gc), 5, who);
3193 if ((f = yahoo_friend_find(gc, who)) && f->msn)
3194 yahoo_packet_hash_str(pkt, 241, "1");
3195
3128 if (utf8) 3196 if (utf8)
3129 yahoo_packet_hash_str(pkt, 97, "1"); 3197 yahoo_packet_hash_str(pkt, 97, "1");
3130 yahoo_packet_hash_str(pkt, 14, msg2); 3198 yahoo_packet_hash_str(pkt, 14, msg2);
3131 3199
3132 /* 3200 /*