Mercurial > pidgin
changeset 22783:f160d3f5e070
merge of '08062d1b1267b18fa3d47ea8eded7e2b826b7e8c'
and '0ed9d51dcce10da3af15dd44273af472eea6cb0c'
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 29 Apr 2008 05:39:10 +0000 |
parents | a95fcf01f72c (diff) 19dffacf8638 (current diff) |
children | cf88a302fa88 |
files | configure.ac 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 03:57:06 2008 +0000 +++ b/libpurple/protocols/jabber/buddy.c Tue Apr 29 05:39:10 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 03:57:06 2008 +0000 +++ b/libpurple/protocols/jabber/presence.c Tue Apr 29 05:39:10 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)) { @@ -741,7 +753,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); }