changeset 9730:c9ac1976ef01

[gaim-migrate @ 10591] I shuffled lots of stuff around again. See plugins/ChangeLog.API for the list of renamed functions. I'm trying to clean up gtkdialogs.c/.h, so I moved the away stuff into away.c/.h I also reduced the minimum buddy list height from 200 pixels to 100 pixels. I just realized that that's also the default height used when you don't have a prefs.xml, which is bad. I think I'm going to set the default height to around 300 pixels. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 09 Aug 2004 03:49:46 +0000
parents f44ae9331afc
children 3419488d6d93
files plugins/ChangeLog.API plugins/docklet/docklet.c plugins/gaim-remote/remote.c src/away.c src/away.h src/gtkblist.c src/gtkconn.c src/gtkconv.c src/gtkdialogs.c src/gtkdialogs.h src/gtkimhtmltoolbar.c src/gtknotify.c src/gtkprefs.c src/gtkrequest.c src/idle.c src/protocols/oscar/oscar.c src/server.c src/sound.c src/status.c
diffstat 19 files changed, 611 insertions(+), 626 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/ChangeLog.API	Sun Aug 08 19:01:42 2004 +0000
+++ b/plugins/ChangeLog.API	Mon Aug 09 03:49:46 2004 +0000
@@ -9,6 +9,14 @@
 	* Renamed show_warn_dialog to gaim_gtkdialogs_warn
 	* Renamed show_im_dialog to gaim_gtkdialogs_im
 	* Renamed gaim_gtkdialogs_new_im to gaim_gtkdialogs_im_with_user
+	* Renamed destroy_all_dialogs to gaim_gtkdialogs_destroy_all
+	* Renamed alias_dialog_bud to gaim_gtkdialogs_alias_buddy
+	* Renamed alias_dialog_contact to gaim_gtkdialogs_alias_contact
+	* Renamed alias_dialog_blist_chat to gaim_gtkdialogs_alias_chat
+	* Renamed show_confirm_del to gaim_gtkdialogs_remove_buddy
+	* Renamed show_confirm_del_group to gaim_gtkdialogs_remove_group
+	* Renamed show_confirm_del_blist_chat to gaim_gtkdialogs_remove_chat
+	* Renamed show_confirm_del_contact to gaim_gtkdialogs_remove_contact
 
 version 0.81 (08/05/2004):
 	Commands API:
--- a/plugins/docklet/docklet.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/plugins/docklet/docklet.c	Mon Aug 09 03:49:46 2004 +0000
@@ -38,6 +38,7 @@
 #include "signals.h"
 #include "sound.h"
 
+#include "away.h"
 #include "gtkaccount.h"
 #include "gtkblist.h"
 #include "gtkft.h"
--- a/plugins/gaim-remote/remote.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/plugins/gaim-remote/remote.c	Mon Aug 09 03:49:46 2004 +0000
@@ -38,8 +38,8 @@
 #include "notify.h"
 
 /* XXX */
+#include "away.h"
 #include "gtkconv.h"
-#include "gtkdialogs.h"
 #include "gtkplugin.h"
 #include "gaim.h"
 #include "prefs.h"
--- a/src/away.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/away.c	Mon Aug 09 03:49:46 2004 +0000
@@ -21,9 +21,11 @@
  *
  */
 #include "internal.h"
+#include "gtkinternal.h"
 
 #include "conversation.h"
 #include "debug.h"
+#include "notify.h"
 #include "plugin.h"
 #include "prefs.h"
 #include "prpl.h"
@@ -32,11 +34,12 @@
 #include "request.h"
 
 /* XXX CORE/UI: Until we can get rid of the message queue stuff... */
+#include "away.h"
 #include "gaim.h"
-#include "gtkinternal.h"
 #include "gtkblist.h"
 #include "gtkdialogs.h"
 #include "gtkimhtml.h"
+#include "gtkimhtmltoolbar.h"
 #include "gtkprefs.h"
 #include "gtkutils.h"
 
@@ -668,3 +671,242 @@
 		gtk_widget_show(prefs_away_menu);
 	}
 }
