cpw.malu.xmpp.idle: bb697289: Fix merge
malu at pidgin.im
malu at pidgin.im
Tue Dec 2 18:00:47 EST 2008
-----------------------------------------------------------------
Revision: bb697289b68b0046f498cf9cb8fa8363622d4f2f
Ancestor: bd657b9abc1c2c15ee46b2112d94203e60cdc833
Author: malu at pidgin.im
Date: 2008-12-02T22:55:49
Branch: im.pidgin.cpw.malu.xmpp.idle
URL: http://d.pidgin.im/viewmtn/revision/info/bb697289b68b0046f498cf9cb8fa8363622d4f2f
Modified files:
libpurple/protocols/jabber/buddy.c
ChangeLog:
Fix merge
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/buddy.c 9744ae0ad1d6bf32f1b92a36b3097d7c06e1d17d
+++ libpurple/protocols/jabber/buddy.c d5314cdbab080601548620dd49c67dc997c6ef1d
@@ -99,36 +99,41 @@ JabberBuddyResource *jabber_buddy_find_r
for(l = jb->resources; l; l = l->next)
{
- if(!jbr && !resource) {
- jbr = l->data;
- } else if(!resource) {
- if(((JabberBuddyResource *)l->data)->priority > jbr->priority)
- jbr = l->data;
- else if(((JabberBuddyResource *)l->data)->priority == jbr->priority) {
+ JabberBuddyResource *tmp = (JabberBuddyResource *) l->data;
+ if (!jbr && !resource) {
+ jbr = tmp;
+ } else if (!resource) {
+ if (tmp->priority > jbr->priority)
+ jbr = tmp;
+ else if (tmp->priority == jbr->priority) {
/* Determine if this resource is more available than the one we've currently chosen */
- switch(((JabberBuddyResource *)l->data)->state) {
+ switch(tmp->state) {
case JABBER_BUDDY_STATE_ONLINE:
case JABBER_BUDDY_STATE_CHAT:
/* This resource is online/chatty. Prefer to one which isn't either. */
- if ((jbr->state != JABBER_BUDDY_STATE_ONLINE) && (jbr->state != JABBER_BUDDY_STATE_CHAT))
- jbr = l->data;
+ if (((jbr->state != JABBER_BUDDY_STATE_ONLINE) && (jbr->state != JABBER_BUDDY_STATE_CHAT))
+ || (jbr->idle && !tmp->idle)
+ || (jbr->idle && tmp->idle && tmp->idle > jbr->idle))
+ jbr = tmp;
break;
case JABBER_BUDDY_STATE_AWAY:
case JABBER_BUDDY_STATE_DND:
/* This resource is away/dnd. Prefer to one which is extended away, unavailable, or unknown. */
- if ((jbr->state == JABBER_BUDDY_STATE_XA) || (jbr->state == JABBER_BUDDY_STATE_UNAVAILABLE) ||
+ if (((jbr->state == JABBER_BUDDY_STATE_XA) || (jbr->state == JABBER_BUDDY_STATE_UNAVAILABLE) ||
(jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR))
- jbr = l->data;
+ || (jbr->idle && !tmp->idle)
+ || (jbr->idle && tmp->idle && tmp->idle > jbr->idle))
+ jbr = tmp;
break;
case JABBER_BUDDY_STATE_XA:
/* This resource is extended away. That's better than unavailable or unknown. */
if ((jbr->state == JABBER_BUDDY_STATE_UNAVAILABLE) || (jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR))
- jbr = l->data;
+ jbr = tmp;
break;
case JABBER_BUDDY_STATE_UNAVAILABLE:
/* This resource is unavailable. That's better than unknown. */
if ((jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR))
- jbr = l->data;
+ jbr = tmp;
break;
case JABBER_BUDDY_STATE_UNKNOWN:
case JABBER_BUDDY_STATE_ERROR:
@@ -136,9 +141,9 @@ JabberBuddyResource *jabber_buddy_find_r
break;
}
}
- } else if(((JabberBuddyResource *)l->data)->name) {
- if(!strcmp(((JabberBuddyResource *)l->data)->name, resource)) {
- jbr = l->data;
+ } else if(tmp->name) {
+ if(!strcmp(tmp->name, resource)) {
+ jbr = tmp;
break;
}
}
More information about the Commits
mailing list