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

Lowercase barejid in Jid

This commit is contained in:
James Booth 2015-02-23 23:44:34 +00:00
parent b0176d050f
commit 70b923a7fc
2 changed files with 8 additions and 2 deletions

View File

@ -88,11 +88,12 @@ jid_create(const gchar * const str)
if (slashp != NULL) { if (slashp != NULL) {
result->resourcepart = g_strdup(slashp + 1); result->resourcepart = g_strdup(slashp + 1);
result->domainpart = g_utf8_substring(domain_start, 0, g_utf8_pointer_to_offset(domain_start, slashp)); result->domainpart = g_utf8_substring(domain_start, 0, g_utf8_pointer_to_offset(domain_start, slashp));
result->barejid = g_utf8_substring(trimmed, 0, g_utf8_pointer_to_offset(trimmed, slashp)); char *barejidraw = g_utf8_substring(trimmed, 0, g_utf8_pointer_to_offset(trimmed, slashp));
result->barejid = g_utf8_strdown(barejidraw, -1);
result->fulljid = g_strdup(trimmed); result->fulljid = g_strdup(trimmed);
} else { } else {
result->domainpart = g_strdup(domain_start); result->domainpart = g_strdup(domain_start);
result->barejid = g_strdup(trimmed); result->barejid = g_utf8_strdown(trimmed, -1);
} }
if (result->domainpart == NULL) { if (result->domainpart == NULL) {
@ -144,7 +145,9 @@ jid_is_valid_room_form(Jid *jid)
char * char *
create_fulljid(const char * const barejid, const char * const resource) create_fulljid(const char * const barejid, const char * const resource)
{ {
gchar *barejidlower = g_utf8_strdown(barejid, -1);
GString *full_jid = g_string_new(barejid); GString *full_jid = g_string_new(barejid);
g_free(barejidlower);
g_string_append(full_jid, "/"); g_string_append(full_jid, "/");
g_string_append(full_jid, resource); g_string_append(full_jid, resource);

View File

@ -285,6 +285,8 @@ _roster_set_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
} }
} }
g_free(barejid_lower);
return 1; return 1;
} }
@ -324,6 +326,7 @@ _roster_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
log_warning("Attempt to add contact twice: %s", barejid_lower); log_warning("Attempt to add contact twice: %s", barejid_lower);
} }
g_free(barejid_lower);
item = xmpp_stanza_get_next(item); item = xmpp_stanza_get_next(item);
} }