+
+/*------------------------------------------------------------------------*/
+/*  The dialog for new away messages (from dialogs.c)                     */
+/*------------------------------------------------------------------------*/
+struct create_away {
+	GtkWidget *window;
+	GtkWidget *toolbar;
+	GtkWidget *entry;
+	GtkWidget *text;
+	struct away_message *mess;
+};
+
+static void
+away_mess_destroy(GtkWidget *widget, struct create_away *ca)
+{
+	gtk_widget_destroy(ca->window);
+	g_free(ca);
+}
+
+static void
+away_mess_destroy_ca(GtkWidget *widget, GdkEvent *event, struct create_away *ca)
+{
+	away_mess_destroy(NULL, ca);
+}
+
+static gint
+sort_awaymsg_list(gconstpointer a, gconstpointer b)
+{
+	struct away_message *msg_a;
+	struct away_message *msg_b;
+
+	msg_a = (struct away_message *)a;
+	msg_b = (struct away_message *)b;
+
+	return (strcmp(msg_a->name, msg_b->name));
+}
+
+static struct
+away_message *save_away_message(struct create_away *ca)
+{
+	struct away_message *am;
+	gchar *away_message;
+
+	if (!ca->mess)
+		am = g_new0(struct away_message, 1);
+	else {
+		am = ca->mess;
+	}
+
+	g_snprintf(am->name, sizeof(am->name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry)));
+	away_message = gtk_imhtml_get_markup(GTK_IMHTML(ca->text));
+
+	g_snprintf(am->message, sizeof(am->message), "%s", away_message);
+	g_free(away_message);
+
+	if (!ca->mess)
+		away_messages = g_slist_insert_sorted(away_messages, am, sort_awaymsg_list);
+
+	do_away_menu(NULL);
+	gaim_status_sync();
+
+	return am;
+}
+
+int
+check_away_mess(struct create_away *ca, int type)
+{
+	gchar *msg;
+	if ((strlen(gtk_entry_get_text(GTK_ENTRY(ca->entry))) == 0) && (type == 1)) {
+		/* We shouldn't allow a blank title */
+		gaim_notify_error(NULL, NULL,
+						  _("You cannot save an away message with a "
+							"blank title"),
+						  _("Please give the message a title, or choose "
+							"\"Use\" to use without saving."));
+		return 0;
+	}
+
+	msg = gtk_imhtml_get_text(GTK_IMHTML(ca->text), NULL, NULL);
+
+	if ((type <= 1) && ((msg == NULL) || (*msg == '\0'))) {
+		/* We shouldn't allow a blank message */
+		gaim_notify_error(NULL, NULL,
+						  _("You cannot create an empty away message"), NULL);
+		return 0;
+	}
+
+	g_free(msg);
+
+	return 1;
+}
+
+void
+save_away_mess(GtkWidget *widget, struct create_away *ca)
+{
+	if (!check_away_mess(ca, 1))
+		return;
+
+	save_away_message(ca);
+
+	away_mess_destroy(NULL, ca);
+}
+
+void
+use_away_mess(GtkWidget *widget, struct create_away *ca)
+{
+	static struct away_message am;
+	gchar *away_message;
+
+	if (!check_away_mess(ca, 0))
+		return;
+
+	g_snprintf(am.name, sizeof(am.name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry)));
+	away_message = gtk_imhtml_get_markup(GTK_IMHTML(ca->text));
+
+	g_snprintf(am.message, sizeof(am.message), "%s", away_message);
+	g_free(away_message);
+
+	do_away_message(NULL, &am);
+
+	away_mess_destroy(NULL, ca);
+}
+
+void
+su_away_mess(GtkWidget *widget, struct create_away *ca)
+{
+	if (!check_away_mess(ca, 1))
+		return;
+
+	do_away_message(NULL, save_away_message(ca));
+
+	away_mess_destroy(NULL, ca);
+}
+
+void
+create_away_mess(GtkWidget *widget, void *dummy)
+{
+	GtkWidget *vbox, *hbox;
+	GtkWidget *label;
+	GtkWidget *sw;
+	GtkWidget *button;
+	GList *focus_chain = NULL;
+	struct create_away *ca = g_new0(struct create_away, 1);
+
+	/* Set up window */
+	GAIM_DIALOG(ca->window);
+	gtk_widget_set_size_request(ca->window, -1, 250);
+	gtk_window_set_role(GTK_WINDOW(ca->window), "away_mess");
+	gtk_window_set_title(GTK_WINDOW(ca->window), _("New away message"));
+	g_signal_connect(G_OBJECT(ca->window), "delete_event",
+			   G_CALLBACK(away_mess_destroy_ca), ca);
+
+	hbox = gtk_hbox_new(FALSE, 12);
+	gtk_container_set_border_width(GTK_CONTAINER(hbox), 12);
+	gtk_container_add(GTK_CONTAINER(ca->window), hbox);
+
+	vbox = gtk_vbox_new(FALSE, 12);
+	gtk_container_add(GTK_CONTAINER(hbox), vbox);
+
+	/* Away message title */
+	hbox = gtk_hbox_new(FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+
+	label = gtk_label_new(_("Away title: "));
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+	ca->entry = gtk_entry_new();
+	gtk_box_pack_start(GTK_BOX(hbox), ca->entry, TRUE, TRUE, 0);
+	gaim_set_accessible_label (ca->entry, label);
+	focus_chain = g_list_append(focus_chain, hbox);
+
+	/* Toolbar */
+	ca->toolbar = gtk_imhtmltoolbar_new();
+	gtk_box_pack_start(GTK_BOX(vbox), ca->toolbar, FALSE, FALSE, 0);
+
+	/* Away message text */
+	sw = gtk_scrolled_window_new(NULL, NULL);
+	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
+								   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
+	gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
+
+	ca->text = gtk_imhtml_new(NULL, NULL);
+	gtk_imhtml_set_editable(GTK_IMHTML(ca->text), TRUE);
+	gtk_imhtml_set_format_functions(GTK_IMHTML(ca->text), GTK_IMHTML_ALL ^ GTK_IMHTML_IMAGE);
+	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(ca->text), GTK_WRAP_WORD_CHAR);
+
+	gtk_imhtml_smiley_shortcuts(GTK_IMHTML(ca->text),
+			gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts"));
+	gtk_imhtml_html_shortcuts(GTK_IMHTML(ca->text),
+			gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts"));
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck"))
+		gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(ca->text));
+	gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(ca->toolbar), ca->text);
+	gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(ca->toolbar), "default");
+	gaim_setup_imhtml(ca->text);
+
+	gtk_container_add(GTK_CONTAINER(sw), ca->text);
+	focus_chain = g_list_append(focus_chain, sw);
+
+	if (dummy) {
+		struct away_message *amt;
+		GtkTreeIter iter;
+		GtkListStore *ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(dummy)));
+		GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dummy));
+		GValue val = { 0, };
+
+		if (! gtk_tree_selection_get_selected (sel, (GtkTreeModel**)&ls, &iter))
+			return;
+		gtk_tree_model_get_value (GTK_TREE_MODEL(ls), &iter, 1, &val);
+		amt = g_value_get_pointer (&val);
+		gtk_entry_set_text(GTK_ENTRY(ca->entry), amt->name);
+		gtk_imhtml_append_text_with_images(GTK_IMHTML(ca->text), amt->message, 0, NULL);
+		ca->mess = amt;
+	}
+
+	hbox = gtk_hbox_new(FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+
+	button = gaim_pixbuf_button_from_stock(_("_Save"), GTK_STOCK_SAVE, GAIM_BUTTON_HORIZONTAL);
+	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(save_away_mess), ca);
+	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+
+	button = gaim_pixbuf_button_from_stock(_("Sa_ve & Use"), GTK_STOCK_OK, GAIM_BUTTON_HORIZONTAL);
+	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(su_away_mess), ca);
+	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+
+	button = gaim_pixbuf_button_from_stock(_("_Use"), GTK_STOCK_EXECUTE, GAIM_BUTTON_HORIZONTAL);
+	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(use_away_mess), ca);
+	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+
+	button = gaim_pixbuf_button_from_stock(_("_Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL);
+	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(away_mess_destroy), ca);
+	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+	focus_chain = g_list_prepend(focus_chain, hbox);
+
+	gtk_widget_show_all(ca->window);
+	gtk_container_set_focus_chain(GTK_CONTAINER(vbox), focus_chain);
+}
--- a/src/away.h	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/away.h	Mon Aug 09 03:49:46 2004 +0000
@@ -25,12 +25,29 @@
 #ifndef _GAIM_AWAY_H_
 #define _GAIM_AWAY_H_
 
-#define GtkWidget int
+#include "gtkinternal.h"
 
-int this_file;
+/* XXX CUI: away messages aren't really anything more than char* but we need two char*'s
+ * for the UI so that people can name their away messages when they save them. So these
+ * are really a UI function and struct away_message should be removed from the core. */
+/* WTF?  How does having a title for something mean that it is part of the UI? */
+struct away_message {
+	char name[80];
+	char message[2048];
+};
 
-#define A_BIG_HACK this_file;
+extern GSList *away_messages;
+extern struct away_message *awaymessage;
+extern GtkWidget *awaymenu;
+extern GtkWidget *awayqueue;
+extern GtkListStore *awayqueuestore;
 
+extern void rem_away_mess(GtkWidget *, struct away_message *);
+extern void do_away_message(GtkWidget *, struct away_message *);
+extern void do_away_menu();
+extern void toggle_away_queue();
+extern void purge_away_queue(GSList **);
 extern void do_im_back(GtkWidget *, GtkWidget *);
+void create_away_mess(GtkWidget *, void *);
 
 #endif /* _GAIM_AWAY_H_ */
--- a/src/gtkblist.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/gtkblist.c	Mon Aug 09 03:49:46 2004 +0000
@@ -36,6 +36,7 @@
 #include "stock.h"
 #include "util.h"
 
+#include "away.h"
 #include "gtkaccount.h"
 #include "gtkblist.h"
 #include "gtkconv.h"
@@ -533,11 +534,11 @@
 static void gtk_blist_menu_alias_cb(GtkWidget *w, GaimBlistNode *node)
 {
 	if(GAIM_BLIST_NODE_IS_BUDDY(node))
-		alias_dialog_bud((GaimBuddy*)node);
+		gaim_gtkdialogs_alias_buddy((GaimBuddy*)node);
 	else if(GAIM_BLIST_NODE_IS_CONTACT(node))
-		alias_dialog_contact((GaimContact*)node);
+		gaim_gtkdialogs_alias_contact((GaimContact*)node);
 	else if(GAIM_BLIST_NODE_IS_CHAT(node))
-		alias_dialog_blist_chat((GaimChat*)node);
+		gaim_gtkdialogs_alias_chat((GaimChat*)node);
 }
 
 static void gtk_blist_menu_bp_cb(GtkWidget *w, GaimBuddy *b)
@@ -986,13 +987,13 @@
 gaim_gtk_blist_remove_cb (GtkWidget *w, GaimBlistNode *node)
 {
 	if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
-		show_confirm_del((GaimBuddy*)node);
+		gaim_gtkdialogs_remove_buddy((GaimBuddy*)node);
 	} else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
-		show_confirm_del_blist_chat((GaimChat*)node);
+		gaim_gtkdialogs_remove_chat((GaimChat*)node);
 	} else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
-		show_confirm_del_group((GaimGroup*)node);
+		gaim_gtkdialogs_remove_group((GaimGroup*)node);
 	} else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
-		show_confirm_del_contact((GaimContact*)node);
+		gaim_gtkdialogs_remove_contact((GaimContact*)node);
 	}
 }
 
