# HG changeset patch # User Paul Aurich # Date 1241236973 0 # Node ID ab31daf1c1eea37e201a4463f96d34015e02a94d # Parent e72df47d41fe9ff66e2c5966a1bbff7f0939f927 Sadrul pointed me at g_markup_escape_text, thanks! diff -r e72df47d41fe -r ab31daf1c1ee ChangeLog.API --- a/ChangeLog.API Sat May 02 01:26:18 2009 +0000 +++ b/ChangeLog.API Sat May 02 04:02:53 2009 +0000 @@ -27,7 +27,6 @@ * purple_connection_set_protocol_data * purple_contact_destroy * purple_conv_chat_invite_user - * purple_escape_html * purple_global_proxy_set_info * purple_group_destroy * purple_log_get_activity_score diff -r e72df47d41fe -r ab31daf1c1ee libpurple/protocols/jabber/caps.c --- a/libpurple/protocols/jabber/caps.c Sat May 02 01:26:18 2009 +0000 +++ b/libpurple/protocols/jabber/caps.c Sat May 02 04:02:53 2009 +0000 @@ -796,7 +796,7 @@ static GString* jabber_caps_verification_append(GString *verification, const gchar *str) { - char *tmp = purple_escape_html(str); + char *tmp = g_markup_escape_text(str, -1); verification = g_string_append(verification, tmp); g_free(tmp); return g_string_append_c(verification, '<'); @@ -824,10 +824,10 @@ /* concat identities to the verification string */ for (node = info->identities; node; node = node->next) { JabberIdentity *id = (JabberIdentity*)node->data; - char *category = purple_escape_html(id->category); - char *type = purple_escape_html(id->type); - char *lang = purple_escape_html(id->lang); - char *name = purple_escape_html(id->name); + char *category = g_markup_escape_text(id->category, -1); + char *type = g_markup_escape_text(id->type, -1); + char *lang = g_markup_escape_text(id->lang, -1); + char *name = g_markup_escape_text(id->name, -1); g_string_append_printf(verification, "%s/%s/%s/%s<", category, type, lang ? lang : "", name ? name : ""); diff -r e72df47d41fe -r ab31daf1c1ee libpurple/util.c --- a/libpurple/util.c Sat May 02 01:26:18 2009 +0000 +++ b/libpurple/util.c Sat May 02 04:02:53 2009 +0000 @@ -2357,39 +2357,6 @@ } char * -purple_escape_html(const char *str) -{ - GString *ret; - const char *in = str; - - if (str == NULL) - return NULL; - - ret = g_string_sized_new(strlen(str)); - for ( ; *in; ++in) { - switch (*in) { - case '&': - ret = g_string_append_len(ret, "&", 5); - break; - case '"': - ret = g_string_append_len(ret, """, 6); - break; - case '<': - ret = g_string_append_len(ret, "<", 4); - break; - case '>': - ret = g_string_append_len(ret, ">", 4); - break; - default: - ret = g_string_append_c(ret, *in); - break; - } - } - - return g_string_free(ret, FALSE); -} - -char * purple_unescape_html(const char *html) { if (html != NULL) { const char *c = html; diff -r e72df47d41fe -r ab31daf1c1ee libpurple/util.h --- a/libpurple/util.h Sat May 02 01:26:18 2009 +0000 +++ b/libpurple/util.h Sat May 02 04:02:53 2009 +0000 @@ -496,21 +496,6 @@ char *purple_markup_linkify(const char *str); /** - * Escape special HTML characters to their HTML entities. - * This is almost the reverse of purple_unescape_html except that - * this does not translate "\n" into "
". - * - * @param str The string in which to escape special characters. - * - * @return The text with the special characters escaped. You must - * g_free this string when finished with it. - * - * @see purple_unescape_html - * @since 2.6.0 - */ -char *purple_escape_html(const char *str); - -/** * Unescapes HTML entities to their literal characters. Also translates * "
" to "\n". * For example "&" is replaced by '&' and so on.