changeset 9025:b24967757d46

[gaim-migrate @ 9801] " - Fixed text-decoration: underline; parsing from being dependent on font-size specified - IM HTML Toolbar dialogs now automatically fill with the color/font for the current text - Made most of the IMHTML formatting buttons fire signals where appropriate - Implemented a global on or off "Send default formatting with outgoing messages" option - If user previously sent a font name, we assume they want formatting on, otherwise it defaults to off. - Removed font and color from the GaimGtkConversation struct, because this wasn't being used anywhere, by anything and just resulted in more confusing code. - Removed three functions related to the struct, including one that was declared, but never actually written. - Added get_current_fontface, get_current_fontsize, get_current_forecolor, get_current_backcolor to gtk_imhtml_* to get the formatting at the cursor (or whole buffer when wbfo is on) - Removed all dialogs used only by the old default formatting preferences from dialogs.c - When font background, color, or face are "disabled" they are stored as an empty string in their prefs. - Fixed a bug where NULL for background, color, or face did not remove the tags in wbfo " all that, quoth SimGuy committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 23 May 2004 03:54:20 +0000
parents 85caba2f820a
children 48f255b2518d
files ChangeLog src/dialogs.c src/gaimrc.c src/gtkconv.c src/gtkconv.h src/gtkimhtml.c src/gtkimhtml.h src/gtkimhtmltoolbar.c src/gtkprefs.c src/gtkutils.c
diffstat 10 files changed, 304 insertions(+), 470 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun May 23 02:42:01 2004 +0000
+++ b/ChangeLog	Sun May 23 03:54:20 2004 +0000
@@ -51,6 +51,8 @@
 	* Added "Conversation placement - By conversation count"
 	* Added a "none" smiley theme to replace the "Show graphical
 	  smileys" option
+	* Replace default formatting preferences with a dialog to set a
+	  default formatting in a WYSIWYG manner.
 	* Removed "Show logins in window," default to yes
 	* Removed "Send URLs as links," default to yes (in protocols that
 	  support HTML)
--- a/src/dialogs.c	Sun May 23 02:42:01 2004 +0000
+++ b/src/dialogs.c	Sun May 23 03:54:20 2004 +0000
@@ -46,7 +46,6 @@
 #include "gaim.h"
 
 static GList *dialogwindows = NULL;
-static GtkWidget *fontseld = NULL;
 
 struct confirm_del {
 	GtkWidget *window;
@@ -583,119 +582,6 @@
 						NULL);
 }
 
-/*------------------------------------------------------*/
-/* Color Selection Dialog                               */
-/*------------------------------------------------------*/
-
-GtkWidget *fgcseld = NULL;
-GtkWidget *bgcseld = NULL;
-
-void show_fgcolor_dialog(GaimConversation *c, GtkWidget *color)
-{
-	GaimGtkConversation *gtkconv;
-	GdkColor fgcolor;
-
-	gtkconv = GAIM_GTK_CONVERSATION(c);
-
-	gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
-					&fgcolor);
-
-	if (fgcseld)
-		return;
-	
-	fgcseld = gtk_color_selection_dialog_new(_("Select Text Color"));
-	gtk_color_selection_set_current_color(GTK_COLOR_SELECTION
-					      (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), &fgcolor);
-	g_signal_connect(G_OBJECT(fgcseld), "delete_event",
-			 G_CALLBACK(destroy_colorsel), (void *)1);
-	g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->cancel_button),
-			 "clicked", G_CALLBACK(destroy_colorsel), (void *)1);
-	g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->ok_button), "clicked",
-			 G_CALLBACK(apply_color_dlg), (void *)1);
-	gtk_widget_realize(fgcseld);
-	gtk_widget_show(fgcseld);
-	gdk_window_raise(fgcseld->window);
-	return;
-}
-
-void show_bgcolor_dialog(GaimConversation *c, GtkWidget *color)
-{
-	GaimGtkConversation *gtkconv;
-	GdkColor bgcolor;
-
-	gtkconv = GAIM_GTK_CONVERSATION(c);
-
-	gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
-					&bgcolor);
-
-	if (bgcseld)
-		return;
-	
-	bgcseld = gtk_color_selection_dialog_new(_("Select Background Color"));
-	gtk_color_selection_set_current_color(GTK_COLOR_SELECTION
-					      (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), &bgcolor);
-	g_signal_connect(G_OBJECT(bgcseld), "delete_event",
-			 G_CALLBACK(destroy_colorsel), NULL);
-	g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->cancel_button),
-			 "clicked", G_CALLBACK(destroy_colorsel), NULL);
-	g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->ok_button), "clicked",
-			 G_CALLBACK(apply_color_dlg), (void *)2);
-	gtk_widget_realize(bgcseld);
-	gtk_widget_show(bgcseld);
-	gdk_window_raise(bgcseld->window);
-	return;
-}
-
-
-/*------------------------  ----------------------------------------------*/
-/*  Font Selection Dialog                                                 */
-/*------------------------------------------------------------------------*/
-
-
-void destroy_fontsel(GtkWidget *w, gpointer d)
-{
-	gtk_widget_destroy(fontseld);
-	fontseld = NULL;
-}
-
-void show_font_dialog(GaimConversation *c, GtkWidget *font)
-{
-	GaimGtkConversation *gtkconv;
-	char fonttif[128];
-	const char *fontface;
-
-	gtkconv = GAIM_GTK_CONVERSATION(c);
-
-
-	if (fontseld)
-		return;
-	
-	fontseld = gtk_font_selection_dialog_new(_("Select Font"));
-	
-	fontface = gaim_prefs_get_string("/gaim/gtk/conversations/font_face");
-	
-	if (fontface != NULL && *fontface != '\0') {
-		g_snprintf(fonttif, sizeof(fonttif), "%s 12", fontface);
-		gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld),
-							fonttif);
-	} else {
-		gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld),
-							DEFAULT_FONT_FACE " 12");
-	}
-	
-	g_signal_connect(G_OBJECT(fontseld), "delete_event",
-			 G_CALLBACK(destroy_fontsel), NULL);
-	g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->cancel_button),
-			 "clicked", G_CALLBACK(destroy_fontsel), NULL);
-	g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->ok_button), "clicked",
-			 G_CALLBACK(apply_font_dlg), fontseld);
-	gtk_widget_realize(fontseld);
-	gtk_widget_show(fontseld);
-	gdk_window_raise(fontseld->window);
-	return;
-
-}
-
 /*------------------------------------------------------------------------*/
 /*  The dialog for new away messages                                      */
 /*------------------------------------------------------------------------*/