@@ -3090,7 +3091,7 @@
 			G_TYPE_STRING, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_POINTER);
 
 	gtkblist->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(gtkblist->treemodel));
-	gtk_widget_set_size_request(gtkblist->treeview, -1, 200);
+	gtk_widget_set_size_request(gtkblist->treeview, -1, 100);
 	gtk_widget_set_name(gtkblist->treeview, "gaim_gtkblist_treeview");
 
 	/* Set up selection stuff */
--- a/src/gtkconn.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/gtkconn.c	Mon Aug 09 03:49:46 2004 +0000
@@ -23,13 +23,14 @@
 
 #include "account.h"
 #include "debug.h"
-#include "gtkdialogs.h"
 #include "notify.h"
 #include "prefs.h"
 #include "stock.h"
 #include "util.h"
 
+#include "away.h"
 #include "gtkblist.h"
+#include "gtkdialogs.h"
 #include "gtkutils.h"
 
 /*
@@ -77,7 +78,7 @@
 		kill_meter(meter, _("Done."));
 
 		if (gaim_connections_get_all() == NULL) {
-			destroy_all_dialogs();
+			gaim_gtkdialogs_destroy_all();
 
 			gaim_blist_destroy();
 
@@ -261,7 +262,7 @@
 	if (gaim_connections_get_all() != NULL)
 		return;
 
-	destroy_all_dialogs();
+	gaim_gtkdialogs_destroy_all();
 
 	gaim_blist_destroy();
 
--- a/src/gtkconv.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/gtkconv.c	Mon Aug 09 03:49:46 2004 +0000
@@ -525,7 +525,7 @@
 
 		b = gaim_find_buddy(account, name);
 		if (b != NULL)
-			show_confirm_del(b);
+			gaim_gtkdialogs_remove_buddy(b);
 		else if (account != NULL && gaim_account_is_connected(account))
 			gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL);
 	} else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) {
@@ -533,7 +533,7 @@
 
 		c = gaim_blist_find_chat(account, name);
 		if (c != NULL)
-			show_confirm_del_blist_chat(c);
+			gaim_gtkdialogs_remove_chat(c);
 		else if (account != NULL && gaim_account_is_connected(account))
 			gaim_blist_request_add_chat(account, NULL, NULL);
 	}
@@ -998,13 +998,13 @@
 
 		b = gaim_find_buddy(account, name);
 		if (b != NULL)
-			alias_dialog_bud(b);
+			gaim_gtkdialogs_alias_buddy(b);
 	} else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) {
 		GaimChat *c;
 
 		c = gaim_blist_find_chat(account, name);
 		if (c != NULL)
-			alias_dialog_blist_chat(c);
+			gaim_gtkdialogs_alias_chat(c);
 	}
 }
 
@@ -1302,7 +1302,7 @@
 	b       = gaim_find_buddy(account, name);
 
 	if (b != NULL)
-		show_confirm_del(b);
+		gaim_gtkdialogs_remove_buddy(b);
 	else if (account != NULL && gaim_account_is_connected(account))
 		gaim_blist_request_add_buddy(account, name, NULL, NULL);
 
--- a/src/gtkdialogs.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/gtkdialogs.c	Mon Aug 09 03:49:46 2004 +0000
@@ -29,6 +29,7 @@
 #include "status.h"
 #include "util.h"
 
+#include "away.h"
 #include "gtkdialogs.h"
 #include "gtkimhtml.h"
 #include "gtkimhtmltoolbar.h"
@@ -41,23 +42,6 @@
 
 static GList *dialogwindows = NULL;
 
-struct confirm_del {
-	GtkWidget *window;
-	GtkWidget *label;
-	GtkWidget *ok;
-	GtkWidget *cancel;
-	char name[1024];
-	GaimConnection *gc;
-};
-
-struct create_away {
-	GtkWidget *window;
-	GtkWidget *toolbar;
-	GtkWidget *entry;
-	GtkWidget *text;
-	struct away_message *mess;
-};
-
 struct warning {
 	GtkWidget *window;
 	GtkWidget *anon;
@@ -65,41 +49,12 @@
 	GaimConnection *gc;
 };
 
-struct getuserinfo {
-	GtkWidget *window;
-	GtkWidget *entry;
-	GtkWidget *account;
-	GaimConnection *gc;
-};
-
-struct view_log {
-	long offset;
-	int options;
-	char *name;
-	GtkWidget *bbox;
-	GtkWidget *window;
-	GtkWidget *layout;
-	void *clear_handle;
-};
-
-/* Wrapper to get all the text from a GtkTextView */
-gchar* gtk_text_view_get_text(GtkTextView *text, gboolean include_hidden_chars)
-{
-	GtkTextBuffer *buffer;
-	GtkTextIter start, end;
-
-	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
-	gtk_text_buffer_get_start_iter(buffer, &start);
-	gtk_text_buffer_get_end_iter(buffer, &end);
-
-	return gtk_text_buffer_get_text(buffer, &start, &end, include_hidden_chars);
-}
-
 /*------------------------------------------------------------------------*/
 /*  Destroys                                                              */
 /*------------------------------------------------------------------------*/
 
-static void destroy_dialog(GtkWidget *w, GtkWidget *w2)
+static void
+destroy_dialog(GtkWidget *w, GtkWidget *w2)
 {
 	GtkWidget *dest;
 
@@ -112,242 +67,85 @@
 	gtk_widget_destroy(dest);
 }
 
-void destroy_all_dialogs()
+void
+gaim_gtkdialogs_destroy_all()
 {
 	while (dialogwindows)
 		destroy_dialog(NULL, dialogwindows->data);
 
+	/* STATUS */
 	if (awaymessage)
 		do_im_back(NULL, NULL);
 }
 
-static void do_warn(GtkWidget *widget, gint resp, struct warning *w)
-{
-	if (resp == GTK_RESPONSE_OK)
-		serv_warn(w->gc, w->who, (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->anon))) ? 1 : 0);
-
-	destroy_dialog(NULL, w->window);
-	g_free(w->who);
-	g_free(w);
-}
-
-void gaim_gtkdialogs_warn(GaimConnection *gc, const char *who)
+static void
+gaim_gtkdialogs_im_cb(gpointer data, GaimRequestFields *fields)
 {
-	char *labeltext;
-	GtkWidget *hbox, *vbox;
-	GtkWidget *label;
-	GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
-	GaimConversation *c = gaim_find_conversation_with_account(who, gc->account);
-
-	struct warning *w = g_new0(struct warning, 1);
-	w->who = g_strdup(who);
-	w->gc = gc;
-
-	gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
-
-	w->window = gtk_dialog_new_with_buttons(_("Warn User"),
-			GTK_WINDOW(GAIM_GTK_WINDOW(c->window)->window), 0,
-			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-			GAIM_STOCK_WARN, GTK_RESPONSE_OK, NULL);
-	gtk_dialog_set_default_response (GTK_DIALOG(w->window), GTK_RESPONSE_OK);
-	g_signal_connect(G_OBJECT(w->window), "response", G_CALLBACK(do_warn), w);
-
-	gtk_container_set_border_width (GTK_CONTAINER(w->window), 6);
-	gtk_window_set_resizable(GTK_WINDOW(w->window), FALSE);
-	gtk_dialog_set_has_separator(GTK_DIALOG(w->window), FALSE);
-	gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(w->window)->vbox), 12);
-	gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), 6);
-
-	hbox = gtk_hbox_new(FALSE, 12);
-	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), hbox);
-	gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
+	GaimAccount *account;
+	const char *username;
 
