pidgin: b4ae5998: Don't pre-escape jbr->status. Almost eve...

qulogic at pidgin.im qulogic at pidgin.im
Mon Jul 13 02:01:18 EDT 2009


-----------------------------------------------------------------
Revision: b4ae5998272a5b0f78bfd9f44b00db06b936f4d1
Ancestor: 31eed8bec18c67fd40661690e0fb15632bbc1965
Author: qulogic at pidgin.im
Date: 2009-07-12T22:40:54
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b4ae5998272a5b0f78bfd9f44b00db06b936f4d1

Modified files:
        libpurple/protocols/jabber/buddy.c
        libpurple/protocols/jabber/jabber.c
        libpurple/protocols/jabber/presence.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/buddy.c	5c90a6cff25b3e7685dca8401c59d1d21e1691b2
+++ libpurple/protocols/jabber/buddy.c	b3679530ba7b371de0fcb1e0524de09ac9571ecc
@@ -168,7 +168,7 @@ JabberBuddyResource *jabber_buddy_track_
 	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 @@ add_jbr_info(JabberBuddyInfo *jbi, const
 		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;
============================================================
--- libpurple/protocols/jabber/jabber.c	b3e42231c0e2de37f996e14d93fc105c35257eb4
+++ libpurple/protocols/jabber/jabber.c	85e3408d069e195a6620c52cadc8cfea56f7f510
@@ -1974,19 +1974,18 @@ char *jabber_status_text(PurpleBuddy *b)
 		ret = g_strdup(jb->error_msg);
 	} else {
 		PurplePresence *presence = purple_buddy_get_presence(b);
-		PurpleStatus *status =purple_presence_get_active_status(presence);
-		char *stripped;
+		PurpleStatus *status = purple_presence_get_active_status(presence);
+		const char *stripped;
 
-		if(!(stripped = purple_markup_strip_html(purple_status_get_attr_string(status, "message")))) {
+		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 @@ jabber_tooltip_add_resource_text(JabberB
 	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)
============================================================
--- libpurple/protocols/jabber/presence.c	26ed0cd9f5b61addd2e8591e113e8a48f3b59d1f
+++ libpurple/protocols/jabber/presence.c	6cbcb51315b57dcdf62a20b88147dba8d88fb86f
@@ -1055,11 +1055,8 @@ void purple_status_to_jabber(const Purpl
 			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)


More information about the Commits mailing list