Mercurial > pidgin
changeset 22782:a95fcf01f72c
merge of '0e779a37ee17a7bb7ad39bbe2b37eeca45975655'
and '52c0efb045580dac7b6f5e40c91002e917e0cae3'
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 29 Apr 2008 03:14:55 +0000 |
parents | 2404b13940e9 (diff) f1a4ad1526a2 (current diff) |
children | f160d3f5e070 |
files | libpurple/protocols/jabber/presence.c |
diffstat | 2 files changed, 19 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c Tue Apr 29 02:58:23 2008 +0000 +++ b/libpurple/protocols/jabber/buddy.c Tue Apr 29 03:14:55 2008 +0000 @@ -155,12 +155,8 @@ } jbr->priority = priority; jbr->state = state; - if(jbr->status) - g_free(jbr->status); - if (status) - jbr->status = g_markup_escape_text(status, -1); - else - jbr->status = NULL; + g_free(jbr->status); + jbr->status = status != NULL ? g_markup_escape_text(status, -1) : NULL; return jbr; }
--- a/libpurple/protocols/jabber/presence.c Tue Apr 29 02:58:23 2008 +0000 +++ b/libpurple/protocols/jabber/presence.c Tue Apr 29 03:14:55 2008 +0000 @@ -369,17 +369,29 @@ typedef struct _JabberPresenceCapabilities { JabberStream *js; - JabberBuddyResource *jbr; + JabberBuddy *jb; char *from; } JabberPresenceCapabilities; static void jabber_presence_set_capabilities(JabberCapsClientInfo *info, gpointer user_data) { JabberPresenceCapabilities *userdata = user_data; + JabberID *jid; + JabberBuddyResource *jbr; GList *iter; - if(userdata->jbr->caps) - jabber_caps_free_clientinfo(userdata->jbr->caps); - userdata->jbr->caps = info; + jid = jabber_id_new(userdata->from); + jbr = jabber_buddy_find_resource(userdata->jb, jid->resource); + jabber_id_free(jid); + + if(!jbr) { + g_free(userdata->from); + g_free(userdata); + return; + } + + if(jbr->caps) + jabber_caps_free_clientinfo(jbr->caps); + jbr->caps = info; if (info) { for(iter = info->features; iter; iter = g_list_next(iter)) { @@ -742,7 +754,7 @@ if(node && ver) { JabberPresenceCapabilities *userdata = g_new0(JabberPresenceCapabilities, 1); userdata->js = js; - userdata->jbr = jbr; + userdata->jb = jb; userdata->from = g_strdup(from); jabber_caps_get_info(js, from, node, ver, ext, jabber_presence_set_capabilities, userdata); }