-	vbox = gtk_vbox_new(FALSE, 0);
-	gtk_container_add(GTK_CONTAINER(hbox), vbox);
-	labeltext = g_strdup_printf(_("<span weight=\"bold\" size=\"larger\">Warn %s?</span>\n\n"
-				      "This will increase %s's warning level and he or she will be subject to harsher rate limiting.\n"), who, who);
-	label = gtk_label_new(NULL);
-	gtk_label_set_markup(GTK_LABEL(label), labeltext);
-	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
-	gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
-	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
-	g_free(labeltext);
-
-	w->anon = gtk_check_button_new_with_mnemonic(_("Warn _anonymously?"));
-	gtk_box_pack_start(GTK_BOX(vbox), w->anon, FALSE, FALSE, 0);
-
-	hbox = gtk_hbox_new(FALSE, 6);
-	gtk_container_add(GTK_CONTAINER(vbox), hbox);
-	img = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_MENU);
-	gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
-	labeltext = _("<b>Anonymous warnings are less severe.</b>");
-	label = gtk_label_new(NULL);
-	gtk_label_set_markup(GTK_LABEL(label), labeltext);
-	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-
-	dialogwindows = g_list_prepend(dialogwindows, w->window);
-	gtk_widget_show_all(w->window);
-}
+	account  = gaim_request_fields_get_account(fields, "account");
+	username = gaim_request_fields_get_string(fields,  "screenname");
 
-static void
-do_remove_chat(GaimChat *chat)
-{
-	gaim_blist_remove_chat(chat);
-}
-
-static void
-do_remove_buddy(GaimBuddy *buddy)
-{
-	GaimGroup *group;
-	GaimConversation *conv;
-	gchar *name;
-	GaimAccount *account;
-
-	if (!buddy)
-		return;
-
-	group = gaim_find_buddys_group(buddy);
-	name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */
-	account = buddy->account;
-
-	gaim_debug(GAIM_DEBUG_INFO, "blist",
-			   "Removing '%s' from buddy list.\n", buddy->name);
-	/* XXX - Should remove from blist first... then call serv_remove_buddy()? */
-	serv_remove_buddy(buddy->account->gc, buddy, group);
-	gaim_blist_remove_buddy(buddy);
-
-	conv = gaim_find_conversation_with_account(name, account);
-
-	if (conv != NULL)
-		gaim_conversation_update(conv, GAIM_CONV_UPDATE_REMOVE);
-
-	g_free(name);
+	gaim_gtkdialogs_im_with_user(account, username);
 }
 
-static void do_remove_contact(GaimContact *contact)
+void
+gaim_gtkdialogs_im(void)
 {
-	GaimBlistNode *bnode, *cnode;
-	GaimGroup *group;
-
-	if (!contact)
-		return;
+	GaimRequestFields *fields;
+	GaimRequestFieldGroup *group;
+	GaimRequestField *field;
 
-	cnode = (GaimBlistNode *)contact;
-	group = (GaimGroup*)cnode->parent;
-	for (bnode = cnode->child; bnode; bnode = bnode->next) {
-		GaimBuddy *buddy = (GaimBuddy*)bnode;
-		if (gaim_account_is_connected(buddy->account))
-			serv_remove_buddy(buddy->account->gc, buddy, group);
-	}
-	gaim_blist_remove_contact(contact);
-}
+	fields = gaim_request_fields_new();
 
-void do_remove_group(GaimGroup *group)
-{
-	GaimBlistNode *cnode, *bnode;
-
-	cnode = ((GaimBlistNode*)group)->child;
+	group = gaim_request_field_group_new(NULL);
+	gaim_request_fields_add_group(fields, group);
 
-	while (cnode) {
-		if (GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
-			bnode = cnode->child;
-			cnode = cnode->next;
-			while (bnode) {
-				GaimBuddy *buddy;
-				if (GAIM_BLIST_NODE_IS_BUDDY(bnode)) {
-					GaimConversation *conv;
-					buddy = (GaimBuddy*)bnode;
-					bnode = bnode->next;
-					conv = gaim_find_conversation_with_account(buddy->name, buddy->account);
-					if (gaim_account_is_connected(buddy->account)) {
-						serv_remove_buddy(buddy->account->gc, buddy, group);
-						gaim_blist_remove_buddy(buddy);
-						if (conv)
-							gaim_conversation_update(conv,
-									GAIM_CONV_UPDATE_REMOVE);
-					}
-				} else {
-					bnode = bnode->next;
-				}
-			}
-		} else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) {
-			GaimChat *chat = (GaimChat *)cnode;
-			cnode = cnode->next;
-			if (gaim_account_is_connected(chat->account))
-				gaim_blist_remove_chat(chat);
-		} else {
-			cnode = cnode->next;
-		}
-	}
+	field = gaim_request_field_string_new("screenname", _("_Screen name"),
+										  NULL, FALSE);
+	gaim_request_field_set_required(field, TRUE);
+	gaim_request_field_set_type_hint(field, "screenname");
+	gaim_request_field_group_add_field(group, field);
 
-	gaim_blist_remove_group(group);
+	field = gaim_request_field_account_new("account", _("_Account"), NULL);
+	gaim_request_field_set_visible(field,
+		(gaim_connections_get_all() != NULL &&
+		 gaim_connections_get_all()->next != NULL));
+	gaim_request_field_set_required(field, TRUE);
+	gaim_request_field_group_add_field(group, field);
+
+	gaim_request_fields(gaim_get_blist(), _("New Instant Message"),
+						NULL,
+						_("Please enter the screen name of the person you "
+						  "would like to IM."),
+						fields,
+						_("OK"), G_CALLBACK(gaim_gtkdialogs_im_cb),
+						_("Cancel"), NULL,
+						NULL);
 }
 
-void show_confirm_del(GaimBuddy *buddy)
+void
+gaim_gtkdialogs_im_with_user(GaimAccount *account, const char *username)
 {
-	char *text;
+	GaimConversation *conv;
+	GaimConvWindow *win;
+	GaimGtkWindow *gtkwin;
 
-	if (!buddy)
-		return;
-
-	text = g_strdup_printf(_("You are about to remove %s from your buddy list.  Do you want to continue?"), buddy->name);
-
-	gaim_request_action(NULL, NULL, _("Remove Buddy"), text, -1, buddy, 2,
-						_("Remove Buddy"), G_CALLBACK(do_remove_buddy),
-						_("Cancel"), NULL);
+	conv = gaim_find_conversation_with_account(username, account);
 
-	g_free(text);
-}
+	if (conv == NULL)
+		conv = gaim_conversation_new(GAIM_CONV_IM, account, username);
 
-void show_confirm_del_blist_chat(GaimChat *chat)
-{
-	char *name = gaim_chat_get_display_name(chat);
-	char *text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list.  Do you want to continue?"), name);
+	win = gaim_conversation_get_window(conv);
+	gtkwin = GAIM_GTK_WINDOW(win);
 
-	gaim_request_action(NULL, NULL, _("Remove Chat"), text, -1, chat, 2,
-						_("Remove Chat"), G_CALLBACK(do_remove_chat),
-						_("Cancel"), NULL);
-
-	g_free(name);
-	g_free(text);
+	gtk_window_present(GTK_WINDOW(gtkwin->window));
+	gaim_conv_window_switch_conversation(win, gaim_conversation_get_index(conv));
 }
 
