changeset 21792:f5d8acf1c5f4

Normalize the names appropriately when searching for accounts. This should allow finding accounts with the same username but different resources in jabber. References #2049.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 06 Dec 2007 09:52:58 +0000
parents c80d0732fa40
children f215729af7a7
files libpurple/account.c
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/account.c	Thu Dec 06 08:10:46 2007 +0000
+++ b/libpurple/account.c	Thu Dec 06 09:52:58 2007 +0000
@@ -2529,22 +2529,19 @@
 
 	g_return_val_if_fail(name != NULL, NULL);
 
-	who = g_strdup(purple_normalize(NULL, name));
-
 	for (l = purple_accounts_get_all(); l != NULL; l = l->next) {
 		account = (PurpleAccount *)l->data;
 
-		if (!strcmp(purple_normalize(NULL, purple_account_get_username(account)), who) &&
+		who = g_strdup(purple_normalize(account, name));
+		if (!strcmp(purple_normalize(account, purple_account_get_username(account)), who) &&
 			(!protocol_id || !strcmp(account->protocol_id, protocol_id))) {
-
+			g_free(who);
 			break;
 		}
-
+		g_free(who);
 		account = NULL;
 	}
 
-	g_free(who);
-
 	return account;
 }