| 250 } |
250 } |
| 251 value[x] = 0; |
251 value[x] = 0; |
| 252 pair->value = g_strdup(value); |
252 pair->value = g_strdup(value); |
| 253 g_free(value); |
253 g_free(value); |
| 254 pkt->hash = g_slist_append(pkt->hash, pair); |
254 pkt->hash = g_slist_append(pkt->hash, pair); |
| 255 debug_printf("Key: %d \tValue: %s\n", pair->key, pair->value); |
255 gaim_debug(GAIM_DEBUG_MISC, "prpl-yahoo", |
| |
256 "Key: %d \tValue: %s\n", pair->key, pair->value); |
| 256 } else { |
257 } else { |
| 257 g_free(pair); |
258 g_free(pair); |
| 258 } |
259 } |
| 259 pos += 2; |
260 pos += 2; |
| 260 |
261 |
| 290 |
291 |
| 291 static void yahoo_packet_dump(guchar *data, int len) |
292 static void yahoo_packet_dump(guchar *data, int len) |
| 292 { |
293 { |
| 293 #ifdef YAHOO_DEBUG |
294 #ifdef YAHOO_DEBUG |
| 294 int i; |
295 int i; |
| |
296 |
| |
297 gaim_debug(GAIM_DEBUG_MISC, "prpl-yahoo", ""); |
| |
298 |
| 295 for (i = 0; i + 1 < len; i += 2) { |
299 for (i = 0; i + 1 < len; i += 2) { |
| 296 if ((i % 16 == 0) && i) |
300 if ((i % 16 == 0) && i) { |
| 297 debug_printf("\n"); |
301 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
| 298 debug_printf("%02x", data[i]); |
302 gaim_debug(GAIM_DEBUG_MISC, "prpl-yahoo", ""); |
| 299 debug_printf("%02x ", data[i+1]); |
303 } |
| |
304 |
| |
305 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02x%02x ", data[i], data[i + 1]); |
| 300 } |
306 } |
| 301 if (i < len) |
307 if (i < len) |
| 302 debug_printf("%02x", data[i]); |
308 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02x", data[i]); |
| 303 debug_printf("\n"); |
309 |
| |
310 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
| |
311 gaim_debug(GAIM_DEBUG_MISC, "prpl-yahoo", ""); |
| |
312 |
| 304 for (i = 0; i < len; i++) { |
313 for (i = 0; i < len; i++) { |
| 305 if ((i % 16 == 0) && i) |
314 if ((i % 16 == 0) && i) { |
| 306 debug_printf("\n"); |
315 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
| |
316 gaim_debug(GAIM_DEBUG_MISC, "prpl-yahoo", ""); |
| |
317 } |
| |
318 |
| 307 if (isprint(data[i])) |
319 if (isprint(data[i])) |
| 308 debug_printf("%c ", data[i]); |
320 gaim_debug(GAIM_DEBUG_MISC, NULL, "%c ", data[i]); |
| 309 else |
321 else |
| 310 debug_printf(". "); |
322 gaim_debug(GAIM_DEBUG_MISC, NULL, ". "); |
| 311 } |
323 } |
| 312 debug_printf("\n"); |
324 |
| |
325 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
| 313 #endif |
326 #endif |
| 314 } |
327 } |
| 315 |
328 |
| 316 static int yahoo_send_packet(struct yahoo_data *yd, struct yahoo_packet *pkt) |
329 static int yahoo_send_packet(struct yahoo_data *yd, struct yahoo_packet *pkt) |
| 317 { |
330 { |
| 434 break; |
447 break; |
| 435 case 16: /* Custom error message */ |
448 case 16: /* Custom error message */ |
| 436 do_error_dialog(pair->value, NULL, GAIM_ERROR); |
449 do_error_dialog(pair->value, NULL, GAIM_ERROR); |
| 437 break; |
450 break; |
| 438 default: |
451 default: |
| 439 debug_printf("unknown status key %d\n", pair->key); |
452 gaim_debug(GAIM_DEBUG_ERROR, "prpl-yahoo", |
| |
453 "Unknown status key %d\n", pair->key); |
| 440 break; |
454 break; |
| 441 } |
455 } |
| 442 |
456 |
| 443 l = l->next; |
457 l = l->next; |
| 444 } |
458 } |
| 523 else |
537 else |
| 524 serv_got_typing_stopped(gc, from); |
538 serv_got_typing_stopped(gc, from); |
| 525 } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) { |
539 } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) { |
| 526 struct buddy *bud = gaim_find_buddy(gc->account, from); |
540 struct buddy *bud = gaim_find_buddy(gc->account, from); |
| 527 void *free1=NULL, *free2=NULL; |
541 void *free1=NULL, *free2=NULL; |
| 528 if (!bud) |
542 if (!bud) { |
| 529 debug_printf("%s is playing a game, and doesn't want you to know.\n", from); |
543 gaim_debug(GAIM_DEBUG_WARNING, "prpl-yahoo", |
| |
544 "%s is playing a game, and doesn't want " |
| |
545 "you to know.\n", from); |
| |
546 } |
| |
547 |
| 530 if (*stat == '1') { |
548 if (*stat == '1') { |
| 531 if (g_hash_table_lookup_extended (yd->games, from, free1, free2)) { |
549 if (g_hash_table_lookup_extended (yd->games, from, free1, free2)) { |
| 532 g_free(free1); |
550 g_free(free1); |
| 533 g_free(free2); |
551 g_free(free2); |
| 534 } |
552 } |
| 857 break; |
875 break; |
| 858 case YAHOO_SERVICE_AUTH: |
876 case YAHOO_SERVICE_AUTH: |
| 859 yahoo_process_auth(gc, pkt); |
877 yahoo_process_auth(gc, pkt); |
| 860 break; |
878 break; |
| 861 default: |
879 default: |
| 862 debug_printf("unhandled service 0x%02x\n", pkt->service); |
880 gaim_debug(GAIM_DEBUG_ERROR, "prpl-yahoo", |
| |
881 "Unhandled service 0x%02x\n", pkt->service); |
| 863 break; |
882 break; |
| 864 } |
883 } |
| 865 } |
884 } |
| 866 |
885 |
| 867 static void yahoo_pending(gpointer data, gint source, GaimInputCondition cond) |
886 static void yahoo_pending(gpointer data, gint source, GaimInputCondition cond) |
| 894 pos += 4; /* YMSG */ |
913 pos += 4; /* YMSG */ |
| 895 pos += 2; |
914 pos += 2; |
| 896 pos += 2; |
915 pos += 2; |
| 897 |
916 |
| 898 pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2; |
917 pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2; |
| 899 debug_printf("%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen); |
918 gaim_debug(GAIM_DEBUG_MISC, "prpl-yahoo", |
| |
919 "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen); |
| 900 |
920 |
| 901 if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen)) |
921 if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen)) |
| 902 return; |
922 return; |
| 903 |
923 |
| 904 yahoo_packet_dump(yd->rxqueue, YAHOO_PACKET_HDRLEN + pktlen); |
924 yahoo_packet_dump(yd->rxqueue, YAHOO_PACKET_HDRLEN + pktlen); |
| 905 |
925 |
| 906 pkt = yahoo_packet_new(0, 0, 0); |
926 pkt = yahoo_packet_new(0, 0, 0); |
| 907 |
927 |
| 908 pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2; |
928 pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2; |
| 909 pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4; |
929 pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4; |
| 910 debug_printf("Yahoo Service: 0x%02x Status: %d\n", pkt->service, pkt->status); |
930 gaim_debug(GAIM_DEBUG_MISC, "prpl-yahoo", |
| |
931 "Yahoo Service: 0x%02x Status: %d\n", |
| |
932 pkt->service, pkt->status); |
| 911 pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4; |
933 pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4; |
| 912 |
934 |
| 913 yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen); |
935 yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen); |
| 914 |
936 |
| 915 yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen; |
937 yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen; |
| 969 yd->games = g_hash_table_new(g_str_hash, g_str_equal); |
991 yd->games = g_hash_table_new(g_str_hash, g_str_equal); |
| 970 |
992 |
| 971 |
993 |
| 972 if (!g_ascii_strncasecmp(account->proto_opt[USEROPT_PAGERHOST], "cs.yahoo.com", strlen("cs.yahoo.com"))) { |
994 if (!g_ascii_strncasecmp(account->proto_opt[USEROPT_PAGERHOST], "cs.yahoo.com", strlen("cs.yahoo.com"))) { |
| 973 /* Figured out the new auth method -- cs.yahoo.com likes to disconnect on buddy remove and add now */ |
995 /* Figured out the new auth method -- cs.yahoo.com likes to disconnect on buddy remove and add now */ |
| 974 debug_printf("Setting new Yahoo! server.\n"); |
996 gaim_debug(GAIM_DEBUG_INFO, "prpl-yahoo", |
| 975 g_snprintf(account->proto_opt[USEROPT_PAGERHOST], strlen("scs.yahoo.com") + 1, "scs.yahoo.com"); |
997 "Setting new Yahoo! server.\n"); |
| |
998 g_snprintf(account->proto_opt[USEROPT_PAGERHOST], |
| |
999 strlen("scs.yahoo.com") + 1, "scs.yahoo.com"); |
| 976 save_prefs(); |
1000 save_prefs(); |
| 977 } |
1001 } |
| 978 |
1002 |
| 979 |
1003 |
| 980 if (proxy_connect(account, account->proto_opt[USEROPT_PAGERHOST][0] ? |
1004 if (proxy_connect(account, account->proto_opt[USEROPT_PAGERHOST][0] ? |