pidgin: 8512af37: Better status message handling in Gadu-G...

tomkiewicz at cpw.pidgin.im tomkiewicz at cpw.pidgin.im
Wed Jun 22 18:15:49 EDT 2011


----------------------------------------------------------------------
Revision: 8512af37c7822c68f1cf46a02cbca592f6c79468
Parent:   635702e269dd4913ebb13f96b885d4eeb7c874d7
Author:   tomkiewicz at cpw.pidgin.im
Date:     06/22/11 18:10:37
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8512af37c7822c68f1cf46a02cbca592f6c79468

Changelog: 

Better status message handling in Gadu-Gadu. Fixes #14314

Changes against parent 635702e269dd4913ebb13f96b885d4eeb7c874d7

  patched  ChangeLog
  patched  libpurple/protocols/gg/gg.c

-------------- next part --------------
============================================================
--- ChangeLog	1ef27b5175f75b502ea44cc7ff5fc6dc395f0c0f
+++ ChangeLog	a46e1fe2562ac52f84cfa63abb44b443a4892ac0
@@ -18,6 +18,7 @@ version 2.8.1 (MM/DD/YYYY):
 	Gadu-Gadu:
 	* Fixed searching for buddies in public directory. (Tomasz Wasilczyk)
 	  (#5242)
+	* Better status message handling. (Tomasz Wasilczyk) (#14314)
 
 version 2.8.0 (06/07/2011):
 	General:
============================================================
--- libpurple/protocols/gg/gg.c	4947d4e2f17835153127f3cfaeff795dec4bdff7
+++ libpurple/protocols/gg/gg.c	6e47c30552adb2a7ec0c0a0f217d1198dcdbbd4a
@@ -1071,6 +1071,7 @@ static void ggp_generic_status_handler(P
 {
 	gchar *from;
 	const char *st;
+	char *status_msg = NULL;
 
 	ggp_update_buddy_avatar(gc, uin);
 
@@ -1108,14 +1109,24 @@ static void ggp_generic_status_handler(P
 			break;
 	}
 
-	purple_debug_info("gg", "st = %s\n", st);
-	//msg = charset_convert(descr, "CP1250", "UTF-8");
-	if (descr == NULL) {
+	if (descr != NULL) {
+		status_msg = g_strdup(descr);
+		g_strstrip(status_msg);
+		if (status_msg[0] == '\0') {
+			g_free(status_msg);
+			status_msg = NULL;
+		}
+	}
+
+	purple_debug_info("gg", "status of %u is %s [%s]\n", uin, st,
+		status_msg ? status_msg : "");
+	if (status_msg == NULL) {
 		purple_prpl_got_user_status(purple_connection_get_account(gc),
-		      from, st, NULL);
+			from, st, NULL);
 	} else {
 		purple_prpl_got_user_status(purple_connection_get_account(gc),
-		    from, st, "message", descr, NULL);
+			from, st, "message", status_msg, NULL);
+		g_free(status_msg);
 	}
 	g_free(from);
 }
@@ -1945,23 +1956,18 @@ static char *ggp_status_text(PurpleBuddy
 	char *text;
 	char *tmp;
 
-	status = purple_presence_get_active_status(purple_buddy_get_presence(b));
-
+	status = purple_presence_get_active_status(
+		purple_buddy_get_presence(b));
 	msg = purple_status_get_attr_string(status, "message");
 
-	if (msg != NULL) {
-		tmp = purple_markup_strip_html(msg);
-		text = g_markup_escape_text(tmp, -1);
-		g_free(tmp);
+	if (msg == NULL)
+		return NULL;
 
-		return text;
-	} else {
-		tmp = purple_utf8_salvage(purple_status_get_name(status));
-		text = g_markup_escape_text(tmp, -1);
-		g_free(tmp);
+	tmp = purple_markup_strip_html(msg);
+	text = g_markup_escape_text(tmp, -1);
+	g_free(tmp);
 
-		return text;
-	}
+	return text;
 }
 
 static void ggp_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full)


More information about the Commits mailing list