pidgin: b310905b: When searching for a conversation, searc...

sadrul at pidgin.im sadrul at pidgin.im
Sat May 3 23:30:43 EDT 2008


-----------------------------------------------------------------
Revision: b310905bae44ab31bd5b3497fd091c4310f3d227
Ancestor: 5c8a08b14b2889338776d85a99ee17e521f0abcd
Author: sadrul at pidgin.im
Date: 2008-05-04T03:28:58
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b310905bae44ab31bd5b3497fd091c4310f3d227

Modified files:
        libpurple/conversation.c

ChangeLog: 

When searching for a conversation, search only in the list of the
specified type of conversation (i.e. IMs or Chats), when appropriate,
instead of the list of all conversations.

-------------- next part --------------
============================================================
--- libpurple/conversation.c	17b8b84a715854e1cab3ba81023f83cbebcc4399
+++ libpurple/conversation.c	95828c8471f8d8275df7e755117f7ed01452e577
@@ -813,14 +813,27 @@ purple_find_conversation_with_account(Pu
 
 	g_return_val_if_fail(name != NULL, NULL);
 
+	switch (type) {
+		case PURPLE_CONV_TYPE_IM:
+			cnv = purple_get_ims();
+			break;
+		case PURPLE_CONV_TYPE_CHAT:
+			cnv = purple_get_chats();
+			break;
+		case PURPLE_CONV_TYPE_ANY:
+			cnv = purple_get_conversations();
+			break;
+		default:
+			g_return_val_if_reached(NULL);
+	}
+
 	name1 = g_strdup(purple_normalize(account, name));
 
-	for (cnv = purple_get_conversations(); cnv != NULL; cnv = cnv->next) {
+	for (; cnv != NULL; cnv = cnv->next) {
 		c = (PurpleConversation *)cnv->data;
 		name2 = purple_normalize(account, purple_conversation_get_name(c));
 
-		if (((type == PURPLE_CONV_TYPE_ANY) || (type == purple_conversation_get_type(c))) &&
-				(account == purple_conversation_get_account(c)) &&
+		if ((account == purple_conversation_get_account(c)) &&
 				!purple_utf8_strcasecmp(name1, name2)) {
 
 			break;


More information about the Commits mailing list