-void show_confirm_del_group(GaimGroup *group)
-{
-	char *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?"),
-			       group->name);
-
-	gaim_request_action(NULL, NULL, _("Remove Group"), text, -1, group, 2,
-						_("Remove Group"), G_CALLBACK(do_remove_group),
-						_("Cancel"), NULL);
-
-	g_free(text);
-}
-
-void show_confirm_del_contact(GaimContact *contact)
-{
-	GaimBuddy *buddy = gaim_contact_get_priority_buddy(contact);
-
-	if (!buddy)
-		return;
-
-	if (((GaimBlistNode*)contact)->child == (GaimBlistNode*)buddy &&
-			!((GaimBlistNode*)buddy)->next) {
-		show_confirm_del(buddy);
-	} else {
-		char *text = g_strdup_printf(_("You are about to remove the contact containing %s and %d other buddies from your buddy list.  Do you want to continue?"),
-			       buddy->name, contact->totalsize - 1);
-
-		gaim_request_action(NULL, NULL, _("Remove Contact"), text, -1, contact, 2,
-				_("Remove Contact"), G_CALLBACK(do_remove_contact),
-				_("Cancel"), NULL);
-
-		g_free(text);
-	}
-}
-
-static gboolean show_ee_dialog(const char *ee)
+static gboolean
+gaim_gtkdialogs_ee(const char *ee)
 {
 	GtkWidget *window;
 	GtkWidget *hbox;
@@ -410,74 +208,8 @@
 	return TRUE;
 }
 
-void
-gaim_gtkdialogs_im_with_user(GaimAccount *account, const char *username)
-{
-	GaimConversation *conv;
-	GaimConvWindow *win;
-	GaimGtkWindow *gtkwin;
-
-	conv = gaim_find_conversation_with_account(username, account);
-
-	if (conv == NULL)
-		conv = gaim_conversation_new(GAIM_CONV_IM, account, username);
-
-	win = gaim_conversation_get_window(conv);
-	gtkwin = GAIM_GTK_WINDOW(win);
-
-	gtk_window_present(GTK_WINDOW(gtkwin->window));
-	gaim_conv_window_switch_conversation(win, gaim_conversation_get_index(conv));
-}
-
 static void
-new_im_cb(gpointer data, GaimRequestFields *fields)
-{
-	GaimAccount *account;
-	const char *username;
-
-	account  = gaim_request_fields_get_account(fields, "account");
-	username = gaim_request_fields_get_string(fields,  "screenname");
-
-	gaim_gtkdialogs_im_with_user(account, username);
-}
-
-void
-gaim_gtkdialogs_im(void)
-{
-	GaimRequestFields *fields;
-	GaimRequestFieldGroup *group;
-	GaimRequestField *field;
-
-	fields = gaim_request_fields_new();
-
-	group = gaim_request_field_group_new(NULL);
-	gaim_request_fields_add_group(fields, group);
-
-	field = gaim_request_field_string_new("screenname", _("_Screen name"),
-										  NULL, FALSE);
-	gaim_request_field_set_required(field, TRUE);
-	gaim_request_field_set_type_hint(field, "screenname");
-	gaim_request_field_group_add_field(group, field);
-
-	field = gaim_request_field_account_new("account", _("_Account"), NULL);
-	gaim_request_field_set_visible(field,
-		(gaim_connections_get_all() != NULL &&
-		 gaim_connections_get_all()->next != NULL));
-	gaim_request_field_set_required(field, TRUE);
-	gaim_request_field_group_add_field(group, field);
-
-	gaim_request_fields(gaim_get_blist(), _("New Instant Message"),
-						NULL,
-						_("Please enter the screen name of the person you "
-						  "would like to IM."),
-						fields,
-						_("OK"), G_CALLBACK(new_im_cb),
-						_("Cancel"), NULL,
-						NULL);
-}
-
-static void
-get_info_cb(gpointer data, GaimRequestFields *fields)
+gaim_gtkdialogs_info_cb(gpointer data, GaimRequestFields *fields)
 {
 	char *username;
 	gboolean found = FALSE;
@@ -489,7 +221,7 @@
 		gaim_request_fields_get_string(fields,  "screenname")));
 
 	if (username != NULL && gaim_str_has_suffix(username, "rocksmyworld"))
-		found = show_ee_dialog(username);
+		found = gaim_gtkdialogs_ee(username);
 
 	if (!found && username != NULL && *username != '\0' && account != NULL)
 		serv_get_info(gaim_account_get_connection(account), username);
@@ -527,13 +259,13 @@
 						_("Please enter the screen name of the person whose "
 						  "info you would like to view."),
 						fields,
-						_("OK"), G_CALLBACK(get_info_cb),
+						_("OK"), G_CALLBACK(gaim_gtkdialogs_info_cb),
 						_("Cancel"), NULL,
 						NULL);
 }
 
 static void
-get_log_cb(gpointer data, GaimRequestFields *fields)
+gaim_gtkdialogs_log_cb(gpointer data, GaimRequestFields *fields)
 {
 	char *username;
 	GaimAccount *account;
@@ -580,282 +312,293 @@
 						_("Please enter the screen name of the person whose "
 						  "log you would like to view."),
 						fields,
-						_("OK"), G_CALLBACK(get_log_cb),
+						_("OK"), G_CALLBACK(gaim_gtkdialogs_log_cb),
 						_("Cancel"), NULL,
 						NULL);
 }
 
-/*------------------------------------------------------------------------*/
-/*  The dialog for new away messages                                      */
-/*------------------------------------------------------------------------*/
-
-static void away_mess_destroy(GtkWidget *widget, struct create_away *ca)
-{
-	destroy_dialog(NULL, ca->window);
-	g_free(ca);
-}
-
-static void away_mess_destroy_ca(GtkWidget *widget, GdkEvent *event, struct create_away *ca)
-{
-	away_mess_destroy(NULL, ca);
-}
-
-static gint sort_awaymsg_list(gconstpointer a, gconstpointer b)
+static void
+gaim_gtkdialogs_warn_cb(GtkWidget *widget, gint resp, struct warning *w)
 {
-	struct away_message *msg_a;
-	struct away_message *msg_b;
-
-	msg_a = (struct away_message *)a;
-	msg_b = (struct away_message *)b;
-
-	return (strcmp(msg_a->name, msg_b->name));
-}
-
-static struct away_message *save_away_message(struct create_away *ca)
-{
-	struct away_message *am;
-	gchar *away_message;
-
-	if (!ca->mess)
-		am = g_new0(struct away_message, 1);
-	else {
-		am = ca->mess;
-	}
-
-	g_snprintf(am->name, sizeof(am->name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry)));
-	away_message = gtk_imhtml_get_markup(GTK_IMHTML(ca->text));
-
-	g_snprintf(am->message, sizeof(am->message), "%s", away_message);
-	g_free(away_message);
-
-	if (!ca->mess)
-		away_messages = g_slist_insert_sorted(away_messages, am, sort_awaymsg_list);
-
-	do_away_menu(NULL);
-	gaim_status_sync();
-
-	return am;
-}
+	if (resp == GTK_RESPONSE_OK)
+		serv_warn(w->gc, w->who, (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->anon))) ? 1 : 0);
 
-int check_away_mess(struct create_away *ca, int type)
-{
-	gchar *msg;
-	if ((strlen(gtk_entry_get_text(GTK_ENTRY(ca->entry))) == 0) && (type == 1)) {
-		/* We shouldn't allow a blank title */
-		gaim_notify_error(NULL, NULL,
-						  _("You cannot save an away message with a "
-							"blank title"),
-						  _("Please give the message a title, or choose "
-							"\"Use\" to use without saving."));
-		return 0;
-	}
-
-	msg = gtk_imhtml_get_text(GTK_IMHTML(ca->text), NULL, NULL);
-
-	if ((type <= 1) && ((msg == NULL) || (*msg == '\0'))) {
-		/* We shouldn't allow a blank message */
-		gaim_notify_error(NULL, NULL,
-						  _("You cannot create an empty away message"), NULL);
-		return 0;
-	}
-
-	g_free(msg);
-
-	return 1;
-}
-
-void save_away_mess(GtkWidget *widget, struct create_away *ca)
-{
-	if (!check_away_mess(ca, 1))
-		return;
-
-	save_away_message(ca);
-
-	away_mess_destroy(NULL, ca);
-}
-
-void use_away_mess(GtkWidget *widget, struct create_away *ca)
-{
-	static struct away_message am;
-	gchar *away_message;
-
-	if (!check_away_mess(ca, 0))
-		return;
-
-	g_snprintf(am.name, sizeof(am.name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry)));
-	away_message = gtk_imhtml_get_markup(GTK_IMHTML(ca->text));
-
-	g_snprintf(am.message, sizeof(am.message), "%s", away_message);
-	g_free(away_message);
-
-	do_away_message(NULL, &am);
-
-	away_mess_destroy(NULL, ca);
+	destroy_dialog(NULL, w->window);
+	g_free(w->who);
+	g_free(w);
 }
 
