[Patch] for ay_msn_format_message() to add colour to message body

Alagunambi Welkin <[email protected]> Thu, 29 Oct 2009 15:49:44 -0400
Newsgroups gmane.network.instant-messaging.ayttm.user
Message-ID <[email protected]>
Hi,

This is my first patch :-)

Patch for adding colour to the message body.

Correct me if I am wrong, Ill be happy to learn.

<patch>

From: Alagunambi Welkin <[email protected]>
Date: Thu, 29 Oct 01:15:24 IST 2009

Patch for ay_msn_format_message() to add colour to the body.

Index: trunk/modules/msn2/msn.c
------------------------------------------------------------------------
--- ayttm/modules/msn2/msn.c    2009-10-28 13:34:10.000000000 -0400
+++ work/modules/msn2/msn.c    2009-10-29 19:02:04.000000000 -0400
@@ -2110,8 +2110,49 @@ static void ay_msn_format_message(MsnIM
         retval = g_strdup_printf("<b>%s</b>", msg->body);
     if (msg->underline)
         retval = g_strdup_printf("<u>%s</u>", msg->body);
+
+    switch (msg->color) {
+    case black:
+        retval = g_strdup_printf("<font color=#000000>"%s"</font>",
+                    msg->body);
+        break;
+    case blue:
+        retval = g_strdup_printf("<font color=#000080>"%s"</font>",
+                    msg->body);
+        break;
+    case lblue:
+        retval = g_strdup_printf("<font color=#0000c0>"%s"</font>",
+                    msg->body);
+        break;
+    case gray:
+        retval = g_strdup_printf("<font color=#808080>"%s"</font>",
+                    msg->body);
+        break;
+    case green:
+        retval = g_strdup_printf("<font color=#008000>"%s"</font>",
+                    msg->body);
+        break;
+    case pink:
+        retval = g_strdup_printf("<font color=#c000c0>"%s"</font>",
+                    msg->body);
+        break;
+    case purple:
+        retval = g_strdup_printf("<font color=#800080>"%s"</font>",
+                    msg->body);
+        break;
+    case orange:
+        retval = g_strdup_printf("<font color=#f95002>"%s"</font>",
+                    msg->body);
+        break;
+    case red:
+        retval = g_strdup_printf("<font color=#800000>"%s"</font>",
+                    msg->body);
+        break;
+    case olive:
+        retval = g_strdup_printf("<font color=#00c000>"%s"</font>",
+                    msg->body);
+        break;
     /* todo: other formatting fields
-     * CO: color - color IS in HTML colour format (RGB hex)
      * CS: ? (haven't the faintest - Meredydd)
      * PF: ? (ditto)
      */

</patch>

Thanks ;-)
Alagunambi Welkin

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

_______________________________________________
Ayttm-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ayttm-users
ayttm_msn2.c_msg_format_color.patch (text/x-diff, 1.8 KB)
From: Alagunambi Welkin <[email protected]>
Date: Thu, 29 Oct 01:15:24 IST 2009

Patch for ay_msn_format_message() to add colour to the body.

Index: trunk/modules/msn2/msn.c
------------------------------------------------------------------------
--- ayttm/modules/msn2/msn.c	2009-10-28 13:34:10.000000000 -0400
+++ work/modules/msn2/msn.c	2009-10-29 19:02:04.000000000 -0400
@@ -2110,8 +2110,49 @@ static void ay_msn_format_message(MsnIM 
 		retval = g_strdup_printf("<b>%s</b>", msg->body);
 	if (msg->underline)
 		retval = g_strdup_printf("<u>%s</u>", msg->body);
+	
+	switch (msg->color) {
+	case black:
+		retval = g_strdup_printf("<font color=#000000>"%s"</font>", 
+					msg->body);
+		break;
+	case blue:
+		retval = g_strdup_printf("<font color=#000080>"%s"</font>",
+					msg->body);
+		break;
+	case lblue:
+		retval = g_strdup_printf("<font color=#0000c0>"%s"</font>",
+					msg->body);
+		break;
+	case gray:
+		retval = g_strdup_printf("<font color=#808080>"%s"</font>",
+					msg->body);
+		break;
+	case green:
+		retval = g_strdup_printf("<font color=#008000>"%s"</font>",
+					msg->body);
+		break;
+	case pink:
+		retval = g_strdup_printf("<font color=#c000c0>"%s"</font>",
+					msg->body);
+		break;
+	case purple:
+		retval = g_strdup_printf("<font color=#800080>"%s"</font>",
+					msg->body);
+		break;
+	case orange:
+		retval = g_strdup_printf("<font color=#f95002>"%s"</font>",
+					msg->body);
+		break;
+	case red:
+		retval = g_strdup_printf("<font color=#800000>"%s"</font>",
+					msg->body);
+		break;
+	case olive:
+		retval = g_strdup_printf("<font color=#00c000>"%s"</font>",
+					msg->body);
+		break;
 	/* todo: other formatting fields
-	 * CO: color - color IS in HTML colour format (RGB hex)
 	 * CS: ? (haven't the faintest - Meredydd)
 	 * PF: ? (ditto)
 	 */