changeset 30044:41142f2bcafb

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.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 26 Mar 2010 03:37:11 +0000
parents 72fd8c6144a2
children 07a2ae40ee55
files libpurple/util.c
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/util.c	Thu Mar 25 15:49:43 2010 +0000
+++ b/libpurple/util.c	Fri Mar 26 03:37:11 2010 +0000
@@ -1957,13 +1957,14 @@
 					}
 				}
 
-				/* 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';