# HG changeset patch
# User Tim Ringenbach <marv@pidgin.im>
# Date 1104436249 0
# Node ID 0c020a10d5da8c53b6042262e1a00efccb7fbdb1
# Parent  d23802800eeb98b7a56990648b2a7aa2b52c7fab
[gaim-migrate @ 11725]
Richard Laager writes:
 This patch fixes a bug with the CSS handling in gtkimhtml
 involving whitespace handling. Basically, it would accept things
 like: "color: #FFFFFF" but not "color:#FFFFFF" or "color:
 #FFFFFF" (more than one space). Really only the case without
 spaces is of concern to me. However, I followed the coding
 techniques of the rest of that section of code so it will end up
 accepting multiple spaces as beneficial side effect.

When questioned as to why he needed this, he responded:
 I wrote a plug-in to parse XML message histories from the official
 MSN client. The styles saved in that file had no whitespace.
 Initially I wrote a workaround in the plug-in, but I wanted to fix
 the problem at the source.

committer: Tailor Script <tailor@pidgin.im>

diff -r d23802800eeb -r 0c020a10d5da COPYRIGHT
--- a/COPYRIGHT	Thu Dec 30 19:32:08 2004 +0000
+++ b/COPYRIGHT	Thu Dec 30 19:50:49 2004 +0000
@@ -91,6 +91,7 @@
 Gary Kramlich
 Patrik Kullman
 Tero Kuusela
+Richard Laager
 Scott Lamb
 Dennis Lambe Jr.
 Joe LaPenna
diff -r d23802800eeb -r 0c020a10d5da src/gtkimhtml.c
--- a/src/gtkimhtml.c	Thu Dec 30 19:32:08 2004 +0000
+++ b/src/gtkimhtml.c	Thu Dec 30 19:50:49 2004 +0000
@@ -1851,6 +1851,9 @@
 
 	if (!g_ascii_strncasecmp (t, opt, strlen (opt))) {
 		t += strlen (opt);
+		while (*t && (*t == ' ')) t++;
+		if (!*t)
+			return NULL;
 	} else {
 		return NULL;
 	}
@@ -2383,12 +2386,12 @@
 
 						if (!style) break;
 
-						color = gtk_imhtml_get_css_opt (style, "color: ");
-						background = gtk_imhtml_get_css_opt (style, "background: ");
+						color = gtk_imhtml_get_css_opt (style, "color:");
+						background = gtk_imhtml_get_css_opt (style, "background:");
 						family = gtk_imhtml_get_css_opt (style,
-							"font-family: ");
-						size = gtk_imhtml_get_css_opt (style, "font-size: ");
-						textdec = gtk_imhtml_get_css_opt (style, "text-decoration: ");
+							"font-family:");
+						size = gtk_imhtml_get_css_opt (style, "font-size:");
+						textdec = gtk_imhtml_get_css_opt (style, "text-decoration:");
 
 						if (!(color || family || size || background || textdec)) {
 							g_free(style);