diff libpurple/util.h @ 26771:e72df47d41fe

Escape all the values when appending them to the Entity Caps verification str. xmlnode_get_attrib and xmlnode_get_data unescape what they return. Thanks to Tobias and Waqas. This will still fail to validate if the other side uses entity codes (or uses other entities unnecessarily), but that should be dealt with as a hash failure instead of a collision. (10:12:11) Tobias: [18:48:43] <waqas> <identity category='client' type='pc' name='SomeClient'/><feature var='http://jabber.org/protocol/muc'/> turns into 'client/pc//SomeClient<http://jabber.org/protocol/caps<' but so does <identity category='client' type='pc' name='SomeClient&lt;http://jabber.org/protocol/caps'/>, which is a collision, right?
author Paul Aurich <paul@darkrain42.org>
date Sat, 02 May 2009 01:26:18 +0000
parents fd97c0de433d
children ab31daf1c1ee
line wrap: on
line diff
--- a/libpurple/util.h	Fri May 01 22:40:41 2009 +0000
+++ b/libpurple/util.h	Sat May 02 01:26:18 2009 +0000
@@ -496,7 +496,23 @@
 char *purple_markup_linkify(const char *str);
 
 /**
- * Unescapes HTML entities to their literal characters.
+ * 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.
  * Actually only "&amp;", "&quot;", "&lt;" and "&gt;" are currently
  * supported.
@@ -505,6 +521,8 @@
  *
  * @return The text with HTML entities literalized.  You must g_free
  *         this string when finished with it.
+ *
+ * @see purple_escape_html
  */
 char *purple_unescape_html(const char *html);