Mercurial > pidgin
changeset 21689:882ac6616de9
merge of '29f8aed19e209a53a63c57cf872bc9f446d84aeb'
and '680ead8ac23fbdc99bd7178248a4cdf0bec54307'
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 29 Nov 2007 23:18:51 +0000 |
parents | 6f4ffdc65230 (diff) 280f622cb9b0 (current diff) |
children | 33285f8f68ba |
files | |
diffstat | 2 files changed, 25 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/caps.c Thu Nov 29 15:47:24 2007 +0000 +++ b/libpurple/protocols/jabber/caps.c Thu Nov 29 23:18:51 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;
--- a/libpurple/protocols/jabber/presence.c Thu Nov 29 15:47:24 2007 +0000 +++ b/libpurple/protocols/jabber/presence.c Thu Nov 29 23:18:51 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); }