pidgin/pidgin

Remove purple_markup_escape_text

17 months ago, Gary Kramlich
fa0478036eaf
Parents 9f7dea7e51b3
Children 355bd17297f0
Remove purple_markup_escape_text

This was originally added because g_markup_escape_text turns ' in to '
which isn't an element in HTML 4 and apparently it wasn't rendered right in
IE7. Those days are long gone, so there's no reason we need this anymore.

Testing Done:
Compiled and ran the unit tests

Reviewed at https://reviews.imfreedom.org/r/2096/
--- a/ChangeLog.API Fri Nov 25 23:39:13 2022 -0600
+++ b/ChangeLog.API Fri Nov 25 23:40:58 2022 -0600
@@ -510,6 +510,7 @@
* purple_ip_address_is_valid, purple_ipv4_address_is_valid, and
purple_ipv6_address_is_valid. Use g_hostname_is_ip_address()
or #GInetAddress instead.
+ * purple_markup_escape_text
* purple_markup_extract_info_field
* purple_markup_find_tag
* purple_markup_get_css_property
--- a/finch/gntconv.c Fri Nov 25 23:39:13 2022 -0600
+++ b/finch/gntconv.c Fri Nov 25 23:40:58 2022 -0600
@@ -154,7 +154,7 @@
}
else
{
- char *escape = purple_markup_escape_text((*text == '/' ? text + 1 : text), -1);
+ char *escape = g_markup_escape_text((*text == '/' ? text + 1 : text), -1);
purple_conversation_send(ggconv->active_conv, escape);
g_free(escape);
purple_idle_touch();
--- a/libpurple/protocols/facebook/facebook.c Fri Nov 25 23:39:13 2022 -0600
+++ b/libpurple/protocols/facebook/facebook.c Fri Nov 25 23:40:58 2022 -0600
@@ -555,7 +555,7 @@
text = msg->text;
html = NULL;
} else {
- html = purple_markup_escape_text(msg->text, -1);
+ html = g_markup_escape_text(msg->text, -1);
text = html;
}
--- a/libpurple/protocols/jabber/buddy.c Fri Nov 25 23:39:13 2022 -0600
+++ b/libpurple/protocols/jabber/buddy.c Fri Nov 25 23:40:58 2022 -0600
@@ -773,7 +773,7 @@
const char *status_name = jabber_buddy_state_get_name(jbr->state);
if (jbr->status) {
- tmp = purple_markup_escape_text(jbr->status, -1);
+ tmp = g_markup_escape_text(jbr->status, -1);
purdy = purple_strdup_withhtml(tmp);
g_free(tmp);
--- a/libpurple/protocols/jabber/message.c Fri Nov 25 23:39:13 2022 -0600
+++ b/libpurple/protocols/jabber/message.c Fri Nov 25 23:40:58 2022 -0600
@@ -553,7 +553,7 @@
} else if(purple_strequal(child->name, "body") && purple_strequal(xmlns, NS_XMPP_CLIENT)) {
if(!jm->body) {
char *msg = purple_xmlnode_get_data(child);
- char *escaped = purple_markup_escape_text(msg, -1);
+ char *escaped = g_markup_escape_text(msg, -1);
jm->body = purple_strdup_withhtml(escaped);
g_free(escaped);
g_free(msg);
--- a/libpurple/purplemarkup.c Fri Nov 25 23:39:13 2022 -0600
+++ b/libpurple/purplemarkup.c Fri Nov 25 23:40:58 2022 -0600
@@ -24,77 +24,6 @@
#include "util.h"
-/*
- * This function is stolen from glib's gmarkup.c and modified to not
- * replace ' with '
- */
-static void append_escaped_text(GString *str,
- const gchar *text, gssize length)
-{
- const gchar *p;
- const gchar *end;
- gunichar c;
-
- p = text;
- end = text + length;
-
- while (p != end)
- {
- const gchar *next;
- next = g_utf8_next_char (p);
-
- switch (*p)
- {
- case '&':
- g_string_append (str, "&");
- break;
-
- case '<':
- g_string_append (str, "&lt;");
- break;
-
- case '>':
- g_string_append (str, "&gt;");
- break;
-
- case '"':
- g_string_append (str, "&quot;");
- break;
-
- default:
- c = g_utf8_get_char (p);
- if ((0x1 <= c && c <= 0x8) ||
- (0xb <= c && c <= 0xc) ||
- (0xe <= c && c <= 0x1f) ||
- (0x7f <= c && c <= 0x84) ||
- (0x86 <= c && c <= 0x9f))
- g_string_append_printf (str, "&#x%x;", c);
- else
- g_string_append_len (str, p, next - p);
- break;
- }
-
- p = next;
- }
-}
-
-/* This function is stolen from glib's gmarkup.c */
-gchar *purple_markup_escape_text(const gchar *text, gssize length)
-{
- GString *str;
-
- g_return_val_if_fail(text != NULL, NULL);
-
- if (length < 0)
- length = strlen(text);
-
- /* prealloc at least as long as original text */
- str = g_string_sized_new(length);
- append_escaped_text(str, text, length);
-
- return g_string_free(str, FALSE);
-}
-
const char *
purple_markup_unescape_entity(const char *text, int *length)
{
--- a/libpurple/purplemarkup.h Fri Nov 25 23:39:13 2022 -0600
+++ b/libpurple/purplemarkup.h Fri Nov 25 23:40:58 2022 -0600
@@ -32,21 +32,6 @@
G_BEGIN_DECLS
/**
- * purple_markup_escape_text:
- * @text: The text to escape
- * @length: The length of the text, or -1 if #NULL terminated
- *
- * Escapes special characters in a plain-text string so they display
- * correctly as HTML. For example, &amp; is replaced with &amp;amp; and &lt; is
- * replaced with &amp;lt;
- *
- * This is exactly the same as g_markup_escape_text(), except that it
- * does not change ' to &amp;apos; because &amp;apos; is not a valid HTML 4 entity,
- * and is displayed literally in IE7.
- */
-gchar *purple_markup_escape_text(const gchar *text, gssize length);
-
-/**
* purple_markup_html_to_xhtml:
* @html: The HTML markup.
* @dest_xhtml: The destination XHTML output.