Mercurial > pidgin.yaz
changeset 24758:9a5a201e69a3
Add support for foreground and background font colors in MySpace IMs
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 17 Dec 2008 04:02:25 +0000 |
parents | cd0071208174 |
children | 41f5dff0059f |
files | ChangeLog libpurple/protocols/myspace/markup.c |
diffstat | 2 files changed, 31 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Dec 17 03:37:59 2008 +0000 +++ b/ChangeLog Wed Dec 17 04:02:25 2008 +0000 @@ -56,6 +56,7 @@ * Add support for blocking buddies (Mark Doliner) * 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 SIMPLE: * Fix a crash when a malformed message is received.
--- a/libpurple/protocols/myspace/markup.c Wed Dec 17 03:37:59 2008 +0000 +++ b/libpurple/protocols/myspace/markup.c Wed Dec 17 04:02:25 2008 +0000 @@ -497,29 +497,47 @@ *end = g_strdup(""); } else if (!purple_utf8_strcasecmp(root->name, "font")) { + GString *tmpbegin, *tmpend; const gchar *size; const gchar *face; + const gchar *color; size = xmlnode_get_attrib(root, "size"); face = xmlnode_get_attrib(root, "face"); + color = xmlnode_get_attrib(root, "color"); - if (face && size) { - *begin = g_strdup_printf("<f f='%s' h='%d'>", face, - msim_point_to_height(session, - msim_purple_size_to_point(session, atoi(size)))); - } else if (face) { - *begin = g_strdup_printf("<f f='%s'>", face); - } else if (size) { - *begin = g_strdup_printf("<f h='%d'>", + tmpbegin = g_string_new("<f"); + tmpend = g_string_new("</f>"); + + if (face != NULL) + g_string_append_printf(tmpbegin, "f='%s'>", face); + + if (size != NULL) + g_string_append_printf(tmpbegin, "h='%d'", msim_point_to_height(session, msim_purple_size_to_point(session, atoi(size)))); - } else { - *begin = g_strdup("<f>"); + + /* Close the <f> tag */ + g_string_append(tmpbegin, ">"); + + if (color != NULL) { + g_string_append_printf(tmpbegin, "<c v='%s'>", color); + g_string_prepend(tmpend, "</c>"); } - *end = g_strdup("</f>"); + *begin = g_string_free(tmpbegin, FALSE); + *end = g_string_free(tmpend, FALSE); + + } else if (!purple_utf8_strcasecmp(root->name, "body")) { + const gchar *bgcolor; - /* TODO: color (bg uses <body>), emoticons */ + bgcolor = xmlnode_get_attrib(root, "bgcolor"); + + if (bgcolor != NULL) { + *begin = g_strdup_printf("<b v='%s'>", bgcolor); + *end = g_strdup("</b>"); + } + } else { gchar *err;