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

Handle roster set and result when item name is empty string

fixed #431
This commit is contained in:
James Booth 2014-10-02 22:12:41 +01:00
parent bdad22e548
commit 1423ee7a75

View File

@ -245,6 +245,11 @@ _roster_set_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
const char *sub = xmpp_stanza_get_attribute(item, STANZA_ATTR_SUBSCRIPTION);
const char *ask = xmpp_stanza_get_attribute(item, STANZA_ATTR_ASK);
// do not set nickname to empty string, set to NULL instead
if (name && (strlen(name) == 0)) {
name = NULL;
}
// remove from roster
if (g_strcmp0(sub, "remove") == 0) {
// remove barejid and name
@ -290,17 +295,18 @@ _roster_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
// handle initial roster response
if (g_strcmp0(id, "roster") == 0) {
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza,
STANZA_NAME_QUERY);
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
xmpp_stanza_t *item = xmpp_stanza_get_children(query);
while (item != NULL) {
const char *barejid =
xmpp_stanza_get_attribute(item, STANZA_ATTR_JID);
const char *name =
xmpp_stanza_get_attribute(item, STANZA_ATTR_NAME);
const char *sub =
xmpp_stanza_get_attribute(item, STANZA_ATTR_SUBSCRIPTION);
const char *barejid = xmpp_stanza_get_attribute(item, STANZA_ATTR_JID);
const char *name = xmpp_stanza_get_attribute(item, STANZA_ATTR_NAME);
const char *sub = xmpp_stanza_get_attribute(item, STANZA_ATTR_SUBSCRIPTION);
// do not set nickname to empty string, set to NULL instead
if (name && (strlen(name) == 0)) {
name = NULL;
}
gboolean pending_out = FALSE;
const char *ask = xmpp_stanza_get_attribute(item, STANZA_ATTR_ASK);
@ -319,8 +325,7 @@ _roster_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
item = xmpp_stanza_get_next(item);
}
resource_presence_t conn_presence =
accounts_get_login_presence(jabber_get_account_name());
resource_presence_t conn_presence = accounts_get_login_presence(jabber_get_account_name());
presence_update(conn_presence, NULL, 0);
}