pidgin: e931eb6d: Add support for foreground and backgroun...
markdoliner at pidgin.im
markdoliner at pidgin.im
Tue Dec 16 23:05:28 EST 2008
-----------------------------------------------------------------
Revision: e931eb6da0a58faed1e9bfcffb4f0ba42448a688
Ancestor: f6c89ab271b9996da6e6581674e43637c839e59b
Author: markdoliner at pidgin.im
Date: 2008-12-17T04:02:25
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e931eb6da0a58faed1e9bfcffb4f0ba42448a688
Modified files:
ChangeLog libpurple/protocols/myspace/markup.c
ChangeLog:
Add support for foreground and background font colors in MySpace IMs
-------------- next part --------------
============================================================
--- ChangeLog b16b2f1ab25fd496bf43fb7008946712e6612647
+++ ChangeLog 1f6223e2bc6589d83c3ec3a7ff6efa3614966080
@@ -56,6 +56,7 @@ version 2.5.3 (12/??/2008):
* 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.
============================================================
--- libpurple/protocols/myspace/markup.c 296deb7aab92521f83aa2948d9440b552e6fc3c0
+++ libpurple/protocols/myspace/markup.c 58abfac63ad7287e2f96c2b9b16ce8570550c6c9
@@ -497,29 +497,47 @@ html_tag_to_msim_markup(MsimSession *ses
*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);
- /* TODO: color (bg uses <body>), emoticons */
+ } else if (!purple_utf8_strcasecmp(root->name, "body")) {
+ const gchar *bgcolor;
+
+ bgcolor = xmlnode_get_attrib(root, "bgcolor");
+
+ if (bgcolor != NULL) {
+ *begin = g_strdup_printf("<b v='%s'>", bgcolor);
+ *end = g_strdup("</b>");
+ }
+
} else {
gchar *err;
More information about the Commits
mailing list