diff options
author | Paul Aurich <darkrain42@pidgin.im> | 2009-05-01 16:25:56 +0000 |
---|---|---|
committer | Paul Aurich <darkrain42@pidgin.im> | 2009-05-01 16:25:56 +0000 |
commit | f5cf5142ef5516379b8c75d4bf05b81cfce67aea (patch) | |
tree | e43fd62c316545353d0e6c9feea883e98b165376 /libpurple | |
parent | da5d847ca499a97dd0acd87cd28f3ba90c918a62 (diff) | |
download | pidgin-f5cf5142ef5516379b8c75d4bf05b81cfce67aea.tar.gz |
Use more efficient purple_find_buddies in bonjour.
Diffstat (limited to 'libpurple')
-rw-r--r-- | libpurple/blist.h | 5 | ||||
-rw-r--r-- | libpurple/protocols/bonjour/jabber.c | 15 |
2 files changed, 8 insertions, 12 deletions
diff --git a/libpurple/blist.h b/libpurple/blist.h index 895cc65d10..36391151fc 100644 --- a/libpurple/blist.h +++ b/libpurple/blist.h @@ -260,11 +260,14 @@ PurpleBuddyList *purple_get_blist(void); PurpleBlistNode *purple_blist_get_root(void); /** - * Returns a list of every buddy in the list. + * Returns a list of every buddy in the list. The usage of this function + * is discourage if you do not actually need every buddy in the list. Use + * purple_find_buddies instead. * * @return A list of every buddy in the list. Caller is responsible for * freeing the list. * + * @see purple_find_buddies * @since 2.6.0 */ GSList *purple_blist_get_buddies(void); diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c index 663d59f53b..7f98fa3dcb 100644 --- a/libpurple/protocols/bonjour/jabber.c +++ b/libpurple/protocols/bonjour/jabber.c @@ -233,26 +233,22 @@ _jabber_parse_and_write_message_to_ui(xmlnode *message_node, PurpleBuddy *pb) struct _match_buddies_by_address_t { const char *address; GSList *matched_buddies; - BonjourJabber *jdata; }; static void _match_buddies_by_address(gpointer value, gpointer data) { PurpleBuddy *pb = value; - PurpleAccount *account = NULL; BonjourBuddy *bb = NULL; struct _match_buddies_by_address_t *mbba = data; - account = purple_buddy_get_account(pb); bb = purple_buddy_get_protocol_data(pb); /* - * If the current PurpleBuddy's data is not null and the PurpleBuddy's account - * is the same as the account requesting the check then continue to determine + * If the current PurpleBuddy's data is not null, then continue to determine * whether one of the buddies IPs matches the target IP. */ - if (mbba->jdata->account == account && bb != NULL) + if (bb != NULL) { const char *ip; GSList *tmp = bb->ips; @@ -658,15 +654,13 @@ _server_socket_handler(gpointer data, int server_socket, PurpleInputCondition co purple_debug_info("bonjour", "Received incoming connection from %s.\n", address_text); mbba = g_new0(struct _match_buddies_by_address_t, 1); mbba->address = address_text; - mbba->jdata = jdata; - buddies = purple_blist_get_buddies(); + buddies = purple_find_buddies(jdata->account, NULL); g_slist_foreach(buddies, _match_buddies_by_address, mbba); g_slist_free(buddies); if (mbba->matched_buddies == NULL) { purple_debug_info("bonjour", "We don't like invisible buddies, this is not a superheros comic\n"); - g_slist_free(mbba->matched_buddies); g_free(mbba); close(client_socket); return; @@ -858,9 +852,8 @@ bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv) { mbba = g_new0(struct _match_buddies_by_address_t, 1); mbba->address = bconv->ip; - mbba->jdata = jdata; - buddies = purple_blist_get_buddies(); + buddies = purple_find_buddies(jdata->account, NULL); g_slist_foreach(buddies, _match_buddies_by_address, mbba); g_slist_free(buddies); |