Mercurial > pidgin.yaz
changeset 23993:463240455f55
Added a workaround for receiving smileys from Jabbim,
which uses the "cid" string as the "alt" attribute on <img/>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
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Thu, 11 Sep 2008 19:12:39 +0000 |
parents | f1ead28fcc5a |
children | 60c23887a665 |
files | libpurple/protocols/jabber/message.c |
diffstat | 1 files changed, 17 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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); }