pidgin: 482582eb: Sadrul pointed me at g_markup_escape_tex...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sat May 2 00:10:34 EDT 2009


-----------------------------------------------------------------
Revision: 482582ebb56dfa52fc8ddff33fbe7fd778701072
Ancestor: f198f700ad677f93033f49cfcf5447262440f517
Author: darkrain42 at pidgin.im
Date: 2009-05-02T04:02:53
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/482582ebb56dfa52fc8ddff33fbe7fd778701072

Modified files:
        ChangeLog.API libpurple/protocols/jabber/caps.c
        libpurple/util.c libpurple/util.h

ChangeLog: 

Sadrul pointed me at g_markup_escape_text, thanks!

-------------- next part --------------
============================================================
--- ChangeLog.API	8500d25dcf04dcd4f303130fbb8c12d12fd93a2c
+++ ChangeLog.API	0a1a50aa1da396c399fbfbae4975fe844c28dcb2
@@ -27,7 +27,6 @@ version 2.6.0 (??/??/2009):
 		* 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
============================================================
--- libpurple/protocols/jabber/caps.c	2eb73ce832095620cb4719448c50afb2ccdb7f69
+++ libpurple/protocols/jabber/caps.c	8a0969e52fc1a7e895b45f7657feec2fbd30a88c
@@ -796,7 +796,7 @@ jabber_caps_verification_append(GString 
 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 @@ gchar *jabber_caps_calculate_hash(Jabber
 	/* 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 : "");
============================================================
--- libpurple/util.c	6e96cb4d7f7b75bb49eca80bd464d7a8b18d6ff5
+++ libpurple/util.c	8c4e4787d5558dbb66ce2d53c3d42c468b95e4bf
@@ -2357,39 +2357,6 @@ char *
 }
 
 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, "&amp;", 5);
-				break;
-			case '"':
-				ret = g_string_append_len(ret, "&quot;", 6);
-				break;
-			case '<':
-				ret = g_string_append_len(ret, "&lt;", 4);
-				break;
-			case '>':
-				ret = g_string_append_len(ret, "&gt;", 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;
============================================================
--- libpurple/util.h	0db8286e30271b331fc4afa0bed5f00f0e03a7c4
+++ libpurple/util.h	9361ede4cf89416c188328b0c3ccabe59be6c037
@@ -496,21 +496,6 @@ char *purple_markup_linkify(const char *
 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 "<br>".
- *
- * @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
  * "<br>" to "\n".
  * For example "&amp;" is replaced by '&' and so on.


More information about the Commits mailing list