comparison libpurple/conversation.c @ 32174:94e1e3ed0bb0

conversation: Use the right comparison type (case-sensitive) for the hash table Okay, the various types of comparisons done on in-room nicks are annoying. Seriously, half the code seems to use g_utf8_collate, and the other half use purple_utf8_strcasecmp.
author Paul Aurich <paul@darkrain42.org>
date Wed, 22 Jun 2011 02:35:45 +0000
parents dc69d22279e5
children afb58f3ee8f0
comparison
equal deleted inserted replaced
32173:dc69d22279e5 32174:94e1e3ed0bb0
71 } 71 }
72 72
73 static guint _purple_conversation_user_hash(gconstpointer data) 73 static guint _purple_conversation_user_hash(gconstpointer data)
74 { 74 {
75 const gchar *name = data; 75 const gchar *name = data;
76 gchar *casefold, *collated; 76 gchar *collated;
77 guint hash; 77 guint hash;
78 78
79 casefold = g_utf8_casefold(name, -1); 79 collated = g_utf8_collate_key(name, -1);
80 collated = g_utf8_collate_key(casefold, -1);
81 hash = g_str_hash(collated); 80 hash = g_str_hash(collated);
82 g_free(collated); 81 g_free(collated);
83 g_free(casefold);
84 return hash; 82 return hash;
85 } 83 }
86 84
87 static gboolean _purple_conversation_user_equal(gconstpointer a, gconstpointer b) 85 static gboolean _purple_conversation_user_equal(gconstpointer a, gconstpointer b)
88 { 86 {
89 return !purple_utf8_strcasecmp(a, b); 87 return !g_utf8_collate(a, b);
90 } 88 }
91 89
92 void 90 void
93 purple_conversations_set_ui_ops(PurpleConversationUiOps *ops) 91 purple_conversations_set_ui_ops(PurpleConversationUiOps *ops)
94 { 92 {