Mercurial > pidgin.yaz
comparison pidgin/gtkconv.c @ 29687:42c64c41cf87
propagate from branch 'im.pidgin.pidgin' (head 46523386d682c917679b3de662d51a5bda0da46b)
to branch 'im.pidgin.cpw.attention_ui' (head 39d8ac60b05e7766f90db850144c9e963076cec9)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Mon, 08 Jun 2009 18:28:31 +0000 |
parents | 33b81994d74c af4a4ebc6441 |
children | 8b17877d3294 |
comparison
equal
deleted
inserted
replaced
29686:33b81994d74c | 29687:42c64c41cf87 |
---|---|
5650 g_free(*str); | 5650 g_free(*str); |
5651 *str = ret; | 5651 *str = ret; |
5652 #endif | 5652 #endif |
5653 } | 5653 } |
5654 | 5654 |
5655 /* Returns true if the given HTML contains RTL text */ | |
5656 static gboolean | |
5657 html_is_rtl(const char *html) | |
5658 { | |
5659 GData *attributes; | |
5660 const gchar *start, *end; | |
5661 gboolean res = FALSE; | |
5662 | |
5663 if (purple_markup_find_tag("span", html, &start, &end, &attributes)) | |
5664 { | |
5665 /* tmp is a member of attributes and is free with g_datalist_clear call */ | |
5666 const char *tmp = g_datalist_get_data(&attributes, "dir"); | |
5667 if (tmp && !g_ascii_strcasecmp(tmp, "RTL")) | |
5668 res = TRUE; | |
5669 if (!res) | |
5670 { | |
5671 tmp = g_datalist_get_data(&attributes, "style"); | |
5672 if (tmp) | |
5673 { | |
5674 char *tmp2 = purple_markup_get_css_property(tmp, "direction"); | |
5675 if (tmp2 && !g_ascii_strcasecmp(tmp2, "RTL")) | |
5676 res = TRUE; | |
5677 g_free(tmp2); | |
5678 } | |
5679 | |
5680 } | |
5681 g_datalist_clear(&attributes); | |
5682 } | |
5683 return res; | |
5684 } | |
5685 | |
5686 | |
5687 static void | 5655 static void |
5688 pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *alias, | 5656 pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *alias, |
5689 const char *message, PurpleMessageFlags flags, | 5657 const char *message, PurpleMessageFlags flags, |
5690 time_t mtime) | 5658 time_t mtime) |
5691 { | 5659 { |
5843 tmp = purple_time_format(tm); | 5811 tmp = purple_time_format(tm); |
5844 mdate = g_strdup_printf("(%s)", tmp); | 5812 mdate = g_strdup_printf("(%s)", tmp); |
5845 } | 5813 } |
5846 | 5814 |
5847 /* Bi-Directional support - set timestamp direction using unicode characters */ | 5815 /* Bi-Directional support - set timestamp direction using unicode characters */ |
5848 is_rtl_message = html_is_rtl(message); | 5816 is_rtl_message = purple_markup_is_rtl(message); |
5849 /* Enforce direction only if message is RTL - doesn't effect LTR users */ | 5817 /* Enforce direction only if message is RTL - doesn't effect LTR users */ |
5850 if (is_rtl_message) | 5818 if (is_rtl_message) |
5851 str_embed_direction_chars(&mdate); | 5819 str_embed_direction_chars(&mdate); |
5852 | 5820 |
5853 if (mtime >= gtkconv->newday) | 5821 if (mtime >= gtkconv->newday) |