-void su_away_mess(GtkWidget *widget, struct create_away *ca)
-{
-	if (!check_away_mess(ca, 1))
-		return;
-
-	do_away_message(NULL, save_away_message(ca));
-
-	away_mess_destroy(NULL, ca);
-}
-
-void create_away_mess(GtkWidget *widget, void *dummy)
+void
+gaim_gtkdialogs_warn(GaimConnection *gc, const char *who)
 {
-	GtkWidget *vbox, *hbox;
+	char *labeltext;
+	GtkWidget *hbox, *vbox;
 	GtkWidget *label;
-	GtkWidget *sw;
-	GtkWidget *button;
-	GList *focus_chain = NULL;
-	struct create_away *ca = g_new0(struct create_away, 1);
+	GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
+	GaimConversation *c = gaim_find_conversation_with_account(who, gc->account);
+
+	struct warning *w = g_new0(struct warning, 1);
+	w->who = g_strdup(who);
+	w->gc = gc;
+
+	gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
 
-	/* Set up window */
-	GAIM_DIALOG(ca->window);
-	gtk_widget_set_size_request(ca->window, -1, 250);
-	gtk_window_set_role(GTK_WINDOW(ca->window), "away_mess");
-	gtk_window_set_title(GTK_WINDOW(ca->window), _("New away message"));
-	g_signal_connect(G_OBJECT(ca->window), "delete_event",
-			   G_CALLBACK(away_mess_destroy_ca), ca);
+	w->window = gtk_dialog_new_with_buttons(_("Warn User"),
+			GTK_WINDOW(GAIM_GTK_WINDOW(c->window)->window), 0,
+			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+			GAIM_STOCK_WARN, GTK_RESPONSE_OK, NULL);
+	gtk_dialog_set_default_response (GTK_DIALOG(w->window), GTK_RESPONSE_OK);
+	g_signal_connect(G_OBJECT(w->window), "response", G_CALLBACK(gaim_gtkdialogs_warn_cb), w);
+
+	gtk_container_set_border_width (GTK_CONTAINER(w->window), 6);
+	gtk_window_set_resizable(GTK_WINDOW(w->window), FALSE);
+	gtk_dialog_set_has_separator(GTK_DIALOG(w->window), FALSE);
+	gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(w->window)->vbox), 12);
+	gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), 6);
 
 	hbox = gtk_hbox_new(FALSE, 12);
-	gtk_container_set_border_width(GTK_CONTAINER(hbox), 12);
-	gtk_container_add(GTK_CONTAINER(ca->window), hbox);
-
-	vbox = gtk_vbox_new(FALSE, 12);
-	gtk_container_add(GTK_CONTAINER(hbox), vbox);
+	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), hbox);
+	gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
 
-	/* Away message title */
-	hbox = gtk_hbox_new(FALSE, 0);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+	vbox = gtk_vbox_new(FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(hbox), vbox);
+	labeltext = g_strdup_printf(_("<span weight=\"bold\" size=\"larger\">Warn %s?</span>\n\n"
+				      "This will increase %s's warning level and he or she will be subject to harsher rate limiting.\n"), who, who);
+	label = gtk_label_new(NULL);
+	gtk_label_set_markup(GTK_LABEL(label), labeltext);
+	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+	gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+	g_free(labeltext);
 
-	label = gtk_label_new(_("Away title: "));
+	w->anon = gtk_check_button_new_with_mnemonic(_("Warn _anonymously?"));
+	gtk_box_pack_start(GTK_BOX(vbox), w->anon, FALSE, FALSE, 0);
+
+	hbox = gtk_hbox_new(FALSE, 6);
+	gtk_container_add(GTK_CONTAINER(vbox), hbox);
+	img = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_MENU);
+	gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
+	labeltext = _("<b>Anonymous warnings are less severe.</b>");
+	label = gtk_label_new(NULL);
+	gtk_label_set_markup(GTK_LABEL(label), labeltext);
+	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
 	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
 
-	ca->entry = gtk_entry_new();
-	gtk_box_pack_start(GTK_BOX(hbox), ca->entry, TRUE, TRUE, 0);
-	gaim_set_accessible_label (ca->entry, label);
-	focus_chain = g_list_append(focus_chain, hbox);
-
-	/* Toolbar */
-	ca->toolbar = gtk_imhtmltoolbar_new();
-	gtk_box_pack_start(GTK_BOX(vbox), ca->toolbar, FALSE, FALSE, 0);
-
-	/* Away message text */
-	sw = gtk_scrolled_window_new(NULL, NULL);
-	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
-								   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
-	gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
-
-	ca->text = gtk_imhtml_new(NULL, NULL);
-	gtk_imhtml_set_editable(GTK_IMHTML(ca->text), TRUE);
-	gtk_imhtml_set_format_functions(GTK_IMHTML(ca->text), GTK_IMHTML_ALL ^ GTK_IMHTML_IMAGE);
-	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(ca->text), GTK_WRAP_WORD_CHAR);
-
-	gtk_imhtml_smiley_shortcuts(GTK_IMHTML(ca->text),
-			gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts"));
-	gtk_imhtml_html_shortcuts(GTK_IMHTML(ca->text),
-			gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts"));
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck"))
-		gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(ca->text));
-	gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(ca->toolbar), ca->text);
-	gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(ca->toolbar), "default");
-	gaim_setup_imhtml(ca->text);
-
-	gtk_container_add(GTK_CONTAINER(sw), ca->text);
-	focus_chain = g_list_append(focus_chain, sw);
-
-	if (dummy) {
-		struct away_message *amt;
-		GtkTreeIter iter;
-		GtkListStore *ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(dummy)));
-		GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dummy));
-		GValue val = { 0, };
-
-		if (! gtk_tree_selection_get_selected (sel, (GtkTreeModel**)&ls, &iter))
-			return;
-		gtk_tree_model_get_value (GTK_TREE_MODEL(ls), &iter, 1, &val);
-		amt = g_value_get_pointer (&val);
-		gtk_entry_set_text(GTK_ENTRY(ca->entry), amt->name);
-		gtk_imhtml_append_text_with_images(GTK_IMHTML(ca->text), amt->message, 0, NULL);
-		ca->mess = amt;
-	}
-
-	hbox = gtk_hbox_new(FALSE, 5);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-
-	button = gaim_pixbuf_button_from_stock(_("_Save"), GTK_STOCK_SAVE, GAIM_BUTTON_HORIZONTAL);
-	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(save_away_mess), ca);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-
-	button = gaim_pixbuf_button_from_stock(_("Sa_ve & Use"), GTK_STOCK_OK, GAIM_BUTTON_HORIZONTAL);
-	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(su_away_mess), ca);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-
-	button = gaim_pixbuf_button_from_stock(_("_Use"), GTK_STOCK_EXECUTE, GAIM_BUTTON_HORIZONTAL);
-	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(use_away_mess), ca);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-
-	button = gaim_pixbuf_button_from_stock(_("_Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL);
-	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(away_mess_destroy), ca);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	focus_chain = g_list_prepend(focus_chain, hbox);
-
-	gtk_widget_show_all(ca->window);
-	gtk_container_set_focus_chain(GTK_CONTAINER(vbox), focus_chain);
+	dialogwindows = g_list_prepend(dialogwindows, w->window);
+	gtk_widget_show_all(w->window);
 }
 
 static void
