--- a/libpurple/privacy.c Wed Feb 25 20:03:08 2009 +0000 +++ b/libpurple/privacy.c Mon Mar 02 04:18:40 2009 +0000 @@ -42,12 +42,14 @@ name = g_strdup(purple_normalize(account, who)); for (l = account->permit; l != NULL; l = l->next) { - if (!purple_utf8_strcasecmp(name, (char *)l->data)) + if (g_str_equal(name, l->data)) + /* This buddy already exists */ break; } if (l != NULL) { + /* This buddy already exists, so bail out */ g_free(name); return FALSE; } @@ -86,11 +88,13 @@ name = purple_normalize(account, who); for (l = account->permit; l != NULL; l = l->next) { - if (!purple_utf8_strcasecmp(name, (char *)l->data)) + if (g_str_equal(name, l->data)) + /* We found the buddy we were looking for */ break; } if (l == NULL) + /* We didn't find the buddy we were looking for, so bail out */ return FALSE; /* We should not free l->data just yet. There can be occasions where @@ -130,12 +134,14 @@ name = g_strdup(purple_normalize(account, who)); for (l = account->deny; l != NULL; l = l->next) { - if (!purple_utf8_strcasecmp(name, purple_normalize(account, (char *)l->data))) + if (g_str_equal(name, l->data)) + /* This buddy already exists */ break; } if (l != NULL) { + /* This buddy already exists, so bail out */ g_free(name); return FALSE; } @@ -173,14 +179,16 @@ normalized = purple_normalize(account, who); for (l = account->deny; l != NULL; l = l->next) { - if (!purple_utf8_strcasecmp(normalized, (char *)l->data)) + if (g_str_equal(normalized, l->data)) + /* We found the buddy we were looking for */ break; } - buddy = purple_find_buddy(account, normalized); + if (l == NULL) + /* We didn't find the buddy we were looking for, so bail out */ + return FALSE; - if (l == NULL) - return FALSE; + buddy = purple_find_buddy(account, normalized); name = l->data; account->deny = g_slist_delete_link(account->deny, l); @@ -351,7 +359,7 @@ case PURPLE_PRIVACY_ALLOW_USERS: who = purple_normalize(account, who); for (list=account->permit; list!=NULL; list=list->next) { - if (!purple_utf8_strcasecmp(who, (char *)list->data)) + if (g_str_equal(who, list->data)) return TRUE; } return FALSE; @@ -359,7 +367,7 @@ case PURPLE_PRIVACY_DENY_USERS: who = purple_normalize(account, who); for (list=account->deny; list!=NULL; list=list->next) { - if (!purple_utf8_strcasecmp(who, (char *)list->data )) + if (g_str_equal(who, list->data)) return FALSE; } return TRUE;