# HG changeset patch # User Marcus Lundblad # Date 1221160359 0 # Node ID 463240455f55505fcd901d90567158931620b74c # Parent f1ead28fcc5ade2809a5d630541515861136e1ba Added a workaround for receiving smileys from Jabbim, which uses the "cid" string as the "alt" attribute on s resulting in the smiley shortcut being formatted as a mailto: link. This reformats incoming shortcuts if the are formed as email addresses. Also, we don't need to escape the incoming text, as it is an XML attribute diff -r f1ead28fcc5a -r 463240455f55 libpurple/protocols/jabber/message.c --- a/libpurple/protocols/jabber/message.c Thu Sep 11 18:22:12 2008 +0000 +++ b/libpurple/protocols/jabber/message.c Thu Sep 11 19:12:39 2008 +0000 @@ -346,7 +346,14 @@ /* if there is no "alt" string, use the cid... include the entire src, eg. "cid:.." to avoid linkification */ if (alt && alt[0] != '\0') { - ref->alt = g_strdup(xmlnode_get_attrib(child, "alt")); + /* workaround for when "alt" is set to the value of the + CID (which Jabbim seems to do), to avoid it showing up + as an mailto: link */ + if (purple_email_is_valid(alt)) { + ref->alt = g_strdup_printf("smiley:%s", alt); + } else { + ref->alt = g_strdup(alt); + } } else { ref->alt = g_strdup(src); } @@ -424,9 +431,15 @@ gchar *escaped = NULL; /* if the "alt" attribute is empty, put the cid as smiley string */ if (alt && alt[0] != '\0') { - escaped = g_markup_escape_text(alt, -1); - out = g_string_append(out, escaped); - g_free(escaped); + /* if the "alt" is the same as the CID, as Jabbim does, + this prevents linkification... */ + if (purple_email_is_valid(alt)) { + const gchar *safe_alt = g_strdup_printf("smiley:%s", alt); + out = g_string_append(out, safe_alt); + g_free(safe_alt); + } else { + out = g_string_append(out, alt); + } } else { out = g_string_append(out, src); }