--- a/src/gaimrc.c	Sun May 23 02:42:01 2004 +0000
+++ b/src/gaimrc.c	Sun May 23 03:54:20 2004 +0000
@@ -46,14 +46,12 @@
 #define BORING_DEFAULT_AWAY_MSG _("sorry, i ran out for a while. bbl")
 #define MAX_VALUES 10
 
+/* We're going to ignore strikethough and assume "custom font"
+   means to send custom formatting */
 #define OPT_FONT_BOLD			0x00000001
 #define OPT_FONT_ITALIC			0x00000002
 #define OPT_FONT_UNDERLINE		0x00000008
-/* We're going to ignore strikethough */
 #define OPT_FONT_FACE			0x00000020
-#define OPT_FONT_FGCOL			0x00000040
-#define OPT_FONT_BGCOL			0x00000080
-#define OPT_FONT_SIZE			0x00000100
 
 #define OPT_MISC_DEBUG			0x00000001
 #define OPT_MISC_BROWSER_POPUP		0x00000002
@@ -1061,14 +1059,8 @@
 					font_options & OPT_FONT_ITALIC);
 			gaim_prefs_set_bool("/gaim/gtk/conversations/send_underline",
 					font_options & OPT_FONT_UNDERLINE);
-			gaim_prefs_set_bool("/gaim/gtk/conversations/use_custom_font",
+			gaim_prefs_set_bool("/gaim/gtk/conversations/send_formatting",
 					font_options & OPT_FONT_FACE);
-			gaim_prefs_set_bool("/gaim/gtk/conversations/use_custom_size",
-					font_options & OPT_FONT_SIZE);
-			gaim_prefs_set_bool("/gaim/gtk/conversations/use_custom_fgcolor",
-					font_options & OPT_FONT_FGCOL);
-			gaim_prefs_set_bool("/gaim/gtk/conversations/use_custom_bgcolor",
-					font_options & OPT_FONT_BGCOL);
 
 		} else if (!strcmp(p->option, "sound_options")) {
 			sound_options = atoi(p->value[0]);
--- a/src/gtkconv.c	Sun May 23 02:42:01 2004 +0000
+++ b/src/gtkconv.c	Sun May 23 03:54:20 2004 +0000
@@ -269,56 +269,66 @@
 
 	if (gc && gc->flags & GAIM_CONNECTION_HTML)
 	{
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold"))
-			gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry));
-		
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic"))
-			gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry));
-
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline"))
-			gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry));
-		
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font") ||
-			c->has_font)
+		if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting"))
 		{
-			gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), c->fontface);
-		}
-
-		if (!(gc->flags & GAIM_CONNECTION_NO_FONTSIZE) &&
-			gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size"))
-		{
-		        gtk_imhtml_font_set_size(GTK_IMHTML(c->entry),
+			char *color;
+			GdkColor fg_color, bg_color;
+
+			if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold"))
+				gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry));
+
+			if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic"))
+				gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry));
+
+			if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline"))
+				gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry));
+
+			gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry),
+				gaim_prefs_get_string("/gaim/gtk/conversations/font_face"));
+
+			if (!(gc->flags & GAIM_CONNECTION_NO_FONTSIZE))
+				gtk_imhtml_font_set_size(GTK_IMHTML(c->entry),
 					gaim_prefs_get_int("/gaim/gtk/conversations/font_size"));
-		}
-
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor"))
-		{
-			char *color = g_strdup_printf("#%02x%02x%02x",
-										  c->fg_color.red   / 256,
-										  c->fg_color.green / 256,
-										  c->fg_color.blue  / 256);
+
+			if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0)
+			{
+				gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
+								&fg_color);
+				color = g_strdup_printf("#%02x%02x%02x",
+										fg_color.red   / 256,
+										fg_color.green / 256,
+										fg_color.blue  / 256);
+			}
+			else
+				color = g_strdup("");
+
 			gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color);
 			g_free(color);
