Mercurial > pidgin
diff libpurple/protocols/jabber/buddy.c @ 25175:b1b1b75a922e
Sprinkle jabber_resource_has_capability in places
Plug a small leak
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 26 Nov 2008 22:06:46 +0000 |
parents | 7dcba13d0e28 |
children | e1f363f8fd6b |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c Wed Nov 26 18:45:57 2008 +0000 +++ b/libpurple/protocols/jabber/buddy.c Wed Nov 26 22:06:46 2008 +0000 @@ -2495,7 +2495,7 @@ gboolean jabber_resource_has_capability(const JabberBuddyResource *jbr, const gchar *cap) { - const GList *iter = NULL; + const GList *node = NULL; if (!jbr->caps) { purple_debug_error("jabber", @@ -2503,15 +2503,14 @@ return FALSE; } - for (iter = jbr->caps->features ; iter ; iter = g_list_next(iter)) { - if (strcmp(iter->data, cap) == 0) { - purple_debug_info("jabber", "Found cap: %s\n", (char *)iter->data); - return TRUE; - } - } + node = g_list_find_custom(jbr->caps->features, cap, (GCompareFunc)strcmp); + /* TODO: Are these messages actually useful? */ + if (node) + purple_debug_info("jabber", "Found cap: %s\n", cap); + else + purple_debug_info("jabber", "Cap %s not found\n", cap); - purple_debug_info("jabber", "Cap %s not found\n", cap); - return FALSE; + return (node != NULL); } gboolean