changeset 12675:323af3853ed5

[gaim-migrate @ 15018] fix sf bug #1252921, show iChat foreground and background color tags committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 29 Dec 2005 19:01:48 +0000
parents 00e1a81307b2
children 87e95b8ce60b
files src/protocols/oscar/oscar.c
diffstat 1 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Thu Dec 29 17:44:08 2005 +0000
+++ b/src/protocols/oscar/oscar.c	Thu Dec 29 19:01:48 2005 +0000
@@ -3907,6 +3907,9 @@
 	GString *message;
 	gchar *tmp;
 	aim_mpmsg_section_t *curpart;
+	const char *start;
+	const char *end;
+	GData *attribs;
 
 	gaim_debug_misc("oscar", "Received IM from %s with %d parts\n",
 					userinfo->sn, args->mpmsg.numparts);
@@ -3972,7 +3975,7 @@
 	curpart = args->mpmsg.parts;
 	while (curpart != NULL) {
 		tmp = gaim_plugin_oscar_decode_im_part(account, userinfo->sn, curpart->charset,
--				curpart->charsubset, curpart->data, curpart->datalen);
+				curpart->charsubset, curpart->data, curpart->datalen);
 		if (tmp != NULL) {
 			g_string_append(message, tmp);
 			g_free(tmp);
@@ -4001,6 +4004,34 @@
 		tmp = tmp2;
 	}
 
+	/*
+	 * Convert iChat color tags to normal font tags.
+	 */
+	if (gaim_markup_find_tag("body", tmp, &start, &end, &attribs))
+	{
+		const char *ichattextcolor, *ichatballooncolor;
+
+		ichattextcolor = g_datalist_get_data(&attribs, "ichattextcolor");
+		if (ichattextcolor != NULL)
+		{
+			gchar *tmp2;
+			tmp2 = g_strdup_printf("<font color=\"%s\">%s</font>", ichattextcolor, tmp);
+			g_free(tmp);
+			tmp = tmp2;
+		}
+
+		ichatballooncolor = g_datalist_get_data(&attribs, "ichatballooncolor");
+		if (ichatballooncolor != NULL)
+		{
+			gchar *tmp2;
+			tmp2 = g_strdup_printf("<font back=\"%s\">%s</font>", ichatballooncolor, tmp);
+			g_free(tmp);
+			tmp = tmp2;
+		}
+
+		g_datalist_clear(&attribs);
+	}
+
 	serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL));
 	g_free(tmp);