-		}
-
-		if (!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) &&
-			gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor"))
-		{
-			char *color = g_strdup_printf("#%02x%02x%02x",
-										  c->bg_color.red   / 256,
-										  c->bg_color.green / 256,
-										  c->bg_color.blue  / 256);
+
+			if(!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) &&
+			   strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0)
+			{
+				gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
+								&bg_color);
+				color = g_strdup_printf("#%02x%02x%02x",
+										bg_color.red   / 256,
+										bg_color.green / 256,
+										bg_color.blue  / 256);
+			}
+			else
+				color = g_strdup("");
+
 			gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color);
 			g_free(color);
 		}
 
+
 		if (gc->flags & GAIM_CONNECTION_FORMATTING_WBFO)
 			gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE);
 		else
 			gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE);
 	}
 }
-
 static void
 send_cb(GtkWidget *widget, GaimConversation *conv)
 {
@@ -4151,12 +4161,6 @@
 		gtkconv->sg       = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 		gtkconv->tooltips = gtk_tooltips_new();
 
-		/* Setup the foreground and background colors */
-		gaim_gtkconv_update_font_colors(conv);
-
-		/* Setup the font face */
-		gaim_gtkconv_update_font_face(conv);
-
 		if (conv_type == GAIM_CONV_IM) {
 			gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane));
 			gtkconv->u.im->a_virgin = TRUE;
@@ -5306,38 +5310,6 @@
 }
 
 void
-gaim_gtkconv_update_font_colors(GaimConversation *conv)
-{
-	GaimGtkConversation *gtkconv;
-
-	if (!GAIM_IS_GTK_CONVERSATION(conv))
-		return;
-
-	gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-	gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
-					&gtkconv->fg_color);
-
-	gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
-					&gtkconv->bg_color);
-}
-
-void
-gaim_gtkconv_update_font_face(GaimConversation *conv)
-{
-	GaimGtkConversation *gtkconv;
-
-	if (!GAIM_IS_GTK_CONVERSATION(conv))
-		return;
-
-	gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-	strncpy(gtkconv->fontface,
-			gaim_prefs_get_string("/gaim/gtk/conversations/font_face"),
-			sizeof(gtkconv->fontface));
-}
-
-void
 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv)
 {
 	GaimConvWindow *win;
@@ -5799,23 +5771,20 @@
 	gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE);
+	gaim_prefs_add_bool("/gaim/gtk/conversations/send_formatting", FALSE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_formatting", FALSE);
-	gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_bgcolor", FALSE);
-	gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_fgcolor", FALSE);
-	gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_font", FALSE);
-	gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_size", FALSE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE);
 	gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last");
 	gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1);
-	gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "#FFFFFF");
-	gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "#000000");
+	gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "");
+	gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "");
 	gaim_prefs_add_string("/gaim/gtk/conversations/font_face", "");
 	gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE);
--- a/src/gtkconv.h	Sun May 23 02:42:01 2004 +0000
+++ b/src/gtkconv.h	Sun May 23 03:54:20 2004 +0000
@@ -130,10 +130,6 @@
 {
 	gboolean make_sound;
 	gboolean show_formatting_toolbar;
-	gboolean has_font;
-	char fontface[128];
-	GdkColor fg_color;
-	GdkColor bg_color;
 
 	GtkTooltips *tooltips;
 
@@ -220,28 +216,6 @@
 void gaim_gtkconv_update_buddy_icon(GaimConversation *conv);
 
 /**
- * Updates the font buttons on all conversations to reflect any changed
- * preferences.
- */
-void gaim_gtkconv_update_font_buttons(void);
-
-/**
- * Updates the font colors of each conversation to the new colors
- * chosen in the prefs dialog.
- *
- * @param conv The conversation to update.
- */
-void gaim_gtkconv_update_font_colors(GaimConversation *conv);
-
-/**
- * Updates the font faces of each conversation to the new font
- * face chosen in the prefs dialog.
- *
- * @param conv The conversation to update.
- */
-void gaim_gtkconv_update_font_face(GaimConversation *conv);
-
-/**
  * Updates the tab positions on all conversation windows to reflect any
  * changed preferences.
  */
--- a/src/gtkimhtml.c	Sun May 23 02:42:01 2004 +0000
+++ b/src/gtkimhtml.c	Sun May 23 03:54:20 2004 +0000
@@ -2299,8 +2299,7 @@
 						    font->underline = oldfont->underline;
 						}
 						if (textdec && font->underline != 1
-							&& size
-							&& g_ascii_strcasecmp(size, "underline") == 0
+							&& g_ascii_strcasecmp(textdec, "underline") == 0
 							&& (imhtml->format_functions & GTK_IMHTML_UNDERLINE))
 						{
 						    gtk_imhtml_toggle_underline(imhtml);
@@ -3129,6 +3128,39 @@
 		(*underline) = TRUE;
 }
 
