From b0176d050f9eb93101ac3e5775e43e881a0060fd Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 23 Feb 2015 23:30:13 +0000 Subject: Lowercase barejid before searching roster --- src/roster_list.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') 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; } -- cgit 1.4.1-2-gfad0