# HG changeset patch
# User Stu Tomlinson <stu@nosnilmot.com>
# Date 1178914017 0
# Node ID 53e757c37e06791e5a4b54fc4b536fabf8eb2d3d
# Parent  8ad7750b039132102e423de603fee1b4619c5079
Ignore bold, underline and other formatting type things in SPAN tags if
"Show formatting on incoming messages" is turned off. This makes handling
of these things consistent with other formatting tags.

Fixes #520.

diff -r 8ad7750b0391 -r 53e757c37e06 pidgin/gtkimhtml.c
--- a/pidgin/gtkimhtml.c	Fri May 11 17:05:59 2007 +0000
+++ b/pidgin/gtkimhtml.c	Fri May 11 20:06:57 2007 +0000
@@ -2761,7 +2761,8 @@
 						}
 						if (textdec && font->underline != 1
 							&& g_ascii_strcasecmp(textdec, "underline") == 0
-							&& (imhtml->format_functions & GTK_IMHTML_UNDERLINE))
+							&& (imhtml->format_functions & GTK_IMHTML_UNDERLINE)
+							&& !(options & GTK_IMHTML_NO_FORMATTING))
 						{
 						    gtk_imhtml_toggle_underline(imhtml);
 						    font->underline = 1;
@@ -2790,7 +2791,7 @@
 								else
 									font->bold = 0;
 							}
-							if ((font->bold && oldfont && !oldfont->bold) || (oldfont && oldfont->bold && !font->bold) || (font->bold && !oldfont))
+							if (((font->bold && oldfont && !oldfont->bold) || (oldfont && oldfont->bold && !font->bold) || (font->bold && !oldfont)) && !(options & GTK_IMHTML_NO_FORMATTING))
 							{
 								gtk_imhtml_toggle_bold(imhtml);
 							}
@@ -2816,33 +2817,36 @@
 
 						if (!oldfont) {
 							gtk_imhtml_font_set_size(imhtml, 3);
-							if (font->underline)
+							if (font->underline && !(options & GTK_IMHTML_NO_FORMATTING))
 							    gtk_imhtml_toggle_underline(imhtml);
-							if (font->bold)
+							if (font->bold && !(options & GTK_IMHTML_NO_FORMATTING))
 								gtk_imhtml_toggle_bold(imhtml);
-							gtk_imhtml_toggle_fontface(imhtml, NULL);
-							gtk_imhtml_toggle_forecolor(imhtml, NULL);
-							gtk_imhtml_toggle_backcolor(imhtml, NULL);
+							if (!(options & GTK_IMHTML_NO_FONTS))
+								gtk_imhtml_toggle_fontface(imhtml, NULL);
+							if (!(options & GTK_IMHTML_NO_COLOURS))
+								gtk_imhtml_toggle_forecolor(imhtml, NULL);
+							if (!(options & GTK_IMHTML_NO_COLOURS))
+								gtk_imhtml_toggle_backcolor(imhtml, NULL);
 						}
 						else
 						{
 
-						    if (font->size != oldfont->size)
+						    if ((font->size != oldfont->size) && !(options & GTK_IMHTML_NO_SIZES))
 							    gtk_imhtml_font_set_size(imhtml, oldfont->size);
 
-							if (font->underline != oldfont->underline)
+							if ((font->underline != oldfont->underline) && !(options & GTK_IMHTML_NO_FORMATTING))
 							    gtk_imhtml_toggle_underline(imhtml);
 
-							if ((font->bold && !oldfont->bold) || (oldfont->bold && !font->bold))
+							if (((font->bold && !oldfont->bold) || (oldfont->bold && !font->bold)) && !(options & GTK_IMHTML_NO_FORMATTING))
 								gtk_imhtml_toggle_bold(imhtml);
 
-							if (font->face && (!oldfont->face || strcmp(font->face, oldfont->face) != 0))
+							if (font->face && (!oldfont->face || strcmp(font->face, oldfont->face) != 0) && !(options & GTK_IMHTML_NO_FONTS))
 							    gtk_imhtml_toggle_fontface(imhtml, oldfont->face);
 
-							if (font->fore && (!oldfont->fore || strcmp(font->fore, oldfont->fore) != 0))
+							if (font->fore && (!oldfont->fore || strcmp(font->fore, oldfont->fore) != 0) && !(options & GTK_IMHTML_NO_COLOURS))
 							    gtk_imhtml_toggle_forecolor(imhtml, oldfont->fore);
 
-							if (font->back && (!oldfont->back || strcmp(font->back, oldfont->back) != 0))
+							if (font->back && (!oldfont->back || strcmp(font->back, oldfont->back) != 0) && !(options & GTK_IMHTML_NO_COLOURS))
 						      gtk_imhtml_toggle_backcolor(imhtml, oldfont->back);
 						}