Mercurial > pidgin.yaz
diff pidgin/gtkconv.c @ 27094:af4a4ebc6441
Add a utlity function purple_markup_is_rtl
Use this function to check for RTL text in messages. Fixes #9261.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 03 Jun 2009 17:04:05 +0000 |
parents | bf3ad70508f4 |
children | 01f1929d0936 e0c0b4eb36ed fb593c327870 42c64c41cf87 |
line wrap: on
line diff
--- a/pidgin/gtkconv.c Wed Jun 03 15:50:08 2009 +0000 +++ b/pidgin/gtkconv.c Wed Jun 03 17:04:05 2009 +0000 @@ -5629,38 +5629,6 @@ #endif } -/* Returns true if the given HTML contains RTL text */ -static gboolean -html_is_rtl(const char *html) -{ - GData *attributes; - const gchar *start, *end; - gboolean res = FALSE; - - if (purple_markup_find_tag("span", html, &start, &end, &attributes)) - { - /* tmp is a member of attributes and is free with g_datalist_clear call */ - const char *tmp = g_datalist_get_data(&attributes, "dir"); - if (tmp && !g_ascii_strcasecmp(tmp, "RTL")) - res = TRUE; - if (!res) - { - tmp = g_datalist_get_data(&attributes, "style"); - if (tmp) - { - char *tmp2 = purple_markup_get_css_property(tmp, "direction"); - if (tmp2 && !g_ascii_strcasecmp(tmp2, "RTL")) - res = TRUE; - g_free(tmp2); - } - - } - g_datalist_clear(&attributes); - } - return res; -} - - static void pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *alias, const char *message, PurpleMessageFlags flags, @@ -5822,7 +5790,7 @@ } /* Bi-Directional support - set timestamp direction using unicode characters */ - is_rtl_message = html_is_rtl(message); + is_rtl_message = purple_markup_is_rtl(message); /* Enforce direction only if message is RTL - doesn't effect LTR users */ if (is_rtl_message) str_embed_direction_chars(&mdate);