+char *
+gtk_imhtml_get_current_fontface(GtkIMHtml *imhtml)
+{
+	if (imhtml->edit.fontface)
+		return g_strdup(imhtml->edit.fontface);
+	else
+		return NULL;
+}
+
+char *
+gtk_imhtml_get_current_forecolor(GtkIMHtml *imhtml)
+{
+	if (imhtml->edit.forecolor)
+		return g_strdup(imhtml->edit.forecolor);
+	else
+		return NULL;
+}
+
+char *
+gtk_imhtml_get_current_backcolor(GtkIMHtml *imhtml)
+{
+	if (imhtml->edit.backcolor)
+		return g_strdup(imhtml->edit.backcolor);
+	else
+		return NULL;
+}
+
+gint
+gtk_imhtml_get_current_fontsize(GtkIMHtml *imhtml)
+{
+	return imhtml->edit.fontsize;
+}
+
 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml)
 {
 	return imhtml->editable;
@@ -3289,7 +3321,9 @@
 
 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size)
 {
+	GObject *object;
 	GtkTextIter start, end;
+	GtkIMHtmlButtons b = 0;
 
 	imhtml->edit.fontsize = size;
 
@@ -3305,10 +3339,16 @@
 		                                  find_font_size_tag(imhtml, imhtml->edit.fontsize), &start, &end);
 	}
 
+	object = g_object_ref(G_OBJECT(imhtml));
+	b |= GTK_IMHTML_SHRINK;
+	b |= GTK_IMHTML_GROW;
+	g_signal_emit(object, signals[TOGGLE_FORMAT], 0, b);
+	g_object_unref(object);
 }
 
 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml)
 {
+	GObject *object;
 	GtkTextIter start, end;
 
 	if (imhtml->edit.fontsize == 1)
@@ -3329,10 +3369,14 @@
 		gtk_text_buffer_apply_tag(imhtml->text_buffer,
 		                                  find_font_size_tag(imhtml, imhtml->edit.fontsize), &start, &end);
 	}
+	object = g_object_ref(G_OBJECT(imhtml));
+	g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_SHRINK);
+	g_object_unref(object);
 }
 
 void gtk_imhtml_font_grow(GtkIMHtml *imhtml)
 {
+	GObject *object;
 	GtkTextIter start, end;
 
 	if (imhtml->edit.fontsize == MAX_FONT_SIZE)
@@ -3353,16 +3397,20 @@
 		gtk_text_buffer_apply_tag(imhtml->text_buffer,
 		                                  find_font_size_tag(imhtml, imhtml->edit.fontsize), &start, &end);
 	}
+	object = g_object_ref(G_OBJECT(imhtml));
+	g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_GROW);
+	g_object_unref(object);
 }
 
 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color)
 {
+	GObject *object;
 	GtkTextIter start, end;
 
 	if (imhtml->edit.forecolor != NULL)
 		g_free(imhtml->edit.forecolor);
 
-	if (color) {
+	if (color && strcmp(color, "") != 0) {
 		imhtml->edit.forecolor = g_strdup(color);
 		if (imhtml->wbfo) {
 			gtk_text_buffer_get_bounds(imhtml->text_buffer, &start, &end);
@@ -3377,19 +3425,28 @@
 		}
 	} else {
 		imhtml->edit.forecolor = NULL;
+		if (imhtml->wbfo) {
+			gtk_text_buffer_get_bounds(imhtml->text_buffer, &start, &end);
+			remove_font_forecolor(imhtml, &start, &end, TRUE);
+		}
 	}
 
+	object = g_object_ref(G_OBJECT(imhtml));
+	g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_FORECOLOR);
+	g_object_unref(object);
+
 	return imhtml->edit.forecolor != NULL;
 }
 
 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color)
 {
+	GObject *object;
 	GtkTextIter start, end;
 
 	if (imhtml->edit.backcolor != NULL)
 		g_free(imhtml->edit.backcolor);
 
-	if (color) {
+	if (color && strcmp(color, "") != 0) {
 		imhtml->edit.backcolor = g_strdup(color);
 
 		if (imhtml->wbfo) {
@@ -3405,19 +3462,28 @@
 		}
 	} else {
 		imhtml->edit.backcolor = NULL;
+		if (imhtml->wbfo) {
+			gtk_text_buffer_get_bounds(imhtml->text_buffer, &start, &end);
+			remove_font_backcolor(imhtml, &start, &end, TRUE);
+		}
 	}
 
+	object = g_object_ref(G_OBJECT(imhtml));
+	g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_BACKCOLOR);
+	g_object_unref(object);
+
 	return imhtml->edit.backcolor != NULL;
 }
 
 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face)
 {
+	GObject *object;
 	GtkTextIter start, end;
 
 	if (imhtml->edit.fontface != NULL)
 		g_free(imhtml->edit.fontface);
 
-	if (face) {
+	if (face && strcmp(face, "") != 0) {
 		imhtml->edit.fontface = g_strdup(face);
 
 		if (imhtml->wbfo) {
@@ -3433,13 +3499,22 @@
 		}
 	} else {
 		imhtml->edit.fontface = NULL;
+		if (imhtml->wbfo) {
+			gtk_text_buffer_get_bounds(imhtml->text_buffer, &start, &end);
+			remove_font_face(imhtml, &start, &end, TRUE);
+		}
 	}
 
+	object = g_object_ref(G_OBJECT(imhtml));
+	g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_FACE);
+	g_object_unref(object);
+
 	return imhtml->edit.fontface != NULL;
 }
 
 void gtk_imhtml_toggle_link(GtkIMHtml *imhtml, const char *url)
 {
+	GObject *object;
 	GtkTextIter start, end;
 	GtkTextTag *linktag;
 	static guint linkno = 0;
@@ -3469,6 +3544,10 @@
 			gtk_text_buffer_apply_tag(imhtml->text_buffer, linktag, &start, &end);
 		}
 	}
