# HG changeset patch # User Daniel Atallah # Date 1196378474 0 # Node ID 33285f8f68ba6c8b02dfab70dcc055e2396a2446 # Parent 882ac6616de937fa99953785d4a43275abc591ac# Parent 3f87c3265740e886c3eee4c777706b9c850d9b41 merge of '125f56f31252d721a347d2d2e379956433c1d8b5' and 'c1a40e1accb59a7d8fa230b529bf457014ed99af' diff -r 3f87c3265740 -r 33285f8f68ba libpurple/protocols/jabber/caps.c --- a/libpurple/protocols/jabber/caps.c Thu Nov 29 19:04:44 2007 +0000 +++ b/libpurple/protocols/jabber/caps.c Thu Nov 29 23:21:14 2007 +0000 @@ -257,18 +257,23 @@ /* this function assumes that all information is available locally */ static JabberCapsClientInfo *jabber_caps_collect_info(const char *node, const char *ver, GList *ext) { - JabberCapsClientInfo *result = g_new0(JabberCapsClientInfo, 1); + JabberCapsClientInfo *result; JabberCapsKey *key = g_new0(JabberCapsKey, 1); JabberCapsValue *caps; GList *iter; - + key->node = (char *)node; key->ver = (char *)ver; - + caps = g_hash_table_lookup(capstable,key); - + g_free(key); - + + if (caps == NULL) + return NULL; + + result = g_new0(JabberCapsClientInfo, 1); + /* join all information */ for(iter = caps->identities; iter; iter = g_list_next(iter)) { JabberCapsIdentity *id = iter->data; diff -r 3f87c3265740 -r 33285f8f68ba libpurple/protocols/jabber/presence.c --- a/libpurple/protocols/jabber/presence.c Thu Nov 29 19:04:44 2007 +0000 +++ b/libpurple/protocols/jabber/presence.c Thu Nov 29 23:21:14 2007 +0000 @@ -376,23 +376,26 @@ static void jabber_presence_set_capabilities(JabberCapsClientInfo *info, gpointer user_data) { JabberPresenceCapabilities *userdata = user_data; GList *iter; - + if(userdata->jbr->caps) jabber_caps_free_clientinfo(userdata->jbr->caps); userdata->jbr->caps = info; - - for(iter = info->features; iter; iter = g_list_next(iter)) { - if(!strcmp((const char*)iter->data, "http://jabber.org/protocol/commands")) { - JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items"); - xmlnode *query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#items"); - xmlnode_set_attrib(iq->node, "to", userdata->from); - xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands"); - - jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL); - jabber_iq_send(iq); - break; + + if (info) { + for(iter = info->features; iter; iter = g_list_next(iter)) { + if(!strcmp((const char*)iter->data, "http://jabber.org/protocol/commands")) { + JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items"); + xmlnode *query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#items"); + xmlnode_set_attrib(iq->node, "to", userdata->from); + xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands"); + + jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL); + jabber_iq_send(iq); + break; + } } } + g_free(userdata->from); g_free(userdata); }