-alias_chat_cb(GaimChat *chat, const char *new_alias)
+gaim_gtkdialogs_alias_contact_cb(GaimContact *contact, const char *new_alias)
+{
+	gaim_contact_set_alias(contact, new_alias);
+}
+
+void
+gaim_gtkdialogs_alias_contact(GaimContact *contact)
+{
+	gaim_request_input(NULL, _("Alias Contact"), NULL,
+					   _("Enter an alias for this contact."),
+					   contact->alias, FALSE, FALSE, NULL,
+					   _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_contact_cb),
+					   _("Cancel"), NULL, contact);
+}
+
+static void
+gaim_gtkdialogs_alias_buddy_cb(GaimBuddy *buddy, const char *new_alias)
+{
+	gaim_blist_alias_buddy(buddy, new_alias);
+	serv_alias_buddy(buddy);
+}
+
+void
+gaim_gtkdialogs_alias_buddy(GaimBuddy *b)
+{
+	char *secondary = g_strdup_printf(_("Enter an alias for %s."), b->name);
+
+	gaim_request_input(NULL, _("Alias Buddy"), NULL,
+					   secondary, b->alias, FALSE, FALSE, NULL,
+					   _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_buddy_cb),
+					   _("Cancel"), NULL, b);
+
+	g_free(secondary);
+}
+
+static void
+gaim_gtkdialogs_alias_chat_cb(GaimChat *chat, const char *new_alias)
 {
 	gaim_blist_alias_chat(chat, new_alias);
 }
 
 void
-alias_dialog_blist_chat(GaimChat *chat)
+gaim_gtkdialogs_alias_chat(GaimChat *chat)
 {
 	gaim_request_input(NULL, _("Alias Chat"), NULL,
 					   _("Enter an alias for this chat."),
 					   chat->alias, FALSE, FALSE, NULL,
-					   _("Alias"), G_CALLBACK(alias_chat_cb),
+					   _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_chat_cb),
 					   _("Cancel"), NULL, chat);
 }
 
 static void
-alias_contact_cb(GaimContact *contact, const char *new_alias)
+do_remove_contact(GaimContact *contact)
 {
-	gaim_contact_set_alias(contact, new_alias);
+	GaimBlistNode *bnode, *cnode;
+	GaimGroup *group;
+
+	if (!contact)
+		return;
+
+	cnode = (GaimBlistNode *)contact;
+	group = (GaimGroup*)cnode->parent;
+	for (bnode = cnode->child; bnode; bnode = bnode->next) {
+		GaimBuddy *buddy = (GaimBuddy*)bnode;
+		if (gaim_account_is_connected(buddy->account))
+			serv_remove_buddy(buddy->account->gc, buddy, group);
+	}
+	gaim_blist_remove_contact(contact);
+}
+
+void
+gaim_gtkdialogs_remove_contact(GaimContact *contact)
+{
+	GaimBuddy *buddy = gaim_contact_get_priority_buddy(contact);
+
+	if (!buddy)
+		return;
+
+	if (((GaimBlistNode*)contact)->child == (GaimBlistNode*)buddy &&
+			!((GaimBlistNode*)buddy)->next) {
+		gaim_gtkdialogs_remove_buddy(buddy);
+	} else {
+		char *text = g_strdup_printf(_("You are about to remove the contact containing %s and %d other buddies from your buddy list.  Do you want to continue?"),
+			       buddy->name, contact->totalsize - 1);
+
+		gaim_request_action(NULL, NULL, _("Remove Contact"), text, -1, contact, 2,
+				_("Remove Contact"), G_CALLBACK(do_remove_contact),
+				_("Cancel"), NULL);
+
+		g_free(text);
+	}
 }
 
 void
-alias_dialog_contact(GaimContact *contact)
+do_remove_group(GaimGroup *group)
 {
-	gaim_request_input(NULL, _("Alias Contact"), NULL,
-					   _("Enter an alias for this contact."),
-					   contact->alias, FALSE, FALSE, NULL,
-					   _("Alias"), G_CALLBACK(alias_contact_cb),
-					   _("Cancel"), NULL, contact);
+	GaimBlistNode *cnode, *bnode;
+
+	cnode = ((GaimBlistNode*)group)->child;
+
+	while (cnode) {
+		if (GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
+			bnode = cnode->child;
+			cnode = cnode->next;
+			while (bnode) {
+				GaimBuddy *buddy;
+				if (GAIM_BLIST_NODE_IS_BUDDY(bnode)) {
+					GaimConversation *conv;
+					buddy = (GaimBuddy*)bnode;
+					bnode = bnode->next;
+					conv = gaim_find_conversation_with_account(buddy->name, buddy->account);
+					if (gaim_account_is_connected(buddy->account)) {
+						serv_remove_buddy(buddy->account->gc, buddy, group);
+						gaim_blist_remove_buddy(buddy);
+						if (conv)
+							gaim_conversation_update(conv,
+									GAIM_CONV_UPDATE_REMOVE);
+					}
+				} else {
+					bnode = bnode->next;
+				}
+			}
+		} else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) {
+			GaimChat *chat = (GaimChat *)cnode;
+			cnode = cnode->next;
+			if (gaim_account_is_connected(chat->account))
+				gaim_blist_remove_chat(chat);
+		} else {
+			cnode = cnode->next;
+		}
+	}
+
+	gaim_blist_remove_group(group);
+}
+
+void
+gaim_gtkdialogs_remove_group(GaimGroup *group)
+{
+	char *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?"),
+			       group->name);
+
+	gaim_request_action(NULL, NULL, _("Remove Group"), text, -1, group, 2,
+						_("Remove Group"), G_CALLBACK(do_remove_group),
+						_("Cancel"), NULL);
+
+	g_free(text);
 }
 
 static void
-alias_buddy_cb(GaimBuddy *buddy, const char *alias)
+do_remove_buddy(GaimBuddy *buddy)
 {
-	gaim_blist_alias_buddy(buddy, (alias != NULL && *alias != '\0') ? alias : NULL);
-	serv_alias_buddy(buddy);
+	GaimGroup *group;
+	GaimConversation *conv;
+	gchar *name;
+	GaimAccount *account;
+
+	if (!buddy)
+		return;
+
+	group = gaim_find_buddys_group(buddy);
+	name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */
+	account = buddy->account;
+
+	gaim_debug(GAIM_DEBUG_INFO, "blist",
+			   "Removing '%s' from buddy list.\n", buddy->name);
+	/* XXX - Should remove from blist first... then call serv_remove_buddy()? */
+	serv_remove_buddy(buddy->account->gc, buddy, group);
+	gaim_blist_remove_buddy(buddy);
+
+	conv = gaim_find_conversation_with_account(name, account);
+
+	if (conv != NULL)
+		gaim_conversation_update(conv, GAIM_CONV_UPDATE_REMOVE);
+
+	g_free(name);
 }
 
 void
-alias_dialog_bud(GaimBuddy *b)
+gaim_gtkdialogs_remove_buddy(GaimBuddy *buddy)
 {
-	char *secondary = g_strdup_printf(_("Enter an alias for %s."), b->name);
+	char *text;
+
+	if (!buddy)
+		return;
+
+	text = g_strdup_printf(_("You are about to remove %s from your buddy list.  Do you want to continue?"), buddy->name);
+
+	gaim_request_action(NULL, NULL, _("Remove Buddy"), text, -1, buddy, 2,
+						_("Remove Buddy"), G_CALLBACK(do_remove_buddy),
+						_("Cancel"), NULL);
+
+	g_free(text);
+}
 
-	gaim_request_input(NULL, _("Alias Buddy"), NULL,
-					   secondary, b->alias, FALSE, FALSE, NULL,
-					   _("Alias"), G_CALLBACK(alias_buddy_cb),
-					   _("Cancel"), NULL, b);
+static void
+do_remove_chat(GaimChat *chat)
+{
+	gaim_blist_remove_chat(chat);
+}
 