+
+	object = g_object_ref(G_OBJECT(imhtml));
+	g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_LINK);
+	g_object_unref(object);
 }
 
 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, GtkTextMark *mark, const char *url, const char *text)
--- a/src/gtkimhtml.h	Sun May 23 02:42:01 2004 +0000
+++ b/src/gtkimhtml.h	Sun May 23 03:54:20 2004 +0000
@@ -261,6 +261,10 @@
 void gtk_imhtml_set_format_functions(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons);
 GtkIMHtmlButtons gtk_imhtml_get_format_functions(GtkIMHtml *imhtml);
 void gtk_imhtml_get_current_format(GtkIMHtml *imhtml, gboolean *bold, gboolean *italic, gboolean *underline);
+char *gtk_imhtml_get_current_fontface(GtkIMHtml *imhtml);
+char *gtk_imhtml_get_current_forecolor(GtkIMHtml *imhtml);
+char *gtk_imhtml_get_current_backcolor(GtkIMHtml *imhtml);
+gint gtk_imhtml_get_current_fontsize(GtkIMHtml *imhtml);
 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml);
 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml);
 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml);
--- a/src/gtkimhtmltoolbar.c	Sun May 23 02:42:01 2004 +0000
+++ b/src/gtkimhtmltoolbar.c	Sun May 23 03:54:20 2004 +0000
@@ -153,27 +153,26 @@
 static void
 toggle_font(GtkWidget *font, GtkIMHtmlToolbar *toolbar)
 {
-#if 0
-	char fonttif[128];
-	const char *fontface;
-#endif
+	const char *fontname;
 
 	g_return_if_fail(toolbar);
 
+	fontname = gtk_imhtml_get_current_fontface(GTK_IMHTML(toolbar->imhtml));
+
 	if (!toolbar->font_dialog) {
 		toolbar->font_dialog = gtk_font_selection_dialog_new(_("Select Font"));
 
 		g_object_set_data(G_OBJECT(toolbar->font_dialog), "gaim_toolbar", toolbar);
 
-		/*	if (gtkconv->fontface[0]) {
-		  g_snprintf(fonttif, sizeof(fonttif), "%s 12", gtkconv->fontface);
-		  gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font),
-		  fonttif);
-		  } else {
-		  gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font),
-		  DEFAULT_FONT_FACE);
-		  }
-		*/
+		if(fontname) {
+			char fonttif[128];
+			g_snprintf(fonttif, sizeof(fonttif), "%s 12", fontname);
+			gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog),
+													fonttif);
+		} else {
+			gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog),
+													DEFAULT_FONT_FACE);
+		}
 
 		g_signal_connect(G_OBJECT(toolbar->font_dialog), "delete_event",
 						 G_CALLBACK(destroy_toolbar_font), toolbar);
