# HG changeset patch
# Node ID bc142b1a687c
# Parent  739171ebe9fe
diff --git a/ChangeLog.API b/ChangeLog.API
--- a/ChangeLog.API
+++ b/ChangeLog.API
@@ -1144,6 +1144,11 @@
 		* pidgin_dialogs_alias_contact
 		* pidgin_dialogs_destroy_all
 		* pidgin_dialogs_log
+		* pidgin_dialogs_merge_groups
+		* pidgin_dialogs_remove_buddy
+		* pidgin_dialogs_remove_chat
+		* pidgin_dialogs_remove_contact
+		* pidgin_dialogs_remove_group
 		* pidgin_get_dim_grey_string
 		* pidgin_gdk_pixbuf_make_round, use purple_gdk_pixbuf_make_round instead.
 		* pidgin_gdk_pixbuf_is_opaque, use purple_gdk_pixbuf_is_opaque instead.
diff --git a/pidgin/gtkdialogs.h b/pidgin/gtkdialogs.h
--- a/pidgin/gtkdialogs.h
+++ b/pidgin/gtkdialogs.h
@@ -36,11 +36,6 @@
 
 void pidgin_dialogs_alias_buddy(PurpleBuddy *buddy);
 void pidgin_dialogs_alias_chat(PurpleChat *chat);
-void pidgin_dialogs_remove_buddy(PurpleBuddy *buddy);
-void pidgin_dialogs_remove_group(PurpleGroup *group);
-void pidgin_dialogs_remove_chat(PurpleChat *chat);
-void pidgin_dialogs_remove_contact(PurpleMetaContact *contact);
-void pidgin_dialogs_merge_groups(PurpleGroup *group, const char *name);
 
 G_END_DECLS
 
diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c
--- a/pidgin/gtkdialogs.c
+++ b/pidgin/gtkdialogs.c
@@ -41,11 +41,6 @@
 #include "gtkutils.h"
 #include "pidgincore.h"
 
-struct _PidginGroupMergeObject {
-	PurpleGroup* parent;
-	char *new_name;
-};
-
 static void
 pidgin_dialogs_im_cb(G_GNUC_UNUSED gpointer data, PurpleRequestPage *page) {
 	PurpleAccount *account;
@@ -245,213 +240,3 @@
 	g_free(alias);
 }
 