-	g_free(secondary);
+void
+gaim_gtkdialogs_remove_chat(GaimChat *chat)
+{
+	char *name = gaim_chat_get_display_name(chat);
+	char *text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list.  Do you want to continue?"), name);
+
+	gaim_request_action(NULL, NULL, _("Remove Chat"), text, -1, chat, 2,
+						_("Remove Chat"), G_CALLBACK(do_remove_chat),
+						_("Cancel"), NULL);
+
+	g_free(name);
+	g_free(text);
 }
--- a/src/gtkdialogs.h	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/gtkdialogs.h	Mon Aug 09 03:49:46 2004 +0000
@@ -31,21 +31,20 @@
 #include "conversation.h"
 
 /* Functions in gtkdialogs.c (these should actually stay in this file) */
+void gaim_gtkdialogs_destroy_all();
 void gaim_gtkdialogs_im();
+void gaim_gtkdialogs_im_with_user(GaimAccount *, const char *);
 void gaim_gtkdialogs_info();
 void gaim_gtkdialogs_log();
-void gaim_gtkdialogs_im_with_user(GaimAccount *, const char *);
 void gaim_gtkdialogs_warn(GaimConnection *, const char *);
+void gaim_gtkdialogs_alias_contact(GaimContact *);
+void gaim_gtkdialogs_alias_buddy(GaimBuddy *);
+void gaim_gtkdialogs_alias_chat(GaimChat *);
 
-void alias_dialog_bud(GaimBuddy *);
-void alias_dialog_contact(GaimContact *);
-void alias_dialog_blist_chat(GaimChat *);
-void create_away_mess(GtkWidget *, void *);
-void show_confirm_del(GaimBuddy *);
-void show_confirm_del_group(GaimGroup *);
-void show_confirm_del_blist_chat(GaimChat *);
-void show_confirm_del_contact(GaimContact *);
-void destroy_all_dialogs();
+void gaim_gtkdialogs_remove_buddy(GaimBuddy *);
+void gaim_gtkdialogs_remove_group(GaimGroup *);
+void gaim_gtkdialogs_remove_chat(GaimChat *);
+void gaim_gtkdialogs_remove_contact(GaimContact *);
 
 /* Functions in about.c */
 extern void show_about(GtkWidget *, void *);
@@ -65,17 +64,6 @@
 #define DEFAULT_FONT_FACE "Helvetica"
 
 
-/* XXX CUI: away messages aren't really anything more than char* but we need two char*'s
- * for the UI so that people can name their away messages when they save them. So these
- * are really a UI function and struct away_message should be removed from the core. */
-/* WTF?  How does having a title for something mean that it is part of the UI? */
-struct away_message {
-	char name[80];
-	char message[2048];
-};
-
-
-
 /* this is used for queuing messages received while away. This is really a UI function
  * which is why the struct is here. */
 
@@ -102,13 +90,6 @@
 extern GtkWidget *mainwindow;
 extern int docklet_count;
 
-/* Globals in away.c */
-extern GSList *away_messages;
-extern struct away_message *awaymessage;
-extern GtkWidget *awaymenu;
-extern GtkWidget *awayqueue;
-extern GtkListStore *awayqueuestore;
-
 /* Globals in themes.c */
 extern struct smiley_theme *current_smiley_theme;
 extern GSList *smiley_themes;
@@ -117,14 +98,6 @@
 extern void show_login();
 extern void gaim_setup(GaimConnection *);
 
-/* Functions in away.c */
-extern void rem_away_mess(GtkWidget *, struct away_message *);
-extern void do_away_message(GtkWidget *, struct away_message *);
-extern void do_away_menu();
-extern void toggle_away_queue();
-extern void purge_away_queue(GSList**);
-extern void do_im_back(GtkWidget *w, GtkWidget *x);
-
 /* Functions in session.c */
 extern void session_init(gchar *, gchar *, gchar *);
 extern void session_end();
--- a/src/gtkimhtmltoolbar.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/gtkimhtmltoolbar.c	Mon Aug 09 03:49:46 2004 +0000
@@ -22,16 +22,16 @@
  */
 #include "gtkinternal.h"
 
-#include "gtkimhtmltoolbar.h"
-#include "gtkutils.h"
-
-#include "gtkdialogs.h"
 #include "imgstore.h"
 #include "notify.h"
 #include "request.h"
 #include "stock.h"
 #include "util.h"
 
+#include "gtkdialogs.h"
+#include "gtkimhtmltoolbar.h"
+#include "gtkutils.h"
+
 static GtkVBoxClass *parent_class = NULL;
 
 static void do_bold(GtkWidget *bold, GtkIMHtmlToolbar *toolbar)
--- a/src/gtknotify.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/gtknotify.c	Mon Aug 09 03:49:46 2004 +0000
@@ -32,7 +32,6 @@
 #include "stock.h"
 #include "util.h"
 
-#include "gtkdialogs.h"
 #include "gtkimhtml.h"
 #include "gtknotify.h"
 #include "gtkutils.h"
--- a/src/gtkprefs.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/gtkprefs.c	Mon Aug 09 03:49:46 2004 +0000
@@ -35,6 +35,7 @@
 #include "util.h"
 #include "network.h"
 
+#include "away.h"
 #include "gtkblist.h"
 #include "gtkconv.h"
 #include "gtkdebug.h"
--- a/src/gtkrequest.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/gtkrequest.c	Mon Aug 09 03:49:46 2004 +0000
@@ -26,7 +26,6 @@
 
 #include "prefs.h"
 
-#include "gtkdialogs.h"
 #include "gtkimhtml.h"
 #include "gtkimhtmltoolbar.h"
 #include "gtkrequest.h"
--- a/src/idle.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/idle.c	Mon Aug 09 03:49:46 2004 +0000
@@ -40,7 +40,7 @@
 #include "signals.h"
 
 /* XXX - Get this out of here! */
-#include "gtkdialogs.h"
+#include "away.h"
 
 /* XXX For the away stuff */
 #include "gaim.h"
--- a/src/protocols/oscar/oscar.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Mon Aug 09 03:49:46 2004 +0000
@@ -28,7 +28,6 @@
 
 #include "account.h"
 #include "accountopt.h"
-#include "away.h"
 #include "buddyicon.h"
 #include "conversation.h"
 #include "core.h"
@@ -5416,7 +5415,7 @@
 		/* If this is our only online account then globally set Gaim not-away */
 		GList *gcs = gaim_connections_get_all();
 		if (gcs->next == NULL)
-			do_im_back(NULL, NULL);
+			; /* XXX do_im_back(NULL, NULL); */
 	}
 
 	aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL);
--- a/src/server.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/server.c	Mon Aug 09 03:49:46 2004 +0000
@@ -34,8 +34,9 @@
 #include "util.h"
 
 /* XXX UI Stuff */
+#include "away.h"
+#include "gtkdialogs.h"
 #include "gaim.h"
-#include "gtkdialogs.h"
 #include "gtkimhtml.h"
 #include "gtkutils.h"
 
--- a/src/sound.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/sound.c	Mon Aug 09 03:49:46 2004 +0000
@@ -26,8 +26,8 @@
 #include "prefs.h"
 
 /* XXX CORE/UI: this goes away when away messages become sane */
+#include "away.h"
 #include "gtkinternal.h"
-#include "gtkdialogs.h"
 
 
 static GaimSoundUiOps *sound_ui_ops = NULL;
--- a/src/status.c	Sun Aug 08 19:01:42 2004 +0000
+++ b/src/status.c	Mon Aug 09 03:49:46 2004 +0000
@@ -26,8 +26,8 @@
 #include "util.h"
 
 /* XXX CORE/UI */
+#include "away.h"
 #include "gtkinternal.h"
-#include "gtkdialogs.h"
 
 
 /* for people like myself who are too lazy to add an away msg :) */