diff src/blist.c @ 6872:dd0eecfbe413

[gaim-migrate @ 7418] ok, these are some tweaks i've made to core code working on the new jabber plugin. - add gaim_find_buddy_in_group() that searches a specific group instead of the entire list. kinda handy. - re-did the base64 encoding function. i think it may have been broken, i'm not sure, but this i know works. - fix the formatted notify dialog to be more to my liking, and to have a working Close button. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 17 Sep 2003 03:45:04 +0000
parents c069548b501e
children 66dd420d3d23
line wrap: on
line diff
--- a/src/blist.c	Wed Sep 17 03:22:44 2003 +0000
+++ b/src/blist.c	Wed Sep 17 03:45:04 2003 +0000
@@ -1221,6 +1221,24 @@
 	return NULL;
 }
 
+GaimBuddy *gaim_find_buddy_in_group(GaimAccount *account, const char *name,
+		GaimGroup *group)
+{
+	struct _gaim_hbuddy hb;
+
+	if (!gaimbuddylist)
+		return NULL;
+
+	if (!name)
+		return NULL;
+
+	hb.name = normalize(name);
+	hb.account = account;
+	hb.group = (GaimBlistNode*)group;
+
+	return g_hash_table_lookup(gaimbuddylist->buddies, &hb);
+}
+
 GSList *gaim_find_buddies(GaimAccount *account, const char *name)
 {
 	struct buddy *buddy;
@@ -2028,8 +2046,10 @@
 	} else if(!strcmp(element_name, "buddy")) {
 		GaimAccount *account = gaim_accounts_find(blist_parser_account_name,
 				blist_parser_account_protocol);
-		if(account) {
-			GaimBuddy *b = gaim_buddy_new(account, blist_parser_buddy_name, blist_parser_buddy_alias);
+		if(account && !gaim_find_buddy_in_group(account,
+					blist_parser_buddy_name, blist_parser_group)) {
+			GaimBuddy *b = gaim_buddy_new(account, blist_parser_buddy_name,
+					blist_parser_buddy_alias);
 			gaim_blist_add_buddy(b,blist_parser_contact, blist_parser_group,
 					gaim_blist_get_last_child((GaimBlistNode*)blist_parser_contact));
 			if(blist_parser_buddy_settings) {