comparison src/protocols/yahoo/yahoochat.c @ 8410:3c07b7d0084c

[gaim-migrate @ 9140] quoth marv: " This makes joining those chats with the arabic script in their names actually work, and lets you see people typing in arabic in UTF-8, instead of parsing it as ISO-8859-1. It probably fixes similiar problems with other languages, but the arabic text standed out the most in the room list. It's pretty simple, and doesn't change any strings. It's against yahoochat.c, you'll probably have to patch the file specificly since I diffed it specificly. If you need an example to test again, look through the room list. That's how I noticed this didn't already work." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 08 Mar 2004 19:06:17 +0000
parents 1f56ea865926
children 058efd3cb86f
comparison
equal deleted inserted replaced
8409:6f30052c31dc 8410:3c07b7d0084c
355 struct yahoo_pair *pair = l->data; 355 struct yahoo_pair *pair = l->data;
356 356
357 switch (pair->key) { 357 switch (pair->key) {
358 358
359 case 104: 359 case 104:
360 room = yahoo_string_decode(gc, pair->value, FALSE); 360 room = yahoo_string_decode(gc, pair->value, TRUE);
361 break; 361 break;
362 case 105: 362 case 105:
363 topic = yahoo_string_decode(gc, pair->value, FALSE); 363 topic = yahoo_string_decode(gc, pair->value, TRUE);
364 break; 364 break;
365 case 128: 365 case 128:
366 someid = pair->value; 366 someid = pair->value;
367 break; 367 break;
368 case 108: /* number of joiners */ 368 case 108: /* number of joiners */
455 455
456 for (l = pkt->hash; l; l = l->next) { 456 for (l = pkt->hash; l; l = l->next) {
457 struct yahoo_pair *pair = l->data; 457 struct yahoo_pair *pair = l->data;
458 458
459 if (pair->key == 104) 459 if (pair->key == 104)
460 room = yahoo_string_decode(gc, pair->value, FALSE); 460 room = yahoo_string_decode(gc, pair->value, TRUE);
461 if (pair->key == 109) 461 if (pair->key == 109)
462 who = pair->value; 462 who = pair->value;
463 } 463 }
464 464
465 465
474 } 474 }
475 475
476 void yahoo_process_chat_message(GaimConnection *gc, struct yahoo_packet *pkt) 476 void yahoo_process_chat_message(GaimConnection *gc, struct yahoo_packet *pkt)
477 { 477 {
478 char *room = NULL, *who = NULL, *msg = NULL, *msg2; 478 char *room = NULL, *who = NULL, *msg = NULL, *msg2;
479 int msgtype = 1, utf8 = 0; 479 int msgtype = 1, utf8 = 1; /* default to utf8 */
480 GaimConversation *c = NULL; 480 GaimConversation *c = NULL;
481 GSList *l; 481 GSList *l;
482 482
483 for (l = pkt->hash; l; l = l->next) { 483 for (l = pkt->hash; l; l = l->next) {
484 struct yahoo_pair *pair = l->data; 484 struct yahoo_pair *pair = l->data;
487 487
488 case 97: 488 case 97:
489 utf8 = strtol(pair->value, NULL, 10); 489 utf8 = strtol(pair->value, NULL, 10);
490 break; 490 break;
491 case 104: 491 case 104:
492 room = yahoo_string_decode(gc, pair->value, FALSE); 492 room = yahoo_string_decode(gc, pair->value, TRUE);
493 break; 493 break;
494 case 109: 494 case 109:
495 who = pair->value; 495 who = pair->value;
496 break; 496 break;
497 case 117: 497 case 117:
542 for (l = pkt->hash; l; l = l->next) { 542 for (l = pkt->hash; l; l = l->next) {
543 struct yahoo_pair *pair = l->data; 543 struct yahoo_pair *pair = l->data;
544 544
545 switch (pair->key) { 545 switch (pair->key) {
546 case 104: 546 case 104:
547 room = yahoo_string_decode(gc, pair->value, FALSE); 547 room = yahoo_string_decode(gc, pair->value, TRUE);
548 break; 548 break;
549 case 129: /* room id? */ 549 case 129: /* room id? */
550 break; 550 break;
551 case 126: /* ??? */ 551 case 126: /* ??? */
552 break; 552 break;
712 { 712 {
713 struct yahoo_data *yd = gc->proto_data; 713 struct yahoo_data *yd = gc->proto_data;
714 struct yahoo_packet *pkt; 714 struct yahoo_packet *pkt;
715 GaimConversation *c; 715 GaimConversation *c;
716 char *eroom; 716 char *eroom;
717 717 gboolean utf8 = 1;
718 eroom = yahoo_string_encode(gc, room, NULL); 718
719 eroom = yahoo_string_encode(gc, room, &utf8);
719 720
720 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATEXIT, YAHOO_STATUS_AVAILABLE, 0); 721 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATEXIT, YAHOO_STATUS_AVAILABLE, 0);
721 722
722 yahoo_packet_hash(pkt, 104, eroom); 723 yahoo_packet_hash(pkt, 104, eroom);
723 yahoo_packet_hash(pkt, 109, dn); 724 yahoo_packet_hash(pkt, 109, dn);
832 static void yahoo_chat_join(GaimConnection *gc, const char *dn, const char *room, const char *topic) 833 static void yahoo_chat_join(GaimConnection *gc, const char *dn, const char *room, const char *topic)
833 { 834 {
834 struct yahoo_data *yd = gc->proto_data; 835 struct yahoo_data *yd = gc->proto_data;
835 struct yahoo_packet *pkt; 836 struct yahoo_packet *pkt;
836 char *room2; 837 char *room2;
837 838 gboolean utf8 = TRUE;
838 room2 = yahoo_string_encode(gc, room, NULL); 839
840 /* apparently room names are always utf8, or else always not utf8,
841 * so we don't have to actually pass the flag in the packet. Or something. */
842 room2 = yahoo_string_encode(gc, room, &utf8);
839 843
840 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATJOIN, YAHOO_STATUS_AVAILABLE, 0); 844 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATJOIN, YAHOO_STATUS_AVAILABLE, 0);
841 845
842 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); 846 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
843 yahoo_packet_hash(pkt, 62, "2"); 847 yahoo_packet_hash(pkt, 62, "2");
854 const char *room, const char *msg) 858 const char *room, const char *msg)
855 { 859 {
856 struct yahoo_data *yd = gc->proto_data; 860 struct yahoo_data *yd = gc->proto_data;
857 struct yahoo_packet *pkt; 861 struct yahoo_packet *pkt;
858 char *room2, *msg2 = NULL; 862 char *room2, *msg2 = NULL;
859 863 gboolean utf8 = TRUE;
860 room2 = yahoo_string_encode(gc, room, NULL); 864
865 room2 = yahoo_string_encode(gc, room, &utf8);
861 if (msg) 866 if (msg)
862 msg2 = yahoo_string_encode(gc, msg, NULL); 867 msg2 = yahoo_string_encode(gc, msg, NULL);
863 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATADDINVITE, YAHOO_STATUS_AVAILABLE, 0); 868 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATADDINVITE, YAHOO_STATUS_AVAILABLE, 0);
864 869
865 yahoo_packet_hash(pkt, 1, dn); 870 yahoo_packet_hash(pkt, 1, dn);