pidgin: 1c1326bc: Allow the "Bonjour" group to be renamed ...

datallah at pidgin.im datallah at pidgin.im
Tue Jan 5 23:11:13 EST 2010


-----------------------------------------------------------------
Revision: 1c1326bc2628aa5c508921feefdcec859b580762
Ancestor: 42bd9f777ebde69580166733bdb898c243144b0c
Author: datallah at pidgin.im
Date: 2010-01-06T04:04:43
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1c1326bc2628aa5c508921feefdcec859b580762

Modified files:
        libpurple/protocols/bonjour/bonjour.c

ChangeLog: 

Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052

-------------- next part --------------
============================================================
--- libpurple/protocols/bonjour/bonjour.c	24ba754cb01e26e4a0bcd0cbc9d4407c4b0b6b77
+++ libpurple/protocols/bonjour/bonjour.c	33c9cc7e63bd1d79c6ad2b2dfda819082d9301ed
@@ -392,11 +392,8 @@ bonjour_tooltip_text(PurpleBuddy *buddy,
 		purple_notify_user_info_add_pair(user_info, _("XMPP Account"), bb->jid);
 }
 
-static void
-bonjour_group_buddy(PurpleConnection *connection, const char *who, const char *old_group, const char *new_group)
-{
+static void bonjour_do_group_change(PurpleBuddy *buddy, const char *new_group) {
 	PurpleBlistNodeFlags oldflags;
-	PurpleBuddy *buddy = purple_find_buddy(connection->account, who);
 
 	if (buddy == NULL)
 		return;
@@ -404,13 +401,38 @@ bonjour_group_buddy(PurpleConnection *co
 	oldflags = purple_blist_node_get_flags((PurpleBlistNode *)buddy);
 
 	/* If we're moving them out of the bonjour group, make them persistent */
-	if (strcmp(new_group, BONJOUR_GROUP_NAME) == 0)
+	if (purple_strequal(new_group, BONJOUR_GROUP_NAME))
 		purple_blist_node_set_flags((PurpleBlistNode *)buddy, oldflags | PURPLE_BLIST_NODE_FLAG_NO_SAVE);
 	else
 		purple_blist_node_set_flags((PurpleBlistNode *)buddy, oldflags ^ PURPLE_BLIST_NODE_FLAG_NO_SAVE);
 
 }
 
+static void
+bonjour_group_buddy(PurpleConnection *connection, const char *who, const char *old_group, const char *new_group)
+{
+	PurpleBuddy *buddy = purple_find_buddy(connection->account, who);
+
+	bonjour_do_group_change(buddy, new_group);
+
+}
+
+static void
+bonjour_rename_group(PurpleConnection *connection, const char *old_name, PurpleGroup *group, GList *moved_buddies)
+{
+	GList *cur;
+	const char *new_group;
+	PurpleBuddy *buddy;
+
+	new_group = purple_group_get_name(group);
+
+	for (cur = moved_buddies; cur; cur = cur->next) {
+		buddy = cur->data;
+		bonjour_do_group_change(buddy, new_group);
+	}
+
+}
+
 static gboolean
 bonjour_can_receive_file(PurpleConnection *connection, const char *who)
 {
@@ -478,7 +500,7 @@ static PurplePluginProtocolInfo prpl_inf
 	NULL,                                                    /* get_cb_away */
 	NULL,                                                    /* alias_buddy */
 	bonjour_group_buddy,                                     /* group_buddy */
-	NULL,                                                    /* rename_group */
+	bonjour_rename_group,                                    /* rename_group */
 	NULL,                                                    /* buddy_free */
 	bonjour_convo_closed,                                    /* convo_closed */
 	NULL,                                                    /* normalize */


More information about the Commits mailing list