changeset 6793:3d84c933b939

[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 <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 08 Sep 2003 10:08:39 +0000
parents 62aec9fd7aca
children ab5dd35443c6
files src/protocols/yahoo/yahoo.c
diffstat 1 files changed, 46 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 */