@@ -231,15 +230,18 @@
 {
 	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) {
 		GtkWidget *colorsel;
-		/* GdkColor fgcolor; */
+		GdkColor fgcolor;
+		const char *color = gtk_imhtml_get_current_forecolor(GTK_IMHTML(toolbar->imhtml));
 
-		/*gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
-		  &fgcolor);*/
 		if (!toolbar->fgcolor_dialog) {
 
 			toolbar->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color"));
 			colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->colorsel;
-			//gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor);
+			if (color) {
+				gdk_color_parse(color, &fgcolor);
+				gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor);
+			}
+
 			g_object_set_data(G_OBJECT(colorsel), "gaim_toolbar", toolbar);
 
 			g_signal_connect(G_OBJECT(toolbar->fgcolor_dialog), "delete_event",
@@ -301,15 +303,18 @@
 {
 	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) {
 		GtkWidget *colorsel;
-		/* GdkColor bgcolor; */
+		GdkColor bgcolor;
+		const char *color = gtk_imhtml_get_current_backcolor(GTK_IMHTML(toolbar->imhtml));
 
-		/*gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
-		  &bgcolor);*/
 		if (!toolbar->bgcolor_dialog) {
 
 			toolbar->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color"));
 			colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->colorsel;
-			//gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor);
+			if (color) {
+				gdk_color_parse(color, &bgcolor);
+				gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor);
+			}
+
 			g_object_set_data(G_OBJECT(colorsel), "gaim_toolbar", toolbar);
 
 			g_signal_connect(G_OBJECT(toolbar->bgcolor_dialog), "delete_event",
--- a/src/gtkprefs.c	Sun May 23 02:42:01 2004 +0000
+++ b/src/gtkprefs.c	Sun May 23 03:54:20 2004 +0000
@@ -92,9 +92,6 @@
 static GtkTreeIter *prefs_notebook_add_page(const char*, GdkPixbuf*,
 											GtkWidget*, GtkTreeIter*,
 											GtkTreeIter*, int);
-#if 0 /* PREFSLASH04 */
-static GtkWidget *show_color_pref(GtkWidget *, gboolean);
-#endif
 static void delete_prefs(GtkWidget *, void *);
 static void update_plugin_list(void *data);
 
@@ -696,53 +693,81 @@
 	return ret;
 }
 
-static void update_color(GtkWidget *w, GtkWidget *pic)
+static void
+formatting_reset_cb(GtkWidget *w, GtkWidget* imhtml) {
+	gboolean bold, italic, uline;
+	bold = italic = uline = FALSE;
+
+	gtk_imhtml_get_current_format(GTK_IMHTML(imhtml), &bold, &italic, &uline);
+	if (bold)
+		gtk_imhtml_toggle_bold(GTK_IMHTML(imhtml));
+	if (italic)
+		gtk_imhtml_toggle_italic(GTK_IMHTML(imhtml));
+	if (uline)
+		gtk_imhtml_toggle_underline(GTK_IMHTML(imhtml));
+
+	gtk_imhtml_font_set_size(GTK_IMHTML(imhtml), 3);
+	gtk_imhtml_toggle_forecolor(GTK_IMHTML(imhtml), NULL);
+	gtk_imhtml_toggle_backcolor(GTK_IMHTML(imhtml), NULL);
+	gtk_imhtml_toggle_fontface(GTK_IMHTML(imhtml), NULL);
+}
+
+static void
+formatting_toggle_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *bah)
 {
-	GdkColor c;
-	GtkStyle *style;
-	GdkColor color;
-
-	c.pixel = 0;
-
-	if (pic == pref_fg_picture) {
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) {
-			gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
-							&color);
-			c.red = color.red;
-			c.blue = color.blue;
-			c.green = color.green;
-		} else {
-			c.red = 0;
-			c.blue = 0;
-			c.green = 0;
-		}
-	} else {
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) {
-			gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
-							&color);
-			c.red = color.red;
-			c.blue = color.blue;
-			c.green = color.green;
-		} else {
-			c.red = 0xffff;
-			c.blue = 0xffff;
-			c.green = 0xffff;
-		}
+	gboolean bold, italic, uline;
+
+	bold = italic = uline = FALSE;
+	gtk_imhtml_get_current_format(GTK_IMHTML(imhtml),
+								  &bold, &italic, &uline);
+
+	if (buttons & GTK_IMHTML_BOLD)
+		gaim_prefs_set_bool("/gaim/gtk/conversations/send_bold", bold);
+	if (buttons & GTK_IMHTML_ITALIC)
+		gaim_prefs_set_bool("/gaim/gtk/conversations/send_italic", italic);
+	if (buttons & GTK_IMHTML_UNDERLINE)
+		gaim_prefs_set_bool("/gaim/gtk/conversations/send_underline", uline);
+
+	if (buttons & GTK_IMHTML_GROW || buttons & GTK_IMHTML_SHRINK)
+		gaim_prefs_set_int("/gaim/gtk/conversations/font_size",
+						   gtk_imhtml_get_current_fontsize(GTK_IMHTML(imhtml)));
+	if (buttons & GTK_IMHTML_FACE) {
+		char *face = gtk_imhtml_get_current_fontface(GTK_IMHTML(imhtml));
+		if (!face)
+			face = g_strdup("");
+
+		gaim_prefs_set_string("/gaim/gtk/conversations/font_face", face);
+		g_free(face);
 	}
 
-	style = gtk_style_new();
-	style->bg[0] = c;
-	gtk_widget_set_style(pic, style);
-	g_object_unref(style);
+	if (buttons & GTK_IMHTML_FORECOLOR) {
+		char *color = gtk_imhtml_get_current_forecolor(GTK_IMHTML(imhtml));
+		if (!color)
+			color = g_strdup("");
+
+		gaim_prefs_set_string("/gaim/gtk/conversations/fgcolor", color);
+		g_free(color);
+	}
+
+	if (buttons & GTK_IMHTML_BACKCOLOR) {
+		char *color = gtk_imhtml_get_current_backcolor(GTK_IMHTML(imhtml));
+		if (!color)
+			color = g_strdup("");
+
+		gaim_prefs_set_string("/gaim/gtk/conversations/bgcolor", color);
+		g_free(color);
+	}
 }
 
 GtkWidget *messages_page() {
 	GtkWidget *ret;
-	GtkWidget *vbox;
+	GtkWidget *vbox, *fontvbox;
 	GtkWidget *imhtml;
 	GtkWidget *toolbar;
 	GtkWidget *sw;
 	GtkWidget *frame;
+	GtkWidget *option;
+	GtkWidget *button;
 
 	ret = gtk_vbox_new(FALSE, 18);
 	gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
@@ -754,28 +779,32 @@
 	gaim_gtk_prefs_checkbox(_("_Highlight misspelled words"),
 			"/gaim/gtk/conversations/spellcheck", vbox);
 #endif
-	gaim_gtk_prefs_checkbox(_("Ignore formatting on incoming messages"),
+	gaim_gtk_prefs_checkbox(_("_Ignore formatting on incoming messages"),
 			"/gaim/gtk/conversations/ignore_formatting", vbox);
 
 	vbox = gaim_gtk_make_frame (ret, _("Default Formatting"));
 
+	option = gaim_gtk_prefs_checkbox(_("_Send default formatting with outgoing messages"),
+									 "/gaim/gtk/conversations/send_formatting", vbox);
+
 	frame = gtk_frame_new(NULL);
 	gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
 	gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
 
-	vbox = gtk_vbox_new(FALSE, 0);
-	gtk_container_add(GTK_CONTAINER(frame), vbox);
+	fontvbox = gtk_vbox_new(FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(frame), fontvbox);
 
 	toolbar = gtk_imhtmltoolbar_new();
-	gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(fontvbox), toolbar, FALSE, FALSE, 0);
 
 	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_NONE);
-	gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
+	gtk_box_pack_start(GTK_BOX(fontvbox), sw, TRUE, TRUE, 0);
 
 	imhtml = gtk_imhtml_new(NULL, NULL);
