changeset 24760:e12788365764

Support for background font colors in incoming MySpace IMs
author Mark Doliner <mark@kingant.net>
date Wed, 17 Dec 2008 04:37:21 +0000
parents 41f5dff0059f
children c2054d8d23fc
files ChangeLog libpurple/protocols/myspace/markup.c
diffstat 2 files changed, 25 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Dec 17 04:12:04 2008 +0000
+++ b/ChangeLog	Wed Dec 17 04:37:21 2008 +0000
@@ -57,6 +57,7 @@
 	* Fix a bug where buddies didn't appear in their correct groups the
 	  first time you sign into your account (Mark Doliner)
 	* Support for foreground and background font colors in outgoing IMs
+	* Support for background font colors in incoming IMs
 
 	SIMPLE:
 	* Fix a crash when a malformed message is received.
--- a/libpurple/protocols/myspace/markup.c	Wed Dec 17 04:12:04 2008 +0000
+++ b/libpurple/protocols/myspace/markup.c	Wed Dec 17 04:37:21 2008 +0000
@@ -294,7 +294,9 @@
 	*end = g_strdup("</p>");
 }
 
-/** Convert the msim markup <c> tag (text color) into HTML. TODO: Test */
+/**
+ * Convert the msim markup <c> tag (text color) into HTML.
+ */
 static void
 msim_markup_c_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end)
 {
@@ -312,15 +314,20 @@
 
 	purple_color = msim_color_to_purple(color);
 
+#ifdef USE_CSS_FORMATTING
+	*begin = g_strdup_printf("<span style='color: %s'>", purple_color);
+	*end = g_strdup("</span>");
+#else
 	*begin = g_strdup_printf("<font color='%s'>", purple_color);
+	*end = g_strdup("</font>");
+#endif
 
 	g_free(purple_color);
-
-	/* *begin = g_strdup_printf("<span style='color: %s'>", color); */
-	*end = g_strdup("</font>");
 }
 
-/** Convert the msim markup <b> tag (background color) into HTML. TODO: Test */
+/**
+ * Convert the msim markup <b> tag (background color) into HTML.
+ */
 static void
 msim_markup_b_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end)
 {
@@ -338,12 +345,15 @@
 
 	purple_color = msim_color_to_purple(color);
 
-	/* TODO: find out how to set background color. */
-	*begin = g_strdup_printf("<span style='background-color: %s'>",
-			purple_color);
+#ifdef USE_CSS_FORMATTING
+	*begin = g_strdup_printf("<span style='background-color: %s'>", purple_color);
+	*end = g_strdup("</span>");
+#else
+	*begin = g_strdup_printf("<body bgcolor='%s'>", purple_color);
+	*end = g_strdup("</body>");
+#endif
+
 	g_free(purple_color);
-
-	*end = g_strdup("</p>");
 }
 
 /** Convert the msim markup <i> tag (emoticon image) into HTML. */
@@ -696,7 +706,8 @@
 	return new;
 }
 
-/** High-level function to convert MySpaceIM markup to Purple (HTML) markup.
+/**
+ * High-level function to convert MySpaceIM markup to Purple (HTML) markup.
  *
  * @return Purple markup string, must be g_free()'d. */
 gchar *
@@ -705,7 +716,8 @@
 	return msim_convert_xml(session, raw, msim_markup_tag_to_html);
 }
 
-/** High-level function to convert Purple (HTML) to MySpaceIM markup.
+/**
+ * High-level function to convert Purple (HTML) to MySpaceIM markup.
  *
  * TODO: consider using purple_markup_html_to_xhtml() to make valid XML.
  *