changeset 24387:123c78e48663

Use normalized chat names when searching for chats. This fixes an issue where irc.undernet.org sends the chat-name in uppercase, and screws up persistent chats. Fixes #5028.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 15 Nov 2008 03:53:25 +0000
parents 892adcbf94c9
children a58d730c85f6
files libpurple/blist.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/blist.c	Sat Nov 15 03:17:51 2008 +0000
+++ b/libpurple/blist.c	Sat Nov 15 03:53:25 2008 +0000
@@ -2214,6 +2214,7 @@
 	struct proto_chat_entry *pce;
 	PurpleBlistNode *node, *group;
 	GList *parts;
+	char *normname;
 
 	g_return_val_if_fail(purplebuddylist != NULL, NULL);
 	g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL);
@@ -2227,6 +2228,7 @@
 	if (prpl_info->find_blist_chat != NULL)
 		return prpl_info->find_blist_chat(account, name);
 
+	normname = g_strdup(purple_normalize(account, name));
 	for (group = purplebuddylist->root; group != NULL; group = group->next) {
 		for (node = group->child; node != NULL; node = node->next) {
 			if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
@@ -2246,14 +2248,15 @@
 				g_list_free(parts);
 
 				if (chat->account == account && chat_name != NULL &&
-					name != NULL && !strcmp(chat_name, name)) {
-
+					normname != NULL && !strcmp(purple_normalize(account, chat_name), normname)) {
+					g_free(normname);
 					return chat;
 				}
 			}
 		}
 	}
 
+	g_free(normname);
 	return NULL;
 }