soc.2009.vulture: 22a09446: For buddy-list nodes, cache text even of...

gdick at soc.pidgin.im gdick at soc.pidgin.im
Sat Aug 8 16:06:23 EDT 2009


-----------------------------------------------------------------
Revision: 22a09446f5090776e2e30b6168b41a3cd0d81489
Ancestor: 266f22a3477b94385b6252f6c9e2cb455f822cf8
Author: gdick at soc.pidgin.im
Date: 2009-08-07T19:19:55
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/22a09446f5090776e2e30b6168b41a3cd0d81489

Modified files:
        vulture/purpleblist.c

ChangeLog: 

For buddy-list nodes, cache text even of those that we don't show.

-------------- next part --------------
============================================================
--- vulture/purpleblist.c	15de20fd007925f20e4f6a5118886e30ced7a321
+++ vulture/purpleblist.c	5154d3d7a5fbd9ee8e94cea4b35aa9c7436e86a5
@@ -84,65 +84,65 @@ void PurpleBlistUpdateNode(PurpleBuddyLi
 	}
 
 	EnterCriticalSection(&lpvbn->cs);
+	{
+		const char *szNodeText;
 
-		if(ShouldShowNode(lpblistnode))
-		{
-			const char *szNodeText;
+		if(lpvbn->lpvbnParent) VultureBListNodeRelease(lpvbn->lpvbnParent);
 
-			if(lpvbn->lpvbnParent) VultureBListNodeRelease(lpvbn->lpvbnParent);
+		/* Parents are not necessarily initialised before
+		 * children.
+		 */
+		if(lpblistnode->parent && !lpblistnode->parent->ui_data)
+			PurpleBlistUpdateNode(lpbuddylist, lpblistnode->parent);
 
-			/* Parents are not necessarily initialised before
-			 * children.
-			 */
-			if(lpblistnode->parent && !lpblistnode->parent->ui_data)
-				PurpleBlistUpdateNode(lpbuddylist, lpblistnode->parent);
+		lpvbn->lpvbnParent = lpblistnode->parent ? (VULTURE_BLIST_NODE*)lpblistnode->parent->ui_data : NULL;
+		if(lpvbn->lpvbnParent) VultureBListNodeAddRef(lpvbn->lpvbnParent);
 
-			lpvbn->lpvbnParent = lpblistnode->parent ? (VULTURE_BLIST_NODE*)lpblistnode->parent->ui_data : NULL;
-			if(lpvbn->lpvbnParent) VultureBListNodeAddRef(lpvbn->lpvbnParent);
+		lpvbn->nodetype = lpblistnode->type;
 
-			lpvbn->nodetype = lpblistnode->type;
+		UpdateCachedStatus(lpblistnode);
 
-			UpdateCachedStatus(lpblistnode);
+		switch(lpblistnode->type)
+		{
+		case PURPLE_BLIST_GROUP_NODE:
+			szNodeText = ((PurpleGroup*)lpblistnode)->name;
+			break;
 
-			switch(lpblistnode->type)
-			{
-			case PURPLE_BLIST_GROUP_NODE:
-				szNodeText = ((PurpleGroup*)lpblistnode)->name;
-				break;
+		case PURPLE_BLIST_CONTACT_NODE:
+			szNodeText = purple_contact_get_alias((PurpleContact*)lpblistnode);
 
-			case PURPLE_BLIST_CONTACT_NODE:
-				szNodeText = purple_contact_get_alias((PurpleContact*)lpblistnode);
+			if(!szNodeText || !(*szNodeText))
+			{
+				PurpleBuddy *lpbuddy = purple_contact_get_priority_buddy((PurpleContact*)lpblistnode);
+				szNodeText = purple_buddy_get_name(lpbuddy);
+			}
 
-				if(!szNodeText || !(*szNodeText))
-				{
-					PurpleBuddy *lpbuddy = purple_contact_get_priority_buddy((PurpleContact*)lpblistnode);
-					szNodeText = purple_buddy_get_name(lpbuddy);
-				}
+			break;
 
-				break;
+		case PURPLE_BLIST_BUDDY_NODE:
 
-			case PURPLE_BLIST_BUDDY_NODE:
+			/* Maybe our contact needs to update its status
+			 * text.
+			 */
+			UpdateCachedStatus(lpblistnode->parent);
 
-				/* Maybe our contact needs to update its status
-				 * text.
-				 */
-				UpdateCachedStatus(lpblistnode->parent);
+			szNodeText = purple_buddy_get_alias((PurpleBuddy*)lpblistnode);
 
-				szNodeText = purple_buddy_get_alias((PurpleBuddy*)lpblistnode);
+			if(szNodeText && *szNodeText)
+				break;
 
-				if(szNodeText && *szNodeText)
-					break;
+			/* Otherwise, fall through. */
 
-				/* Otherwise, fall through. */
+		default:
+			szNodeText = PURPLE_BLIST_NODE_NAME(lpblistnode);
+			break;
+		}
 
-			default:
-				szNodeText = PURPLE_BLIST_NODE_NAME(lpblistnode);
-				break;
-			}
+		if(lpvbn->szNodeText) g_free(lpvbn->szNodeText);
+		lpvbn->szNodeText = szNodeText ? VultureUTF8ToTCHAR(szNodeText) : NULL;
 
-			if(lpvbn->szNodeText) g_free(lpvbn->szNodeText);
-			lpvbn->szNodeText = szNodeText ? VultureUTF8ToTCHAR(szNodeText) : NULL;
-
+		if(ShouldShowNode(lpblistnode))
+		{
 			/* TODO: We should probably be less willing to give up. */
 			if(lpvbn->szNodeText)
 			{
@@ -182,7 +182,7 @@ void PurpleBlistUpdateNode(PurpleBuddyLi
 			if(lpvbn->lpvbnParent && lpvbn->lpvbnParent->hti)
 				PurpleBlistUpdateNode(lpbuddylist, lpvbn->lpvbnParent->lpblistnode);
 		}
-
+	}
 	LeaveCriticalSection(&lpvbn->cs);
 }
 


More information about the Commits mailing list