comparison libpurple/util.c @ 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 05d727f76ca9
children 70b0f46f2966 4e5cfb6ad471 983a04639c2b
comparison
equal deleted inserted replaced
30043:72fd8c6144a2 30044:41142f2bcafb
1955 g_free(href); 1955 g_free(href);
1956 href = NULL; 1956 href = NULL;
1957 } 1957 }
1958 } 1958 }
1959 1959
1960 /* Check for tags which should be mapped to newline */ 1960 /* Check for tags which should be mapped to newline (but ignore some of
1961 else if (g_ascii_strncasecmp(str2 + i, "<p>", 3) == 0 1961 * the tags at the beginning of the text) */
1962 || g_ascii_strncasecmp(str2 + i, "<tr", 3) == 0 1962 else if ((j && (g_ascii_strncasecmp(str2 + i, "<p>", 3) == 0
1963 || g_ascii_strncasecmp(str2 + i, "<tr", 3) == 0
1964 || g_ascii_strncasecmp(str2 + i, "<hr", 3) == 0
1965 || g_ascii_strncasecmp(str2 + i, "<li", 3) == 0
1966 || g_ascii_strncasecmp(str2 + i, "<div", 4) == 0))
1963 || g_ascii_strncasecmp(str2 + i, "<br", 3) == 0 1967 || g_ascii_strncasecmp(str2 + i, "<br", 3) == 0
1964 || g_ascii_strncasecmp(str2 + i, "<hr", 3) == 0
1965 || g_ascii_strncasecmp(str2 + i, "<li", 3) == 0
1966 || g_ascii_strncasecmp(str2 + i, "<div", 4) == 0
1967 || g_ascii_strncasecmp(str2 + i, "</table>", 8) == 0) 1968 || g_ascii_strncasecmp(str2 + i, "</table>", 8) == 0)
1968 { 1969 {
1969 str2[j++] = '\n'; 1970 str2[j++] = '\n';
1970 } 1971 }
1971 /* Check for tags which begin CDATA and need to be closed */ 1972 /* Check for tags which begin CDATA and need to be closed */