changeset 10457:0c020a10d5da

[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>
author Tim Ringenbach <marv@pidgin.im>
date Thu, 30 Dec 2004 19:50:49 +0000
parents d23802800eeb
children ad9258716144
files COPYRIGHT src/gtkimhtml.c
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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);