+	gtk_widget_set_name(imhtml, "gaim_gtkprefs_font_imhtml");
 	gtk_imhtml_set_editable(GTK_IMHTML(imhtml), TRUE);
 	gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), GTK_IMHTML_ALL ^ GTK_IMHTML_IMAGE);
 	gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(imhtml), TRUE);
@@ -787,9 +816,15 @@
 	gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(toolbar), imhtml);
 	gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(toolbar), "default");
 	gaim_setup_imhtml(imhtml);
-	gtk_imhtml_append_text(GTK_IMHTML(imhtml), "This is preview text", 0);
+	gtk_imhtml_append_text(GTK_IMHTML(imhtml), _("This is how your outgoing message text will appear when you use protocols that support formatting. :)"), 0);
 	gtk_container_add(GTK_CONTAINER(sw), imhtml);
 
+	button = gtk_button_new_with_mnemonic("_Clear Formatting");
+	gtk_box_pack_start(GTK_BOX(fontvbox), button, FALSE, FALSE, 0);
+
+	if (!gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting"))
+		gtk_widget_set_sensitive(fontvbox, FALSE);
+
 	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold"))
 		gtk_imhtml_toggle_bold(GTK_IMHTML(imhtml));
 	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic"))
@@ -802,6 +837,15 @@
 	gtk_imhtml_toggle_backcolor(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"));
 	gtk_imhtml_toggle_fontface(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/font_face"));
 
+	g_signal_connect(G_OBJECT(button), "clicked",
+					 G_CALLBACK(formatting_reset_cb), imhtml);
+
+	g_signal_connect(G_OBJECT(option), "clicked",
+					 G_CALLBACK(gaim_gtk_toggle_sensitive), fontvbox);
+
+	g_signal_connect(G_OBJECT(imhtml), "format_function_toggle",
+					 G_CALLBACK(formatting_toggle_cb), NULL);
+
 	gtk_widget_show_all(ret);
 	return ret;
 }
@@ -2700,56 +2744,6 @@
 	gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), default_index);
 }
 
-GtkWidget *pref_fg_picture = NULL;
-GtkWidget *pref_bg_picture = NULL;
-
-void destroy_colorsel(GtkWidget *w, gpointer d)
-{
-	if (d) {
-		gtk_widget_destroy(fgcseld);
-		fgcseld = NULL;
-	} else {
-		gtk_widget_destroy(bgcseld);
-		bgcseld = NULL;
-	}
-}
-
-void apply_color_dlg(GtkWidget *w, gpointer d)
-{
-	char buf[14];
-
-	if (GPOINTER_TO_INT(d) == 1) {
-		GdkColor fgcolor;
-
-		gtk_color_selection_get_current_color(GTK_COLOR_SELECTION
-						      (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel),
-						      &fgcolor);
-
-		g_snprintf(buf, sizeof(buf), "#%04x%04x%04x",
-				   fgcolor.red, fgcolor.green, fgcolor.blue);
-
-		gaim_prefs_set_string("/gaim/gtk/conversations/fgcolor", buf);
-
-		destroy_colorsel(NULL, (void *)1);
-		update_color(NULL, pref_fg_picture);
-	} else {
-		GdkColor bgcolor;
-
-		gtk_color_selection_get_current_color(GTK_COLOR_SELECTION
-						      (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel),
-						      &bgcolor);
-
-		g_snprintf(buf, sizeof(buf), "#%04x%04x%04x",
-				   bgcolor.red, bgcolor.green, bgcolor.blue);
-
-		gaim_prefs_set_string("/gaim/gtk/conversations/bgcolor", buf);
-
-		destroy_colorsel(NULL, (void *)0);
-		update_color(NULL, pref_bg_picture);
-	}
-	gaim_conversation_foreach(gaim_gtkconv_update_font_colors);
-}
-
 void set_default_away(GtkWidget *w, gpointer data)
 {
 	struct away_message *default_away = NULL;
@@ -2769,82 +2763,6 @@
 		gaim_prefs_set_string("/core/away/default_message", "");
 }
 
-#if 0 /* PREFSLASH04 */
-static GtkWidget *show_color_pref(GtkWidget *box, gboolean fgc)
-{
-	/* more stuff stolen from X-Chat */
-	GtkWidget *swid;
-	GdkColor c;
-	GtkStyle *style;
-	c.pixel = 0;
-
-	if (fgc) {
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) {
-			GdkColor fgcolor;
-
-			gdk_color_parse(
-				gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
-				&fgcolor);
-
-			c.red = fgcolor.red;
-			c.blue = fgcolor.blue;
-			c.green = fgcolor.green;
-		} else {
-			c.red = 0;
-			c.blue = 0;
-			c.green = 0;
-		}
-	} else {
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) {
-			GdkColor bgcolor;
-
-			gdk_color_parse(
-				gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
-				&bgcolor);
-
-			c.red = bgcolor.red;
-			c.blue = bgcolor.blue;
-			c.green = bgcolor.green;
-		} else {
-			c.red = 0xffff;
-			c.blue = 0xffff;
-			c.green = 0xffff;
-		}
-	}
-
-	style = gtk_style_new();
-	style->bg[0] = c;
-
-	swid = gtk_event_box_new();
-	gtk_widget_set_style(GTK_WIDGET(swid), style);
-	g_object_unref(style);
-	gtk_widget_set_size_request(GTK_WIDGET(swid), 40, -1);
-	gtk_box_pack_start(GTK_BOX(box), swid, FALSE, FALSE, 5);
-	gtk_widget_show(swid);
-	return swid;
-}
-#endif /* PREFSLASH04 */
-
-void apply_font_dlg(GtkWidget *w, GtkWidget *f)
-{
-	char *fontname, *space;
-
-	fontname =
-		gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(f));
-
-	destroy_fontsel(0, 0);
-
-	space = strrchr(fontname, ' ');
-	if(space && isdigit(*(space+1)))
-		*space = '\0';
-
-	gaim_prefs_set_string("/gaim/gtk/conversations/font_face", fontname);
-
-	g_free(fontname);
-
-	gaim_conversation_foreach(gaim_gtkconv_update_font_face);
-}
-
 static void
 smiley_theme_pref_cb(const char *name, GaimPrefType type, gpointer value,
 					 gpointer data)
