pidgin: 65f082f9: jabber: Fix another corner case that int...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Mon Feb 15 19:40:49 EST 2010


-----------------------------------------------------------------
Revision: 65f082f9eed3753e9ab3457861c2118f840d9cd1
Ancestor: 2a58bda0b6d8c5519ef9e41e5f017343ef2cbac0
Author: darkrain42 at pidgin.im
Date: 2010-02-16T00:36:25
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/65f082f9eed3753e9ab3457861c2118f840d9cd1

Modified files:
        ChangeLog libpurple/protocols/jabber/roster.c

ChangeLog: 

jabber: Fix another corner case that introduced duplicates to the list.

This occurs when the roster contains either two groups with the exact
same name or a name that differs only by case.  The solution: uniquify
the list of groups.  Fixes #10950.

-------------- next part --------------
============================================================
--- ChangeLog	fd2096a5f2d57472a4e893ae76083de77188027f
+++ ChangeLog	66db20ffe43a1744dccdac07f9ce9cc735b4ff2d
@@ -62,6 +62,9 @@ version 2.6.6 (??/??/20??):
 	* The default value for the file transfer proxies is automatically
 	  updated when an account connects, if it is still the old (broken)
 	  default (from 'proxy.jabber.org' to 'proxy.eu.jabber.org').
+	* Fix an issue where libpurple created duplicate buddies if the roster
+	  contains a buddy in two groups that differ only by case
+	  (e.g. "XMPP" and "xmpp") (or not at all).
 
 	Yahoo:
 	* Don't send <span> and </span> tags.  (Fartash Faghri)
============================================================
--- libpurple/protocols/jabber/roster.c	6d5e720c1fe2823b37fc15966012e798d5fb16f2
+++ libpurple/protocols/jabber/roster.c	2a1c4c9b444c919089b4ed98041c6214a5ec97c4
@@ -259,7 +259,16 @@ void jabber_roster_parse(JabberStream *j
 					seen_empty = TRUE;
 				}
 
-				groups = g_slist_prepend(groups, group_name);
+				/*
+				 * See the note in add_purple_buddy_to_groups; the core handles
+				 * names case-insensitively and this is required to not
+				 * end up with duplicates if a buddy is in, e.g.,
+				 * 'XMPP' and 'xmpp'
+				 */
+				if (g_slist_find_custom(groups, group_name, (GCompareFunc)purple_utf8_strcasecmp))
+					g_free(group_name);
+				else
+					groups = g_slist_prepend(groups, group_name);
 			}
 
 			add_purple_buddy_to_groups(js, jid, name, groups);


More information about the Commits mailing list