pidgin: 836d1a5a: Ignore some tags at the beginning of a m...

sadrul at pidgin.im sadrul at pidgin.im
Thu Mar 25 23:50:41 EDT 2010


-----------------------------------------------------------------
Revision: 836d1a5ae8587599257d08962d2e285748137665
Ancestor: 25f95fb2f47b70980b79422c9a02be98eed376f7
Author: sadrul at pidgin.im
Date: 2010-03-26T03:37:11
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/836d1a5ae8587599257d08962d2e285748137665

Modified files:
        libpurple/util.c

ChangeLog: 

Ignore some tags at the beginning of a message.

This change ignores some tags (e.g. <p>, <li> etc.) and does not convert
them to newline when they are at the beginning of a message. This fixes
an issue in finch where some messages show up with a newline at the
front.

-------------- next part --------------
============================================================
--- libpurple/util.c	bdfd6f3c4e0d3bbd079fb9d289172318aa47fa9e
+++ libpurple/util.c	6b3c2336667fcf9469f246fd24c1b90afc589d2c
@@ -1957,13 +1957,14 @@ purple_markup_strip_html(const char *str
 					}
 				}
 
-				/* Check for tags which should be mapped to newline */
-				else if (g_ascii_strncasecmp(str2 + i, "<p>", 3) == 0
-				 || g_ascii_strncasecmp(str2 + i, "<tr", 3) == 0
+				/* Check for tags which should be mapped to newline (but ignore some of
+				 * the tags at the beginning of the text) */
+				else if ((j && (g_ascii_strncasecmp(str2 + i, "<p>", 3) == 0
+				              || g_ascii_strncasecmp(str2 + i, "<tr", 3) == 0
+				              || g_ascii_strncasecmp(str2 + i, "<hr", 3) == 0
+				              || g_ascii_strncasecmp(str2 + i, "<li", 3) == 0
+				              || g_ascii_strncasecmp(str2 + i, "<div", 4) == 0))
 				 || g_ascii_strncasecmp(str2 + i, "<br", 3) == 0
-				 || g_ascii_strncasecmp(str2 + i, "<hr", 3) == 0
-				 || g_ascii_strncasecmp(str2 + i, "<li", 3) == 0
-				 || g_ascii_strncasecmp(str2 + i, "<div", 4) == 0
 				 || g_ascii_strncasecmp(str2 + i, "</table>", 8) == 0)
 				{
 					str2[j++] = '\n';


More information about the Commits mailing list