1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Lowercase barejid before searching roster

This commit is contained in:
James Booth 2015-02-23 23:30:13 +00:00
parent a2a187892b
commit b0176d050f

View File

@ -91,7 +91,7 @@ roster_update_presence(const char * const barejid, Resource *resource,
assert(barejid != NULL); assert(barejid != NULL);
assert(resource != NULL); assert(resource != NULL);
PContact contact = g_hash_table_lookup(contacts, barejid); PContact contact = roster_get_contact(barejid);
if (contact == NULL) { if (contact == NULL) {
return FALSE; return FALSE;
} }
@ -109,14 +109,18 @@ roster_update_presence(const char * const barejid, Resource *resource,
PContact PContact
roster_get_contact(const char * const barejid) 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 gboolean
roster_contact_offline(const char * const barejid, roster_contact_offline(const char * const barejid,
const char * const resource, const char * const status) 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) { if (contact == NULL) {
return FALSE; return FALSE;
@ -212,7 +216,7 @@ void
roster_update(const char * const barejid, const char * const name, roster_update(const char * const barejid, const char * const name,
GSList *groups, const char * const subscription, gboolean pending_out) 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); assert(contact != NULL);
p_contact_set_subscription(contact, subscription); p_contact_set_subscription(contact, subscription);
@ -239,7 +243,7 @@ gboolean
roster_add(const char * const barejid, const char * const name, GSList *groups, roster_add(const char * const barejid, const char * const name, GSList *groups,
const char * const subscription, gboolean pending_out) const char * const subscription, gboolean pending_out)
{ {
PContact contact = g_hash_table_lookup(contacts, barejid); PContact contact = roster_get_contact(barejid);
if (contact != NULL) { if (contact != NULL) {
return FALSE; return FALSE;
} }