cpw.malu.xmpp.idle: 434c704e: Patch from darkrain42

malu at pidgin.im malu at pidgin.im
Tue Nov 18 15:30:36 EST 2008


-----------------------------------------------------------------
Revision: 434c704edf18753d8e5b5148fdca3e3c83c3f018
Ancestor: 964c1a52f7853fd5b99ca0d000fd0dfb83aca9ac
Author: malu at pidgin.im
Date: 2008-11-18T20:22:57
Branch: im.pidgin.cpw.malu.xmpp.idle
URL: http://d.pidgin.im/viewmtn/revision/info/434c704edf18753d8e5b5148fdca3e3c83c3f018

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

ChangeLog: 

Patch from darkrain42
Introduce a temporary variable to aid in readability

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/buddy.c	b687d1cce701f26584534067479bb48e29893101
+++ libpurple/protocols/jabber/buddy.c	c31ae1b757e2fd617a1e8aafd951febd00d71904
@@ -99,19 +99,20 @@ JabberBuddyResource *jabber_buddy_find_r
 
 	for(l = jb->resources; l; l = l->next)
 	{
+		JabberBuddyResource *tmp = l->data;
 		if(!jbr && !resource) {
-			jbr = l->data;
+			jbr = tmp;
 		} else if(!resource) {
-			if(((JabberBuddyResource *)l->data)->priority > jbr->priority)
-				jbr = l->data;
-			else if(((JabberBuddyResource *)l->data)->priority == jbr->priority) {
+			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;
+							jbr = tmp;
 						break;
 					case JABBER_BUDDY_STATE_AWAY:
 					case JABBER_BUDDY_STATE_DND:
@@ -119,12 +120,12 @@ JabberBuddyResource *jabber_buddy_find_r
 						/* 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 = l->data;
+							jbr = tmp;
 						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 = l->data;
+							jbr = tmp;
 						break;
 					case JABBER_BUDDY_STATE_UNKNOWN:
 					case JABBER_BUDDY_STATE_ERROR:
@@ -132,9 +133,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