pidgin: b09ff621: Strip off the outer <html> and <body> fr...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Wed Aug 26 02:01:15 EDT 2009


-----------------------------------------------------------------
Revision: b09ff62192fe7c44793b7aebbae3814fb649671d
Ancestor: 22cbd3e44c758f0db317d5684626ff755de0a07e
Author: darkrain42 at pidgin.im
Date: 2009-08-26T05:55:25
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b09ff62192fe7c44793b7aebbae3814fb649671d

Modified files:
        libpurple/protocols/oscar/oscar.c

ChangeLog: 

Strip off the outer <html> and <body> from iChat messages. Should Fix #9968.

A recent fix in purple_markup_strip_html exposed an issue with iChat
messages, since they contain an <html/> that is not the outermost element.

Before, what was passed to libpurple looked like this:
<font back="#E68CBD"><font color="#000000"><html><body ichatballooncolor="#E68CBD" ichattextcolor="#000000"><font face="Helvetica" ABSZ=12 color="#000000">message</font></body></html></font></font>

Now, it looks like this:
<font back="#E68CBD"><font color="#000000"><font face="Helvetica" ABSZ=12 color="#000000">message</font></font></font>

Better than it was before? Yes.
Worth fixing the fact there are 3 font tags? Probably not.

My iChat friend is offline, but it worked properly when I tested this
routine all by itself.

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c	9fc25e45fb34b31155f6187f83011c09f5f593ed
+++ libpurple/protocols/oscar/oscar.c	bd6e9141aed032101cc2031cf3601bef28e73af1
@@ -2405,7 +2405,22 @@ static int incomingim_chan1(OscarData *o
 	if (purple_markup_find_tag("body", tmp, &start, &end, &attribs))
 	{
 		const char *ichattextcolor, *ichatballooncolor;
+		const char *start2, *end2;
+		GData *unused;
 
+		/*
+		 * Find the ending </body> so we can strip off the outer <html/>
+		 * and <body/>
+		 */
+		if (purple_markup_find_tag("/body", end + 1, &start2, &end2, &unused))
+		{
+			gchar *tmp2;
+			tmp2 = g_strndup(end + 1, (start2 - 1) - (end + 1) + 1);
+			g_free(tmp);
+			tmp = tmp2;
+			g_datalist_clear(&unused);
+		}
+
 		ichattextcolor = g_datalist_get_data(&attribs, "ichattextcolor");
 		if (ichattextcolor != NULL)
 		{


More information about the Commits mailing list