# HG changeset patch # User Luke Schierer # Date 1063015719 0 # Node ID 3d84c933b939ad84109af010568ea29e54908922 # Parent 62aec9fd7aca3f039a9a53c78e7304b461959431 [gaim-migrate @ 7332] Tim Ringenbach (marv_sf) writes: " This makes two things work (on the server side list): 1) Moving buddies between groups. 2) Renaming groups. It doesn't, however, fix the case where Gaim disagrees with the server as to what group a buddy is in. But that doesn't make anything bad happen really, so I'll save it for another patch. And moving the buddy seems get the server and gaim in sync again." committer: Tailor Script diff -r 62aec9fd7aca -r 3d84c933b939 src/protocols/yahoo/yahoo.c --- a/src/protocols/yahoo/yahoo.c Mon Sep 08 10:07:14 2003 +0000 +++ b/src/protocols/yahoo/yahoo.c Mon Sep 08 10:08:39 2003 +0000 @@ -1980,6 +1980,50 @@ grab_url(url, FALSE, yahoo_got_info, NULL, NULL, 0); } +static void yahoo_change_buddys_group(GaimConnection *gc, const char *who, + const char *old_group, const char *new_group) +{ + struct yahoo_data *yd = gc->proto_data; + struct yahoo_packet *pkt; + + /* Step 0: If they aren't on the server list anyway, + * don't bother letting the server know. + */ + if (!g_hash_table_lookup(yd->friends, who)) + return; + + /* Step 1: Add buddy to new group. */ + pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); + yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); + yahoo_packet_hash(pkt, 7, who); + yahoo_packet_hash(pkt, 65, new_group); + yahoo_packet_hash(pkt, 14, ""); + yahoo_send_packet(yd, pkt); + yahoo_packet_free(pkt); + + /* Step 2: Remove buddy from old group */ + pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); + yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); + yahoo_packet_hash(pkt, 7, who); + yahoo_packet_hash(pkt, 65, old_group); + yahoo_send_packet(yd, pkt); + yahoo_packet_free(pkt); +} + +static void yahoo_rename_group(GaimConnection *gc, const char *old_group, + const char *new_group, GList *whocares) +{ + struct yahoo_data *yd = gc->proto_data; + struct yahoo_packet *pkt; + + pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, 0); + yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); + yahoo_packet_hash(pkt, 65, old_group); + yahoo_packet_hash(pkt, 67, new_group); + yahoo_send_packet(yd, pkt); + yahoo_packet_free(pkt); +} + static GaimPlugin *my_protocol = NULL; static GaimPluginProtocolInfo prpl_info = @@ -2029,8 +2073,8 @@ NULL, /* get_cb_info */ NULL, /* get_cb_away */ NULL, /* alias_buddy */ - NULL, /* change group */ - NULL, /* rename group */ + yahoo_change_buddys_group, + yahoo_rename_group, NULL, /* buddy_free */ NULL, /* convo_closed */ NULL, /* normalize */