diff libpurple/protocols/irc/msgs.c @ 27842:f9cf1e14838b

irc: Handle a buddy appearing in multiple groups properly. Handle multiple PurpleBuddy's corresponding to the same buddy with a reference count in struct irc_buddy and fix a string corruption that would be caused by using g_hash_table_insert instead of replace (the wrong string is freed).
author Paul Aurich <paul@darkrain42.org>
date Thu, 06 Aug 2009 04:59:12 +0000
parents 01f1929d0936
children 00302e68c31d
line wrap: on
line diff
--- a/libpurple/protocols/irc/msgs.c	Thu Aug 06 03:23:05 2009 +0000
+++ b/libpurple/protocols/irc/msgs.c	Thu Aug 06 04:59:12 2009 +0000
@@ -103,7 +103,8 @@
 		PurpleBuddy *b = buddies->data;
 		struct irc_buddy *ib = g_new0(struct irc_buddy, 1);
 		ib->name = g_strdup(purple_buddy_get_name(b));
-		g_hash_table_insert(irc->buddies, ib->name, ib);
+		ib->ref = 1;
+		g_hash_table_replace(irc->buddies, ib->name, ib);
 	}
 
 	irc_blist_timeout(irc);