Mercurial > pidgin
comparison src/protocols/yahoo/yahoo.c @ 10394:45a0a07e8b25
[gaim-migrate @ 11623]
Renamed yahoo_packet_hash to yahoo_packet_hash_str, added
yahoo_packet_hash_int, and a new variable arg yahoo_packet_hash that calls
either of them.
I was going to add some more format chars to yahoo_packet_hash, and may
yet. Stuff like automaticly converting strings' character sets or html
to yahoo codes, etc. But first I want to look at how yahoo 6 handles
character sets and see if it's any different.
Feel free to give opinions on if these changes are actually better,
assuming you actually look at them, as opposed to running away like a girly
man when you see yahoo protocol code.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Fri, 17 Dec 2004 00:05:32 +0000 |
parents | a8f9e5ce4f92 |
children | 6a043ae92db6 |
comparison
equal
deleted
inserted
replaced
10393:a7a2c27248af | 10394:45a0a07e8b25 |
---|---|
1013 md5_append(&ctx, hash_string_c, strlen(hash_string_c)); | 1013 md5_append(&ctx, hash_string_c, strlen(hash_string_c)); |
1014 md5_finish(&ctx, result); | 1014 md5_finish(&ctx, result); |
1015 to_y64(result96, result, 16); | 1015 to_y64(result96, result, 16); |
1016 | 1016 |
1017 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0); | 1017 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0); |
1018 yahoo_packet_hash(pack, 0, name); | 1018 yahoo_packet_hash(pack, "ssss", 0, name, 6, result6, 96, result96, 1, name); |
1019 yahoo_packet_hash(pack, 6, result6); | |
1020 yahoo_packet_hash(pack, 96, result96); | |
1021 yahoo_packet_hash(pack, 1, name); | |
1022 | |
1023 yahoo_packet_send_and_free(pack, yd); | 1019 yahoo_packet_send_and_free(pack, yd); |
1024 | 1020 |
1025 g_free(hash_string_p); | 1021 g_free(hash_string_p); |
1026 g_free(hash_string_c); | 1022 g_free(hash_string_c); |
1027 } | 1023 } |
1468 sprintf(byte, "%c", delimit_lookup[lookup]); | 1464 sprintf(byte, "%c", delimit_lookup[lookup]); |
1469 strcat(resp_96, byte); | 1465 strcat(resp_96, byte); |
1470 } | 1466 } |
1471 | 1467 |
1472 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0); | 1468 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0); |
1473 yahoo_packet_hash(pack, 0, name); | 1469 yahoo_packet_hash(pack, "sssss", 0, name, 6, resp_6, 96, resp_96, 1, |
1474 yahoo_packet_hash(pack, 6, resp_6); | 1470 name, 135, "6,0,0,1710"); |
1475 yahoo_packet_hash(pack, 96, resp_96); | 1471 if (yd->picture_checksum) |
1476 yahoo_packet_hash(pack, 1, name); | 1472 yahoo_packet_hash_int(pack, 192, yd->picture_checksum); |
1477 yahoo_packet_hash(pack, 135, "6,0,0,1710"); | 1473 |
1478 if (yd->picture_checksum) { | |
1479 char *cksum = g_strdup_printf("%d", yd->picture_checksum); | |
1480 yahoo_packet_hash(pack, 192, cksum); | |
1481 g_free(cksum); | |
1482 } | |
1483 yahoo_packet_send_and_free(pack, yd); | 1474 yahoo_packet_send_and_free(pack, yd); |
1484 | 1475 |
1485 g_free(password_hash); | 1476 g_free(password_hash); |
1486 g_free(crypt_hash); | 1477 g_free(crypt_hash); |
1487 } | 1478 } |
2020 yd = gc->proto_data; | 2011 yd = gc->proto_data; |
2021 yd->fd = source; | 2012 yd->fd = source; |
2022 | 2013 |
2023 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, YAHOO_STATUS_AVAILABLE, 0); | 2014 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, YAHOO_STATUS_AVAILABLE, 0); |
2024 | 2015 |
2025 yahoo_packet_hash(pkt, 1, gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc)))); | 2016 yahoo_packet_hash_str(pkt, 1, gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc)))); |
2026 yahoo_packet_send_and_free(pkt, yd); | 2017 yahoo_packet_send_and_free(pkt, yd); |
2027 | 2018 |
2028 gc->inpa = gaim_input_add(yd->fd, GAIM_INPUT_READ, yahoo_pending, gc); | 2019 gc->inpa = gaim_input_add(yd->fd, GAIM_INPUT_READ, yahoo_pending, gc); |
2029 } | 2020 } |
2030 | 2021 |
2047 yd = gc->proto_data; | 2038 yd = gc->proto_data; |
2048 yd->fd = source; | 2039 yd->fd = source; |
2049 | 2040 |
2050 pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, 0); | 2041 pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, 0); |
2051 | 2042 |
2052 yahoo_packet_hash(pkt, 0, gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc)))); | 2043 yahoo_packet_hash(pkt, "sss", 0, |
2053 yahoo_packet_hash(pkt, 1, gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc)))); | 2044 gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc))), |
2054 yahoo_packet_hash(pkt, 6, yd->auth); | 2045 1, gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc))), |
2046 6, yd->auth); | |
2055 yahoo_packet_send_and_free(pkt, yd); | 2047 yahoo_packet_send_and_free(pkt, yd); |
2056 | 2048 |
2057 g_free(yd->auth); | 2049 g_free(yd->auth); |
2058 gc->inpa = gaim_input_add(yd->fd, GAIM_INPUT_READ, yahoo_pending, gc); | 2050 gc->inpa = gaim_input_add(yd->fd, GAIM_INPUT_READ, yahoo_pending, gc); |
2059 } | 2051 } |
2608 static void yahoo_act_id(GaimConnection *gc, const char *entry) | 2600 static void yahoo_act_id(GaimConnection *gc, const char *entry) |
2609 { | 2601 { |
2610 struct yahoo_data *yd = gc->proto_data; | 2602 struct yahoo_data *yd = gc->proto_data; |
2611 | 2603 |
2612 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, 0); | 2604 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, 0); |
2613 yahoo_packet_hash(pkt, 3, entry); | 2605 yahoo_packet_hash_str(pkt, 3, entry); |
2614 yahoo_packet_send_and_free(pkt, yd); | 2606 yahoo_packet_send_and_free(pkt, yd); |
2615 | 2607 |
2616 gaim_connection_set_display_name(gc, entry); | 2608 gaim_connection_set_display_name(gc, entry); |
2617 } | 2609 } |
2618 | 2610 |
2658 gboolean utf8 = TRUE; | 2650 gboolean utf8 = TRUE; |
2659 int ret = 1; | 2651 int ret = 1; |
2660 | 2652 |
2661 msg2 = yahoo_string_encode(gc, msg, &utf8); | 2653 msg2 = yahoo_string_encode(gc, msg, &utf8); |
2662 | 2654 |
2663 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); | 2655 yahoo_packet_hash(pkt, "ss", 1, gaim_connection_get_display_name(gc), 5, who); |
2664 yahoo_packet_hash(pkt, 5, who); | |
2665 if (utf8) | 2656 if (utf8) |
2666 yahoo_packet_hash(pkt, 97, "1"); | 2657 yahoo_packet_hash_str(pkt, 97, "1"); |
2667 yahoo_packet_hash(pkt, 14, msg2); | 2658 yahoo_packet_hash_str(pkt, 14, msg2); |
2668 | 2659 |
2669 yahoo_packet_hash(pkt, 63, ";0"); /* IMvironment */ | 2660 yahoo_packet_hash_str(pkt, 63, ";0"); /* IMvironment */ |
2670 yahoo_packet_hash(pkt, 64, "0"); /* no idea */ | 2661 yahoo_packet_hash_str(pkt, 64, "0"); /* no idea */ |
2671 yahoo_packet_hash(pkt, 1002, "1"); /* no idea, Yahoo 6 or later only it seems */ | 2662 yahoo_packet_hash_str(pkt, 1002, "1"); /* no idea, Yahoo 6 or later only it seems */ |
2672 if (!yd->picture_url) | 2663 if (!yd->picture_url) |
2673 yahoo_packet_hash(pkt, 206, "0"); /* 0 = no picture, 2 = picture, maybe 1 = avatar? */ | 2664 yahoo_packet_hash_str(pkt, 206, "0"); /* 0 = no picture, 2 = picture, maybe 1 = avatar? */ |
2674 else | 2665 else |
2675 yahoo_packet_hash(pkt, 206, "2"); | 2666 yahoo_packet_hash_str(pkt, 206, "2"); |
2676 | 2667 |
2677 /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */ | 2668 /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */ |
2678 if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000) | 2669 if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000) |
2679 yahoo_packet_send(pkt, yd); | 2670 yahoo_packet_send(pkt, yd); |
2680 else | 2671 else |
2690 | 2681 |
2691 int yahoo_send_typing(GaimConnection *gc, const char *who, int typ) | 2682 int yahoo_send_typing(GaimConnection *gc, const char *who, int typ) |
2692 { | 2683 { |
2693 struct yahoo_data *yd = gc->proto_data; | 2684 struct yahoo_data *yd = gc->proto_data; |
2694 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0); | 2685 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0); |
2695 yahoo_packet_hash(pkt, 49, "TYPING"); | 2686 yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, gaim_connection_get_display_name(gc), |
2696 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); | 2687 14, " ", 13, typ == GAIM_TYPING ? "1" : "0", |
2697 yahoo_packet_hash(pkt, 14, " "); | 2688 5, who, 1002, "1"); |
2698 yahoo_packet_hash(pkt, 13, typ == GAIM_TYPING ? "1" : "0"); | |
2699 yahoo_packet_hash(pkt, 5, who); | |
2700 yahoo_packet_hash(pkt, 1002, "1"); | |
2701 | 2689 |
2702 yahoo_packet_send_and_free(pkt, yd); | 2690 yahoo_packet_send_and_free(pkt, yd); |
2703 | 2691 |
2704 return 0; | 2692 return 0; |
2705 } | 2693 } |
2708 { | 2696 { |
2709 GaimConnection *gc = gaim_account_get_connection(account); | 2697 GaimConnection *gc = gaim_account_get_connection(account); |
2710 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | 2698 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
2711 struct yahoo_packet *pkt; | 2699 struct yahoo_packet *pkt; |
2712 int old_status = yd->current_status; | 2700 int old_status = yd->current_status; |
2713 char s[4]; | |
2714 const char *id; | 2701 const char *id; |
2715 char *conv_msg = NULL; | 2702 char *conv_msg = NULL; |
2716 char *conv_msg2 = NULL; | 2703 char *conv_msg2 = NULL; |
2717 | 2704 |
2718 id = gaim_status_get_id(status); | 2705 id = gaim_status_get_id(status); |
2750 yd->current_status = YAHOO_STATUS_AVAILABLE; | 2737 yd->current_status = YAHOO_STATUS_AVAILABLE; |
2751 } | 2738 } |
2752 | 2739 |
2753 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { | 2740 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { |
2754 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, 0); | 2741 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, 0); |
2755 yahoo_packet_hash(pkt, 13, "2"); | 2742 yahoo_packet_hash_str(pkt, 13, "2"); |
2756 yahoo_packet_send_and_free(pkt, yd); | 2743 yahoo_packet_send_and_free(pkt, yd); |
2757 | 2744 |
2758 return; | 2745 return; |
2759 } | 2746 } |
2760 | 2747 |
2761 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); | 2748 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); |
2762 g_snprintf(s, sizeof(s), "%d", yd->current_status); | 2749 yahoo_packet_hash_int(pkt, 10, yd->current_status); |
2763 yahoo_packet_hash(pkt, 10, s); | |
2764 | 2750 |
2765 if (yd->current_status == YAHOO_STATUS_CUSTOM) { | 2751 if (yd->current_status == YAHOO_STATUS_CUSTOM) { |
2766 const char *msg = gaim_status_get_attr_string(status, "message"); | 2752 const char *msg = gaim_status_get_attr_string(status, "message"); |
2767 | 2753 |
2768 if (msg == NULL) { | 2754 if (msg == NULL) { |
2770 msg = ""; | 2756 msg = ""; |
2771 } | 2757 } |
2772 | 2758 |
2773 conv_msg = yahoo_string_encode(gc, msg, NULL); | 2759 conv_msg = yahoo_string_encode(gc, msg, NULL); |
2774 conv_msg2 = gaim_markup_strip_html(conv_msg); | 2760 conv_msg2 = gaim_markup_strip_html(conv_msg); |
2775 yahoo_packet_hash(pkt, 19, conv_msg2); | 2761 yahoo_packet_hash_str(pkt, 19, conv_msg2); |
2776 | 2762 |
2777 } else { | 2763 } else { |
2778 yahoo_packet_hash(pkt, 19, ""); | 2764 yahoo_packet_hash_str(pkt, 19, ""); |
2779 } | 2765 } |
2780 | 2766 |
2781 if (gc->is_idle) | 2767 if (gc->is_idle) |
2782 yahoo_packet_hash(pkt, 47, "2"); | 2768 yahoo_packet_hash_str(pkt, 47, "2"); |
2783 else if (!gaim_status_type_is_available(gaim_status_get_type(status))) | 2769 else if (!gaim_status_type_is_available(gaim_status_get_type(status))) |
2784 yahoo_packet_hash(pkt, 47, "1"); | 2770 yahoo_packet_hash_str(pkt, 47, "1"); |
2785 | 2771 |
2786 yahoo_packet_send_and_free(pkt, yd); | 2772 yahoo_packet_send_and_free(pkt, yd); |
2787 | 2773 |
2788 g_free(conv_msg); | 2774 g_free(conv_msg); |
2789 g_free(conv_msg2); | 2775 g_free(conv_msg2); |
2790 | 2776 |
2791 if (old_status == YAHOO_STATUS_INVISIBLE) { | 2777 if (old_status == YAHOO_STATUS_INVISIBLE) { |
2792 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, 0); | 2778 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, 0); |
2793 yahoo_packet_hash(pkt, 13, "1"); | 2779 yahoo_packet_hash_str(pkt, 13, "1"); |
2794 yahoo_packet_send_and_free(pkt, yd); | 2780 yahoo_packet_send_and_free(pkt, yd); |
2795 } | 2781 } |
2796 } | 2782 } |
2797 | 2783 |
2798 static void yahoo_set_idle(GaimConnection *gc, int idle) | 2784 static void yahoo_set_idle(GaimConnection *gc, int idle) |
2799 { | 2785 { |
2800 struct yahoo_data *yd = gc->proto_data; | 2786 struct yahoo_data *yd = gc->proto_data; |
2801 struct yahoo_packet *pkt = NULL; | 2787 struct yahoo_packet *pkt = NULL; |
2802 char *msg = NULL, *msg2 = NULL; | 2788 char *msg = NULL, *msg2 = NULL; |
2803 char buf[4]; | |
2804 | 2789 |
2805 if (idle && yd->current_status == YAHOO_STATUS_AVAILABLE) | 2790 if (idle && yd->current_status == YAHOO_STATUS_AVAILABLE) |
2806 yd->current_status = YAHOO_STATUS_IDLE; | 2791 yd->current_status = YAHOO_STATUS_IDLE; |
2807 else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) | 2792 else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) |
2808 yd->current_status = YAHOO_STATUS_AVAILABLE; | 2793 yd->current_status = YAHOO_STATUS_AVAILABLE; |
2809 | 2794 |
2810 | 2795 |
2811 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); | 2796 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); |
2812 | 2797 |
2813 | 2798 yahoo_packet_hash_int(pkt, 10, yd->current_status); |
2814 g_snprintf(buf, sizeof(buf), "%d", yd->current_status); | |
2815 yahoo_packet_hash(pkt, 10, buf); | |
2816 if (yd->current_status == YAHOO_STATUS_CUSTOM) { | 2799 if (yd->current_status == YAHOO_STATUS_CUSTOM) { |
2817 GaimStatus *status = gaim_presence_get_active_status(gaim_account_get_presence(gaim_connection_get_account(gc))); | 2800 GaimStatus *status = gaim_presence_get_active_status(gaim_account_get_presence(gaim_connection_get_account(gc))); |
2818 msg = yahoo_string_encode(gc, gaim_status_get_attr_string(status, "message"), NULL); //this line crashes, fix it | 2801 msg = yahoo_string_encode(gc, gaim_status_get_attr_string(status, "message"), NULL); //this line crashes, fix it |
2819 msg2 = gaim_unescape_html(msg); | 2802 msg2 = gaim_unescape_html(msg); |
2820 yahoo_packet_hash(pkt, 19, msg2); | 2803 yahoo_packet_hash_str(pkt, 19, msg2); |
2821 } else { | 2804 } else { |
2822 yahoo_packet_hash(pkt, 19, ""); | 2805 yahoo_packet_hash_str(pkt, 19, ""); |
2823 } | 2806 } |
2824 | 2807 |
2825 if (idle) | 2808 if (idle) |
2826 yahoo_packet_hash(pkt, 47, "2"); | 2809 yahoo_packet_hash_str(pkt, 47, "2"); |
2827 else if (!gaim_presence_is_available(gaim_account_get_presence(gaim_connection_get_account(gc)))) | 2810 else if (!gaim_presence_is_available(gaim_account_get_presence(gaim_connection_get_account(gc)))) |
2828 yahoo_packet_hash(pkt, 47, "1"); | 2811 yahoo_packet_hash_str(pkt, 47, "1"); |
2829 | 2812 |
2830 | 2813 |
2831 yahoo_packet_send_and_free(pkt, yd); | 2814 yahoo_packet_send_and_free(pkt, yd); |
2832 | 2815 |
2833 g_free(msg); | 2816 g_free(msg); |
2914 ycht_chat_send_keepalive(yd->ycht); | 2897 ycht_chat_send_keepalive(yd->ycht); |
2915 return; | 2898 return; |
2916 } | 2899 } |
2917 | 2900 |
2918 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, 0); | 2901 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, 0); |
2919 yahoo_packet_hash(pkt, 109, gaim_connection_get_display_name(gc)); | 2902 yahoo_packet_hash_str(pkt, 109, gaim_connection_get_display_name(gc)); |
2920 yahoo_packet_send_and_free(yd, pkt); | 2903 yahoo_packet_send_and_free(pkt, yd); |
2921 } | 2904 } |
2922 | 2905 |
2923 /* XXX - What's the deal with GaimGroup *foo? */ | 2906 /* XXX - What's the deal with GaimGroup *foo? */ |
2924 static void yahoo_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *foo) | 2907 static void yahoo_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *foo) |
2925 { | 2908 { |
2942 group = "Buddies"; | 2925 group = "Buddies"; |
2943 } | 2926 } |
2944 | 2927 |
2945 group2 = yahoo_string_encode(gc, group, NULL); | 2928 group2 = yahoo_string_encode(gc, group, NULL); |
2946 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); | 2929 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); |
2947 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); | 2930 yahoo_packet_hash(pkt, "ssss", 1, gaim_connection_get_display_name(gc), |
2948 yahoo_packet_hash(pkt, 7, buddy->name); | 2931 7, buddy->name, 65, group2, 14, ""); |
2949 yahoo_packet_hash(pkt, 65, group2); | |
2950 yahoo_packet_hash(pkt, 14, ""); | |
2951 yahoo_packet_send_and_free(pkt, yd); | 2932 yahoo_packet_send_and_free(pkt, yd); |
2952 g_free(group2); | 2933 g_free(group2); |
2953 } | 2934 } |
2954 | 2935 |
2955 static void yahoo_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) | 2936 static void yahoo_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) |
2979 if (remove) | 2960 if (remove) |
2980 g_hash_table_remove(yd->friends, buddy->name); | 2961 g_hash_table_remove(yd->friends, buddy->name); |
2981 | 2962 |
2982 cg = yahoo_string_encode(gc, group->name, NULL); | 2963 cg = yahoo_string_encode(gc, group->name, NULL); |
2983 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); | 2964 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); |
2984 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); | 2965 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc), |
2985 yahoo_packet_hash(pkt, 7, buddy->name); | 2966 7, buddy->name, 65, cg); |
2986 yahoo_packet_hash(pkt, 65, cg); | |
2987 yahoo_packet_send_and_free(pkt, yd); | 2967 yahoo_packet_send_and_free(pkt, yd); |
2988 g_free(cg); | 2968 g_free(cg); |
2989 } | 2969 } |
2990 | 2970 |
2991 static void yahoo_add_deny(GaimConnection *gc, const char *who) { | 2971 static void yahoo_add_deny(GaimConnection *gc, const char *who) { |
3001 | 2981 |
3002 if (!who || who[0] == '\0') | 2982 if (!who || who[0] == '\0') |
3003 return; | 2983 return; |
3004 | 2984 |
3005 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0); | 2985 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0); |
3006 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); | 2986 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc), |
3007 yahoo_packet_hash(pkt, 7, who); | 2987 7, who, 13, "1"); |
3008 yahoo_packet_hash(pkt, 13, "1"); | |
3009 yahoo_packet_send_and_free(pkt, yd); | 2988 yahoo_packet_send_and_free(pkt, yd); |
3010 } | 2989 } |
3011 | 2990 |
3012 static void yahoo_rem_deny(GaimConnection *gc, const char *who) { | 2991 static void yahoo_rem_deny(GaimConnection *gc, const char *who) { |
3013 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | 2992 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
3018 | 2997 |
3019 if (!who || who[0] == '\0') | 2998 if (!who || who[0] == '\0') |
3020 return; | 2999 return; |
3021 | 3000 |
3022 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0); | 3001 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0); |
3023 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); | 3002 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc), 7, who, 13, "2"); |
3024 yahoo_packet_hash(pkt, 7, who); | |
3025 yahoo_packet_hash(pkt, 13, "2"); | |
3026 yahoo_packet_send_and_free(pkt, yd); | 3003 yahoo_packet_send_and_free(pkt, yd); |
3027 } | 3004 } |
3028 | 3005 |
3029 static void yahoo_set_permit_deny(GaimConnection *gc) { | 3006 static void yahoo_set_permit_deny(GaimConnection *gc) { |
3030 GaimAccount *acct; | 3007 GaimAccount *acct; |
3088 return; | 3065 return; |
3089 } | 3066 } |
3090 | 3067 |
3091 /* Step 1: Add buddy to new group. */ | 3068 /* Step 1: Add buddy to new group. */ |
3092 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); | 3069 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); |
3093 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); | 3070 yahoo_packet_hash(pkt, "ssss", 1, gaim_connection_get_display_name(gc), |
3094 yahoo_packet_hash(pkt, 7, who); | 3071 7, who, 65, gpn, 14, ""); |
3095 yahoo_packet_hash(pkt, 65, gpn); | |
3096 yahoo_packet_hash(pkt, 14, ""); | |
3097 yahoo_packet_send_and_free(pkt, yd); | 3072 yahoo_packet_send_and_free(pkt, yd); |
3098 | 3073 |
3099 /* Step 2: Remove buddy from old group */ | 3074 /* Step 2: Remove buddy from old group */ |
3100 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); | 3075 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); |
3101 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); | 3076 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc), 7, who, 65, gpo); |
3102 yahoo_packet_hash(pkt, 7, who); | |
3103 yahoo_packet_hash(pkt, 65, gpo); | |
3104 yahoo_packet_send_and_free(pkt, yd); | 3077 yahoo_packet_send_and_free(pkt, yd); |
3105 g_free(gpn); | 3078 g_free(gpn); |
3106 g_free(gpo); | 3079 g_free(gpo); |
3107 } | 3080 } |
3108 | 3081 |
3120 g_free(gpo); | 3093 g_free(gpo); |
3121 return; | 3094 return; |
3122 } | 3095 } |
3123 | 3096 |
3124 pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, 0); | 3097 pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, 0); |
3125 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); | 3098 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc), |
3126 yahoo_packet_hash(pkt, 65, gpo); | 3099 65, gpo, 67, gpn); |
3127 yahoo_packet_hash(pkt, 67, gpn); | |
3128 yahoo_packet_send_and_free(pkt, yd); | 3100 yahoo_packet_send_and_free(pkt, yd); |
3129 g_free(gpn); | 3101 g_free(gpn); |
3130 g_free(gpo); | 3102 g_free(gpo); |
3131 } | 3103 } |
3132 | 3104 |