changeset 27487:7a2891487a00

Don't pre-escape jbr->status. Almost every place required it in unescaped form. The places that did want it escaped had to go through a few hoops just to get it right, which are no longer necessary. Also, some other places failed to take into account that it was escaped, causing other display bugs. Fixes #5352.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 12 Jul 2009 22:40:54 +0000
parents 834236111afc
children 3698c7f4d803
files libpurple/protocols/jabber/buddy.c libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/presence.c
diffstat 3 files changed, 10 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c	Sun Jul 12 22:25:44 2009 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Sun Jul 12 22:40:54 2009 +0000
@@ -168,7 +168,7 @@
 	jbr->priority = priority;
 	jbr->state = state;
 	g_free(jbr->status);
-	jbr->status = status != NULL ? g_markup_escape_text(status, -1) : NULL;
+	jbr->status = g_strdup(status);
 
 	return jbr;
 }
@@ -702,7 +702,7 @@
 		const char *status_name = jabber_buddy_state_get_name(jbr->state);
 
 		if (jbr->status) {
-			purdy = purple_strdup_withhtml(jbr->status);
+			purdy = g_markup_escape_text(jbr->status, -1);
 
 			if (purple_strequal(status_name, purdy))
 				status_name = NULL;
--- a/libpurple/protocols/jabber/jabber.c	Sun Jul 12 22:25:44 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sun Jul 12 22:40:54 2009 +0000
@@ -1974,19 +1974,18 @@
 		ret = g_strdup(jb->error_msg);
 	} else {
 		PurplePresence *presence = purple_buddy_get_presence(b);
-		PurpleStatus *status =purple_presence_get_active_status(presence);
-		char *stripped;
-
-		if(!(stripped = purple_markup_strip_html(purple_status_get_attr_string(status, "message")))) {
+		PurpleStatus *status = purple_presence_get_active_status(presence);
+		const char *stripped;
+
+		if(!(stripped = purple_status_get_attr_string(status, "message"))) {
 			if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) {
 				PurpleStatus *status = purple_presence_get_status(presence, "tune");
-				stripped = g_strdup(purple_status_get_attr_string(status, PURPLE_TUNE_TITLE));
+				stripped = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE);
 			}
 		}
 
 		if(stripped) {
 			ret = g_markup_escape_text(stripped, -1);
-			g_free(stripped);
 		}
 	}
 
@@ -2003,12 +2002,7 @@
 	const char *state;
 
 	if(jbr->status) {
-		char *tmp;
-		text = purple_strreplace(jbr->status, "\n", "<br />\n");
-		tmp = purple_markup_strip_html(text);
-		g_free(text);
-		text = g_markup_escape_text(tmp, -1);
-		g_free(tmp);
+		text = g_markup_escape_text(jbr->status, -1);
 	}
 
 	if(jbr->name)
--- a/libpurple/protocols/jabber/presence.c	Sun Jul 12 22:25:44 2009 +0000
+++ b/libpurple/protocols/jabber/presence.c	Sun Jul 12 22:40:54 2009 +0000
@@ -1055,11 +1055,8 @@
 			formatted_msg = purple_status_get_attr_string(status, "message");
 
 			/* if the message is blank, then there really isn't a message */
-			if(formatted_msg && !*formatted_msg)
-				formatted_msg = NULL;
-
-			if(formatted_msg)
-				*msg = purple_markup_strip_html(formatted_msg);
+			if(formatted_msg && *formatted_msg)
+				*msg = g_strdup(formatted_msg);
 		}
 
 		if(priority)