comparison 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
comparison
equal deleted inserted replaced
6871:714fc8f45cf2 6872:dd0eecfbe413
1217 if ((buddy = g_hash_table_lookup(gaimbuddylist->buddies, &hb)) != NULL) 1217 if ((buddy = g_hash_table_lookup(gaimbuddylist->buddies, &hb)) != NULL)
1218 return buddy; 1218 return buddy;
1219 } 1219 }
1220 1220
1221 return NULL; 1221 return NULL;
1222 }
1223
1224 GaimBuddy *gaim_find_buddy_in_group(GaimAccount *account, const char *name,
1225 GaimGroup *group)
1226 {
1227 struct _gaim_hbuddy hb;
1228
1229 if (!gaimbuddylist)
1230 return NULL;
1231
1232 if (!name)
1233 return NULL;
1234
1235 hb.name = normalize(name);
1236 hb.account = account;
1237 hb.group = (GaimBlistNode*)group;
1238
1239 return g_hash_table_lookup(gaimbuddylist->buddies, &hb);
1222 } 1240 }
1223 1241
1224 GSList *gaim_find_buddies(GaimAccount *account, const char *name) 1242 GSList *gaim_find_buddies(GaimAccount *account, const char *name)
1225 { 1243 {
1226 struct buddy *buddy; 1244 struct buddy *buddy;
2026 blist_parser_contact = NULL; 2044 blist_parser_contact = NULL;
2027 tag_stack = g_list_delete_link(tag_stack, tag_stack); 2045 tag_stack = g_list_delete_link(tag_stack, tag_stack);
2028 } else if(!strcmp(element_name, "buddy")) { 2046 } else if(!strcmp(element_name, "buddy")) {
2029 GaimAccount *account = gaim_accounts_find(blist_parser_account_name, 2047 GaimAccount *account = gaim_accounts_find(blist_parser_account_name,
2030 blist_parser_account_protocol); 2048 blist_parser_account_protocol);
2031 if(account) { 2049 if(account && !gaim_find_buddy_in_group(account,
2032 GaimBuddy *b = gaim_buddy_new(account, blist_parser_buddy_name, blist_parser_buddy_alias); 2050 blist_parser_buddy_name, blist_parser_group)) {
2051 GaimBuddy *b = gaim_buddy_new(account, blist_parser_buddy_name,
2052 blist_parser_buddy_alias);
2033 gaim_blist_add_buddy(b,blist_parser_contact, blist_parser_group, 2053 gaim_blist_add_buddy(b,blist_parser_contact, blist_parser_group,
2034 gaim_blist_get_last_child((GaimBlistNode*)blist_parser_contact)); 2054 gaim_blist_get_last_child((GaimBlistNode*)blist_parser_contact));
2035 if(blist_parser_buddy_settings) { 2055 if(blist_parser_buddy_settings) {
2036 g_hash_table_destroy(b->settings); 2056 g_hash_table_destroy(b->settings);
2037 b->settings = blist_parser_buddy_settings; 2057 b->settings = blist_parser_buddy_settings;