diff pidgin/plugins/convcolors.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 ea62e934c80b
children 4e7a9940627e
line wrap: on
line diff
--- a/pidgin/plugins/convcolors.c	Wed Jun 03 15:50:08 2009 +0000
+++ b/pidgin/plugins/convcolors.c	Wed Jun 03 17:04:05 2009 +0000
@@ -101,6 +101,7 @@
 	gboolean bold, italic, underline;
 	int f;
 	const char *color;
+	gboolean rtl = FALSE;
 
 	for (i = 0; formats[i].prefix; i++)
 		if (flags & formats[i].flag)
@@ -126,6 +127,7 @@
 	bold = (f & FONT_BOLD);
 	italic = (f & FONT_ITALIC);
 	underline = (f & FONT_UNDERLINE);
+	rtl = purple_markup_is_rtl(*displaying);
 
 	if (purple_prefs_get_bool(PREF_IGNORE))
 	{
@@ -156,11 +158,13 @@
 	}
 
 	t = *displaying;
-	*displaying = g_strdup_printf("%s%s%s%s%s%s%s",
+	*displaying = g_strdup_printf("%s%s%s%s%s%s%s%s%s",
 						bold ? "<B>" : "</B>",
 						italic ? "<I>" : "</I>",
 						underline ? "<U>" : "</U>",
-						t, 
+						rtl ? "<SPAN style=\"direction:rtl;text-align:right;\">" : "",
+						t,
+						rtl ? "</SPAN>" : "",
 						bold ? "</B>" : "<B>",
 						italic ? "</I>" : "<I>",
 						underline ? "</U>" : "<U>"