-static void
-pidgin_dialogs_remove_contact_cb(PurpleMetaContact *contact)
-{
-	PurpleBlistNode *bnode, *cnode;
-	PurpleGroup *group;
-
-	cnode = (PurpleBlistNode *)contact;
-	group = (PurpleGroup*)cnode->parent;
-	for (bnode = cnode->child; bnode; bnode = bnode->next) {
-		PurpleBuddy *buddy = (PurpleBuddy*)bnode;
-		if (purple_account_is_connected(purple_buddy_get_account(buddy)))
-			purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group);
-	}
-	purple_blist_remove_contact(contact);
-}
-
-void
-pidgin_dialogs_remove_contact(PurpleMetaContact *contact)
-{
-	PurpleBuddy *buddy = purple_meta_contact_get_priority_buddy(contact);
-
-	g_return_if_fail(contact != NULL);
-	g_return_if_fail(buddy != NULL);
-
-	if (PURPLE_BLIST_NODE(contact)->child == PURPLE_BLIST_NODE(buddy) &&
-	    PURPLE_BLIST_NODE(buddy)->next == NULL) {
-		pidgin_dialogs_remove_buddy(buddy);
-	} else {
-		gchar *text;
-		int contact_size = purple_counting_node_get_total_size(PURPLE_COUNTING_NODE(contact));
-		text = g_strdup_printf(
-					ngettext(
-						"You are about to remove the contact containing %s "
-						"and %d other buddy from your buddy list.  Do you "
-						"want to continue?",
-						"You are about to remove the contact containing %s "
-						"and %d other buddies from your buddy list.  Do you "
-						"want to continue?", contact_size - 1),
-					purple_buddy_get_name(buddy), contact_size - 1);
-
-		purple_request_action(contact, NULL, _("Remove Contact"), text, 0,
-				NULL,
-				contact, 2,
-				_("_Remove Contact"), G_CALLBACK(pidgin_dialogs_remove_contact_cb),
-				_("Cancel"),
-				NULL);
-
-		g_free(text);
-	}
-}
-
-static void free_ggmo(struct _PidginGroupMergeObject *ggp)
-{
-	g_free(ggp->new_name);
-	g_free(ggp);
-}
-
-static void
-pidgin_dialogs_merge_groups_cb(struct _PidginGroupMergeObject *GGP)
-{
-	purple_group_set_name(GGP->parent, GGP->new_name);
-	free_ggmo(GGP);
-}
-
-void
-pidgin_dialogs_merge_groups(PurpleGroup *source, const char *new_name)
-{
-	gchar *text;
-	struct _PidginGroupMergeObject *ggp;
-
-	g_return_if_fail(source != NULL);
-	g_return_if_fail(new_name != NULL);
-
-	text = g_strdup_printf(
-				_("You are about to merge the group called %s into the group "
-				"called %s. Do you want to continue?"), purple_group_get_name(source), new_name);
-
-	ggp = g_new(struct _PidginGroupMergeObject, 1);
-	ggp->parent = source;
-	ggp->new_name = g_strdup(new_name);
-
-	purple_request_action(source, NULL, _("Merge Groups"), text, 0,
-			NULL,
-			ggp, 2,
-			_("_Merge Groups"), G_CALLBACK(pidgin_dialogs_merge_groups_cb),
-			_("Cancel"), G_CALLBACK(free_ggmo));
-
-	g_free(text);
-}
-
-static void
-pidgin_dialogs_remove_group_cb(PurpleGroup *group)
-{
-	PurpleBlistNode *cnode, *bnode;
-
-	cnode = ((PurpleBlistNode*)group)->child;
-
-	while (cnode) {
-		if (PURPLE_IS_META_CONTACT(cnode)) {
-			bnode = cnode->child;
-			cnode = cnode->next;
-			while (bnode) {
-				PurpleBuddy *buddy;
-				if (PURPLE_IS_BUDDY(bnode)) {
-					buddy = (PurpleBuddy*)bnode;
-					bnode = bnode->next;
-					if (purple_account_is_connected(purple_buddy_get_account(buddy))) {
-						purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group);
-						purple_blist_remove_buddy(buddy);
-					}
-				} else {
-					bnode = bnode->next;
-				}
-			}
-		} else if (PURPLE_IS_CHAT(cnode)) {
-			PurpleChat *chat = (PurpleChat *)cnode;
-			cnode = cnode->next;
-			if (purple_account_is_connected(purple_chat_get_account(chat)))
-				purple_blist_remove_chat(chat);
-		} else {
-			cnode = cnode->next;
-		}
-	}
-
-	purple_blist_remove_group(group);
-}
-
-void
-pidgin_dialogs_remove_group(PurpleGroup *group)
-{
-	gchar *text;
-
-	g_return_if_fail(group != NULL);
-
-	text = g_strdup_printf(_("You are about to remove the group %s and all its members from your buddy list.  Do you want to continue?"),
-						   purple_group_get_name(group));
-
-	purple_request_action(group, NULL, _("Remove Group"), text, 0,
-						NULL,
-						group, 2,
-						_("_Remove Group"), G_CALLBACK(pidgin_dialogs_remove_group_cb),
-						_("Cancel"), NULL);
-
-	g_free(text);
-}
-
-/* XXX - Some of this should be moved into the core, methinks. */
-static void
-pidgin_dialogs_remove_buddy_cb(PurpleBuddy *buddy)
-{
-	PurpleGroup *group;
-	gchar *name;
-	PurpleAccount *account;
-
-	group = purple_buddy_get_group(buddy);
-	name = g_strdup(purple_buddy_get_name(buddy)); /* purple_buddy_get_name() is a crasher after remove_buddy */
-	account = purple_buddy_get_account(buddy);
-
-	purple_debug_info("blist", "Removing '%s' from buddy list.\n", purple_buddy_get_name(buddy));
-	/* TODO - Should remove from blist first... then call purple_account_remove_buddy()? */
-	purple_account_remove_buddy(account, buddy, group);
-	purple_blist_remove_buddy(buddy);
-
-	g_free(name);
-}
-
-void
-pidgin_dialogs_remove_buddy(PurpleBuddy *buddy)
-{
-	gchar *text;
-
-	g_return_if_fail(buddy != NULL);
-
-	text = g_strdup_printf(_("You are about to remove %s from your buddy list.  Do you want to continue?"),
-						   purple_buddy_get_name(buddy));
-
-	purple_request_action(buddy, NULL, _("Remove Buddy"), text, 0,
-		purple_request_cpar_from_account(
-			purple_buddy_get_account(buddy)),
-		buddy, 2, _("_Remove Buddy"),
-		G_CALLBACK(pidgin_dialogs_remove_buddy_cb), _("Cancel"), NULL);
-
-	g_free(text);
-}
-
-static void
-pidgin_dialogs_remove_chat_cb(PurpleChat *chat)
-{
-	purple_blist_remove_chat(chat);
-}
-
-void
-pidgin_dialogs_remove_chat(PurpleChat *chat)
-{
-	const gchar *name;
-	gchar *text;
-
-	g_return_if_fail(chat != NULL);
-
-	name = purple_chat_get_name(chat);
-	text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list.  Do you want to continue?"),
-			name ? name : "");
-
-	purple_request_action(chat, NULL, _("Remove Chat"), text, 0,
-		purple_request_cpar_from_account(purple_chat_get_account(chat)),
-		chat, 2, _("_Remove Chat"),
-		G_CALLBACK(pidgin_dialogs_remove_chat_cb), _("Cancel"), NULL);
-
-	g_free(text);
-}