@@ -2906,6 +2824,9 @@
 	gaim_prefs_rename("/core/conversations/placement",
 					  "/gaim/gtk/conversations/placement");
 
+	gaim_prefs_rename("/gaim/gtk/conversations/use_custom_font",
+					  "/gaim/gtk/conversations/send_formatting");
+
 	/* Remove some no-longer-used prefs */
 	gaim_prefs_remove("/gaim/gtk/blist/show_group_count");
 	gaim_prefs_remove("/gaim/gtk/conversations/icons_on_tabs");
@@ -2919,4 +2840,7 @@
 	gaim_prefs_remove("/gaim/gtk/sound/signon");
 	gaim_prefs_remove("/gaim/gtk/sound/silent_signon");
 	gaim_prefs_remove("/gaim/gtk/logging/individual_logs");
+	gaim_prefs_remove("/gaim/gtk/conversations/use_custom_bgcolor");
+	gaim_prefs_remove("/gaim/gtk/conversations/use_custom_fgcolor");
+	gaim_prefs_remove("/gaim/gtk/conversations/use_custom_size");
 }
--- a/src/gtkutils.c	Sun May 23 02:42:01 2004 +0000
+++ b/src/gtkutils.c	Sun May 23 03:54:20 2004 +0000
@@ -875,59 +875,58 @@
 	buf = g_malloc(length);
 	g_snprintf(buf, length, "%s", text);
 
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) {
-		g_snprintf(tmp, length, "<B>%s</B>", buf);
-		strcpy(buf, tmp);
-	}
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting")) {
+		const char *font;
+		GdkColor fg_color, bg_color;
 
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) {
-		g_snprintf(tmp, length, "<I>%s</I>", buf);
-		strcpy(buf, tmp);
-	}
+		if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) {
+			g_snprintf(tmp, length, "<B>%s</B>", buf);
+			strcpy(buf, tmp);
+		}
 
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) {
-		g_snprintf(tmp, length, "<U>%s</U>", buf);
-		strcpy(buf, tmp);
-	}
-
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font")) {
-		const char *fontface;
+		if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) {
+			g_snprintf(tmp, length, "<I>%s</I>", buf);
+			strcpy(buf, tmp);
+		}
 
-		fontface = gaim_prefs_get_string("/gaim/gtk/conversations/font_face");
+		if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) {
+			g_snprintf(tmp, length, "<U>%s</U>", buf);
+			strcpy(buf, tmp);
+		}
 
-		g_snprintf(tmp, length, "<FONT FACE=\"%s\">%s</FONT>", fontface, buf);
-		strcpy(buf, tmp);
-	}
+		font = gaim_prefs_get_string("/gaim/gtk/conversations/font_face");
 
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) {
-		int fontsize = gaim_prefs_get_int("/gaim/gtk/conversations/font_size");
+		if (strcmp(font, "") != 0) {
+			g_snprintf(tmp, length, "<FONT FACE=\"%s\">%s</FONT>", font, buf);
+			strcpy(buf, tmp);
+		}
 
-		g_snprintf(tmp, length, "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf);
+		g_snprintf(tmp, length, "<FONT SIZE=\"%d\">%s</FONT>",
+			gaim_prefs_get_int("/gaim/gtk/conversations/font_size"), buf);
 		strcpy(buf, tmp);
-	}
 
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) {
-		GdkColor fgcolor;
-
-		gdk_color_parse(
-			gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
-			&fgcolor);
+		if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0)
+		{
+			gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
+							&fg_color);
 
-		g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>",
-				   fgcolor.red/256, fgcolor.green/256, fgcolor.blue/256, buf);
-		strcpy(buf, tmp);
-	}
-
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) {
-		GdkColor bgcolor;
+			g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>",
+					   fg_color.red/256, fg_color.green/256,
+					   fg_color.blue/256, buf);
+			strcpy(buf, tmp);
+		}
 
-		gdk_color_parse(
-			gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
-			&bgcolor);
+		if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0)
+		{
+			gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
+							&bg_color);
 
-		g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>",
-				   bgcolor.red/256, bgcolor.green/256, bgcolor.blue/256, buf);
-		strcpy(buf, tmp);
+			g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>",
+					   bg_color.red/256, bg_color.green/256,
+					   bg_color.blue/256, buf);
+			strcpy(buf, tmp);
+		}
+
 	}
 
 	g_free(tmp);