changeset 17081:f6dd1f7689ee

Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
author Richard Laager <rlaager@wiktel.com>
date Mon, 14 May 2007 23:35:28 +0000
parents 4b65a67d23b8
children 7ade887fd3f6
files libpurple/protocols/novell/nmuser.c libpurple/protocols/novell/nmuser.h libpurple/protocols/novell/novell.c
diffstat 3 files changed, 18 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/novell/nmuser.c	Mon May 14 23:34:08 2007 +0000
+++ b/libpurple/protocols/novell/nmuser.c	Mon May 14 23:35:28 2007 +0000
@@ -944,7 +944,7 @@
 	}
 
 	/* Remove item from the cached list */
-	if ((node = g_slist_find_custom(*list_ptr, dn, (GCompareFunc)nm_utf8_strcasecmp))) {
+	if ((node = g_slist_find_custom(*list_ptr, dn, (GCompareFunc)purple_utf8_strcasecmp))) {
 		*list_ptr = g_slist_remove_link(*list_ptr, node);
 		g_slist_free_1(node);
 	}
@@ -1223,13 +1223,13 @@
 	locate = nm_locate_field(NM_A_LOCKED_ATTR_LIST, user->fields);
 	if (locate && locate->ptr_value) {
 		if (locate->type == NMFIELD_TYPE_UTF8 &&
-			(nm_utf8_strcasecmp(locate->ptr_value, NM_A_BLOCKING) == 0)) {
+			(purple_utf8_strcasecmp(locate->ptr_value, NM_A_BLOCKING) == 0)) {
 			user->privacy_locked = TRUE;
 		} else if (locate->type == NMFIELD_TYPE_MV ||
 				   locate->type == NMFIELD_TYPE_ARRAY) {
 			NMField *tmp = (NMField *)locate->ptr_value;
 			while (tmp && tmp->tag) {
-				if (nm_utf8_strcasecmp(tmp->ptr_value, NM_A_BLOCKING) == 0) {
+				if (purple_utf8_strcasecmp(tmp->ptr_value, NM_A_BLOCKING) == 0) {
 					user->privacy_locked = TRUE;
 					break;
 				}
@@ -1800,25 +1800,11 @@
  * Some utility functions...haven't figured out where
  * they belong yet.
  */
-gint
-nm_utf8_strcasecmp(gconstpointer str1, gconstpointer str2)
-{
-	gint rv;
-	char *str1_down = g_utf8_strdown(str1, -1);
-	char *str2_down = g_utf8_strdown(str2, -1);
-
-	rv = g_utf8_collate(str1_down, str2_down);
-
-	g_free(str1_down);
-	g_free(str2_down);
-
-	return rv;
-}
 
 gboolean
 nm_utf8_str_equal(gconstpointer str1, gconstpointer str2)
 {
-	return (nm_utf8_strcasecmp(str1, str2) == 0);
+	return (purple_utf8_strcasecmp(str1, str2) == 0);
 }
 
 char *
--- a/libpurple/protocols/novell/nmuser.h	Mon May 14 23:34:08 2007 +0000
+++ b/libpurple/protocols/novell/nmuser.h	Mon May 14 23:35:28 2007 +0000
@@ -646,18 +646,6 @@
  */
 gboolean nm_are_guids_equal(const char *guid1, const char *guid2);
 
-
-/**
- * Case insensitive compare for utf8 strings
- *
- * @param guid1	First string to compare
- * @param guid2 Second string to compare
- *
- * @return 		-1 if str1 < str2, 0 if str1 = str2, 1 if str1 > str2
- *
- */
-gint nm_utf8_strcasecmp(gconstpointer str1, gconstpointer str2);
-
 /**
  * Compare UTF8 strings for equality only (case insensitive)
  *
--- a/libpurple/protocols/novell/novell.c	Mon May 14 23:34:08 2007 +0000
+++ b/libpurple/protocols/novell/novell.c	Mon May 14 23:35:28 2007 +0000
@@ -734,14 +734,14 @@
 		if (allowed) {
 
 			if (!g_slist_find_custom(gc->account->permit,
-									 display_id, (GCompareFunc)nm_utf8_strcasecmp)) {
+									 display_id, (GCompareFunc)purple_utf8_strcasecmp)) {
 				purple_privacy_permit_add(gc->account, display_id, TRUE);
 			}
 
 		} else {
 
 			if (!g_slist_find_custom(gc->account->permit,
-									 display_id, (GCompareFunc)nm_utf8_strcasecmp)) {
+									 display_id, (GCompareFunc)purple_utf8_strcasecmp)) {
 				purple_privacy_deny_add(gc->account, display_id, TRUE);
 			}
 		}
@@ -782,7 +782,7 @@
 		if (display_id) {
 
 			if (!g_slist_find_custom(gc->account->deny,
-									 display_id, (GCompareFunc)nm_utf8_strcasecmp)) {
+									 display_id, (GCompareFunc)purple_utf8_strcasecmp)) {
 
 				purple_privacy_deny_add(gc->account, display_id, TRUE);
 			}
@@ -834,7 +834,7 @@
 
 			if (!g_slist_find_custom(gc->account->permit,
 									 display_id,
-									 (GCompareFunc)nm_utf8_strcasecmp)) {
+									 (GCompareFunc)purple_utf8_strcasecmp)) {
 
 				purple_privacy_permit_add(gc->account, display_id, TRUE);
 			}
@@ -1412,7 +1412,7 @@
 			name =(char *)node->data;
 
 		if (!g_slist_find_custom(gc->account->permit,
-								 name, (GCompareFunc)nm_utf8_strcasecmp)) {
+								 name, (GCompareFunc)purple_utf8_strcasecmp)) {
 			purple_privacy_permit_add(gc->account, name , TRUE);
 		}
 	}
@@ -1425,7 +1425,7 @@
 			name =(char *)node->data;
 
 		if (!g_slist_find_custom(gc->account->deny,
-								 name, (GCompareFunc)nm_utf8_strcasecmp)) {
+								 name, (GCompareFunc)purple_utf8_strcasecmp)) {
 			purple_privacy_deny_add(gc->account, name, TRUE);
 		}
 	}
@@ -1436,7 +1436,7 @@
 		dn = nm_lookup_dn(user, (char *)node->data);
 		if (dn != NULL &&
 			!g_slist_find_custom(user->allow_list,
-								 dn, (GCompareFunc)nm_utf8_strcasecmp)) {
+								 dn, (GCompareFunc)purple_utf8_strcasecmp)) {
 			rem_list = g_slist_append(rem_list, node->data);
 		}
 	}
@@ -1453,7 +1453,7 @@
 		dn = nm_lookup_dn(user, (char *)node->data);
 		if (dn != NULL &&
 			!g_slist_find_custom(user->deny_list,
-								 dn, (GCompareFunc)nm_utf8_strcasecmp)) {
+								 dn, (GCompareFunc)purple_utf8_strcasecmp)) {
 			rem_list = g_slist_append(rem_list, node->data);
 		}
 	}
@@ -3268,7 +3268,7 @@
 						name = nm_user_record_get_display_id(user_record);
 
 						if (!g_slist_find_custom(gc->account->permit,
-												 name, (GCompareFunc)nm_utf8_strcasecmp)) {
+												 name, (GCompareFunc)purple_utf8_strcasecmp)) {
 							purple_privacy_permit_add(gc->account, name , TRUE);
 						}
 					}
@@ -3282,7 +3282,7 @@
 						name = nm_user_record_get_display_id(user_record);
 
 						if (!g_slist_find_custom(user->allow_list,
-												 dn, (GCompareFunc)nm_utf8_strcasecmp)) {
+												 dn, (GCompareFunc)purple_utf8_strcasecmp)) {
 							rc = nm_send_create_privacy_item(user, dn, TRUE,
 															 _create_privacy_item_deny_resp_cb,
 															 g_strdup(dn));
@@ -3310,7 +3310,7 @@
 						name = nm_user_record_get_display_id(user_record);
 
 						if (!g_slist_find_custom(gc->account->deny,
-												 name, (GCompareFunc)nm_utf8_strcasecmp)) {
+												 name, (GCompareFunc)purple_utf8_strcasecmp)) {
 							purple_privacy_deny_add(gc->account, name , TRUE);
 						}
 					}
@@ -3325,7 +3325,7 @@
 						name = nm_user_record_get_display_id(user_record);
 
 						if (!g_slist_find_custom(user->deny_list,
-												 dn, (GCompareFunc)nm_utf8_strcasecmp)) {
+												 dn, (GCompareFunc)purple_utf8_strcasecmp)) {
 							rc = nm_send_create_privacy_item(user, dn, FALSE,
 															 _create_privacy_item_deny_resp_cb,
 															 g_strdup(name));
@@ -3358,7 +3358,7 @@
 				contact = nm_folder_get_contact(user->root_folder, i);
 				dn = nm_contact_get_dn(contact);
 				if (dn && !g_slist_find_custom(user->allow_list,
-											   dn, (GCompareFunc)nm_utf8_strcasecmp))
+											   dn, (GCompareFunc)purple_utf8_strcasecmp))
 				{
 					rc = nm_send_create_privacy_item(user, dn, TRUE,
 													 _create_privacy_item_deny_resp_cb,
@@ -3377,7 +3377,7 @@
 					contact = nm_folder_get_contact(folder, j);
 					dn = nm_contact_get_dn(contact);
 					if (dn && !g_slist_find_custom(user->allow_list,
-												   dn, (GCompareFunc)nm_utf8_strcasecmp))
+												   dn, (GCompareFunc)purple_utf8_strcasecmp))
 					{
 						rc = nm_send_create_privacy_item(user, dn, TRUE,
 														 _create_privacy_item_deny_resp_cb,