about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-02-23 23:30:13 +0000
committerJames Booth <boothj5@gmail.com>2015-02-23 23:30:13 +0000
commitb0176d050f9eb93101ac3e5775e43e881a0060fd (patch)
tree658200a972929f5e43b26459de67d8e37b7a9f73 /src
parenta2a187892b7bb0a343b8bbe3c46dee051d534bde (diff)
downloadprofani-tty-b0176d050f9eb93101ac3e5775e43e881a0060fd.tar.gz
Lowercase barejid before searching roster
Diffstat (limited to 'src')
-rw-r--r--src/roster_list.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/roster_list.c b/src/roster_list.c
index b9a142cb..ad1864f1 100644
--- a/src/roster_list.c
+++ b/src/roster_list.c
@@ -91,7 +91,7 @@ roster_update_presence(const char * const barejid, Resource *resource,
     assert(barejid != NULL);
     assert(resource != NULL);
 
-    PContact contact = g_hash_table_lookup(contacts, barejid);
+    PContact contact = roster_get_contact(barejid);
     if (contact == NULL) {
         return FALSE;
     }
@@ -109,14 +109,18 @@ roster_update_presence(const char * const barejid, Resource *resource,
 PContact
 roster_get_contact(const char * const barejid)
 {
-    return g_hash_table_lookup(contacts, barejid);
+    gchar *barejidlower = g_utf8_strdown(barejid, -1);
+    PContact contact = g_hash_table_lookup(contacts, barejidlower);
+    g_free(barejidlower);
+
+    return contact;
 }
 
 gboolean
 roster_contact_offline(const char * const barejid,
     const char * const resource, const char * const status)
 {
-    PContact contact = g_hash_table_lookup(contacts, barejid);
+    PContact contact = roster_get_contact(barejid);
 
     if (contact == NULL) {
         return FALSE;
@@ -212,7 +216,7 @@ void
 roster_update(const char * const barejid, const char * const name,
     GSList *groups, const char * const subscription, gboolean pending_out)
 {
-    PContact contact = g_hash_table_lookup(contacts, barejid);
+    PContact contact = roster_get_contact(barejid);
     assert(contact != NULL);
 
     p_contact_set_subscription(contact, subscription);
@@ -239,7 +243,7 @@ gboolean
 roster_add(const char * const barejid, const char * const name, GSList *groups,
     const char * const subscription, gboolean pending_out)
 {
-    PContact contact = g_hash_table_lookup(contacts, barejid);
+    PContact contact = roster_get_contact(barejid);
     if (contact != NULL) {
         return FALSE;
     }