pidgin: 67b9179e: Use more efficient purple_find_buddies i...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Fri May 1 12:30:30 EDT 2009
-----------------------------------------------------------------
Revision: 67b9179e8426d10b7802f6deba88ae97beeebef7
Ancestor: 425ba940ad79a527a977fee784188436f7df1489
Author: darkrain42 at pidgin.im
Date: 2009-05-01T16:25:56
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/67b9179e8426d10b7802f6deba88ae97beeebef7
Modified files:
libpurple/blist.h libpurple/protocols/bonjour/jabber.c
ChangeLog:
Use more efficient purple_find_buddies in bonjour.
-------------- next part --------------
============================================================
--- libpurple/blist.h 56d8fc0998554333787e39efab8aac6088bde989
+++ libpurple/blist.h 255af9bb04fe9a6ed106f43e71d180cee84e9f9f
@@ -260,11 +260,14 @@ PurpleBlistNode *purple_blist_get_root(v
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);
============================================================
--- libpurple/protocols/bonjour/jabber.c d1f2fa81128bad84a2b44af0484263f99e5643d0
+++ libpurple/protocols/bonjour/jabber.c 68a2b3bee4afe8be44a4e30d3b86ced321fd5a05
@@ -233,26 +233,22 @@ struct _match_buddies_by_address_t {
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, in
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(BonjourJ
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);
More information about the Commits
mailing list