cpw.malu.xmpp.idle: 6bfd4d87: Merge

malu at pidgin.im malu at pidgin.im
Tue Dec 2 18:00:47 EST 2008


-----------------------------------------------------------------
Revision: 6bfd4d87742ad77dd228039033d081fb8b68f8aa
Ancestor: 702c322c2f0f11b3d470c005d5262bb719108042
Author: malu at pidgin.im
Date: 2008-12-02T22:45:25
Branch: im.pidgin.cpw.malu.xmpp.idle
URL: http://d.pidgin.im/viewmtn/revision/info/6bfd4d87742ad77dd228039033d081fb8b68f8aa

Modified files:
        libpurple/protocols/jabber/buddy.c

ChangeLog: 

Merge

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/buddy.c	0a458ead9d2cc8ac0c9eaecafd028d3fef0956ef
+++ libpurple/protocols/jabber/buddy.c	b687d1cce701f26584534067479bb48e29893101
@@ -99,36 +99,32 @@ JabberBuddyResource *jabber_buddy_find_r
 
 	for(l = jb->resources; l; l = l->next)
 	{
-		JabberBuddyResource *tmp = l->data;
 		if(!jbr && !resource) {
-			jbr = tmp;
+			jbr = l->data;
 		} else if(!resource) {
-			if(tmp->priority > jbr->priority)
-				jbr = tmp;
-			else if(tmp->priority == jbr->priority) {
+			if(((JabberBuddyResource *)l->data)->priority > jbr->priority)
+				jbr = l->data;
+			else if(((JabberBuddyResource *)l->data)->priority == jbr->priority) {
 				/* Determine if this resource is more available than the one we've currently chosen */
-				switch(tmp->state) {
+				switch(((JabberBuddyResource *)l->data)->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->idle && !tmp->idle) || (jbr->idle && tmp->idle && tmp->idle > jbr->idle))
-							jbr = tmp;
+						if ((jbr->state != JABBER_BUDDY_STATE_ONLINE) && (jbr->state != JABBER_BUDDY_STATE_CHAT))
+							jbr = l->data;
 						break;
 					case JABBER_BUDDY_STATE_AWAY:
 					case JABBER_BUDDY_STATE_DND:
 					case JABBER_BUDDY_STATE_UNAVAILABLE:
 						/* This resource is away/dnd/unavailable. Prefer to one which is extended away or unknown. */
-						if (((jbr->state == JABBER_BUDDY_STATE_XA) || 
-							(jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR)) ||
-							(jbr->idle && !tmp->idle) || (jbr->idle && tmp->idle && tmp->idle > jbr->idle))
-							jbr = tmp;
+						if ((jbr->state == JABBER_BUDDY_STATE_XA) || 
+							(jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR))
+							jbr = l->data;
 						break;
 					case JABBER_BUDDY_STATE_XA:
 						/* This resource is extended away. That's better than unknown. */
-						if (((jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR)) ||
-							(jbr->idle && !tmp->idle) || (jbr->idle && tmp->idle && tmp->idle > jbr->idle))
-							jbr = tmp;
+						if ((jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR))
+							jbr = l->data;
 						break;
 					case JABBER_BUDDY_STATE_UNKNOWN:
 					case JABBER_BUDDY_STATE_ERROR:
@@ -136,9 +132,9 @@ JabberBuddyResource *jabber_buddy_find_r
 						break;
 				}
 			}
-		} else if(tmp->name) {
-			if(!strcmp(tmp->name, resource)) {
-				jbr = tmp;
+		} else if(((JabberBuddyResource *)l->data)->name) {
+			if(!strcmp(((JabberBuddyResource *)l->data)->name, resource)) {
+				jbr = l->data;
 				break;
 			}
 		}


More information about the Commits mailing list