pidgin: e09847cb: jabber: Treat empty <group/> elements as..

darkrain42 at pidgin.im darkrain42 at pidgin.im
Tue May 10 22:01:09 EDT 2011


----------------------------------------------------------------------
Revision: e09847cb3f7316d9a193184e236421bea704bd4b
Parent:   dddec508a4232ccf8b6e3ec0db47d305f48a4c98
Author:   darkrain42 at pidgin.im
Date:     05/10/11 21:58:03
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e09847cb3f7316d9a193184e236421bea704bd4b

Changelog: 

jabber: Treat empty <group/> elements as "Buddies", not ""

This ultimately led to duplicates in the list, because
we had one entry in the GSList as "", and one as NULL, both of which are
invalid group names, which resulted in the core blithely replacing
them with "Buddies" and generating duplicates.

I've tested with and without, and can reproduce the issues without the change.

Log:
<item subscription='both' name='person' jid='person at example.com'><group></group><group></group></item>

(19:32:23) jabber: jabber_roster_parse(): Removing person at example.com from group 'Buddies' on the local list
(19:32:23) GLib: g_string_append: assertion `val != NULL' failed
(19:32:23) jabber: jabber_roster_parse(): Adding person at example.com to groups: , 
(19:32:23) g_log: purple_find_group: assertion `(name != NULL) && (*name != '\0')' failed
(19:32:23) g_log: purple_group_new: assertion `name != NULL' failed
(19:32:23) g_log: purple_blist_add_group: assertion `group != NULL' failed
(19:32:23) g_log: purple_find_group: assertion `(name != NULL) && (*name != '\0')' failed
(19:32:23) g_log: purple_group_new: assertion `*name != '\0'' failed
(19:32:23) g_log: purple_blist_add_group: assertion `group != NULL' failed

Since I had to look it up, purple_blist_add_buddy replaces (group == NULL) with "Buddies".

Changes against parent dddec508a4232ccf8b6e3ec0db47d305f48a4c98

  patched  ChangeLog
  patched  libpurple/protocols/jabber/roster.c

-------------- next part --------------
============================================================
--- ChangeLog	b1ef56a8f8e5d4bf78b465d58d65e5c6bf03db33
+++ ChangeLog	2bc2722bc0a0ae576a70a4b3b9e791818b8e5684
@@ -92,6 +92,9 @@ version 2.8.0 (??/??/????):
 	  (Keith Moyer) (#12451)
 	* Correctly handle a buddy's unsetting his/her vCard-based avatar.
 	  (Matthew W.S. Bell) (#13370)
+	* Squash one more situation that resulted in duplicate entries in
+	  the roster (this one where the server reports the buddy as being
+	  in the same (empty) group.  (Reported by Danny Mayer)
 
 	Plugins:
 	* The Voice/Video Settings plugin now includes the ability to test
============================================================
--- libpurple/protocols/jabber/roster.c	1ca9a71630b1a9d2ba6bbc790b4727ae122c3e7e
+++ libpurple/protocols/jabber/roster.c	35bdcb53d9cfc3e3f89ccfead5dc6dcfc707aeda
@@ -243,7 +243,6 @@ void jabber_roster_parse(JabberStream *j
 			remove_purple_buddies(js, jid);
 		} else {
 			GSList *groups = NULL;
-			gboolean seen_empty = FALSE;
 
 			if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER)
 				if (!jabber_google_roster_incoming(js, item))
@@ -252,10 +251,9 @@ void jabber_roster_parse(JabberStream *j
 			for(group = xmlnode_get_child(item, "group"); group; group = xmlnode_get_next_twin(group)) {
 				char *group_name = xmlnode_get_data(group);
 
-				if (!group_name && !seen_empty) {
-					group_name = g_strdup("");
-					seen_empty = TRUE;
-				}
+				if (group_name == NULL || *group_name == '\0')
+					/* Changing this string?  Look in add_purple_buddy_to_groups */
+					group_name = g_strdup(_("Buddies"));
 
 				/*
 				 * See the note in add_purple_buddy_to_groups; the core handles


More information about the Commits mailing list