diff options
author | James Booth <boothj5@gmail.com> | 2013-08-05 23:08:30 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-08-05 23:08:30 +0100 |
commit | c6e9a7455d1aa34c0b8386c8e6bc8f855cb29a2a (patch) | |
tree | 577eb73432ac6430cd3acaaef592b24f61bba2b1 /src/xmpp | |
parent | 1525be613303e0682a6fb78c5457d53207b05936 (diff) | |
download | profani-tty-c6e9a7455d1aa34c0b8386c8e6bc8f855cb29a2a.tar.gz |
Undo change to stanza check for nick change return value
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/presence.c | 4 | ||||
-rw-r--r-- | src/xmpp/stanza.c | 34 | ||||
-rw-r--r-- | src/xmpp/stanza.h | 2 |
3 files changed, 12 insertions, 28 deletions
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c index 63462a56..c05ba198 100644 --- a/src/xmpp/presence.c +++ b/src/xmpp/presence.c @@ -567,7 +567,7 @@ _room_presence_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, // handle self presence if (stanza_is_muc_self_presence(stanza, jabber_get_fulljid())) { char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE); - char *new_nick = stanza_is_room_nick_change(stanza); + char *new_nick = stanza_get_new_nick(stanza); if ((type != NULL) && (strcmp(type, STANZA_TYPE_UNAVAILABLE) == 0)) { @@ -606,7 +606,7 @@ _room_presence_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, if ((type != NULL) && (strcmp(type, STANZA_TYPE_UNAVAILABLE) == 0)) { // handle nickname change - if (stanza_is_room_nick_change(stanza) != NULL) { + if (stanza_is_room_nick_change(stanza)) { char *new_nick = stanza_get_new_nick(stanza); muc_set_roster_pending_nick_change(room, new_nick, nick); } else { diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c index f4259d6f..4d232b7b 100644 --- a/src/xmpp/stanza.c +++ b/src/xmpp/stanza.c @@ -543,62 +543,46 @@ stanza_is_muc_self_presence(xmpp_stanza_t * const stanza, return FALSE; } -char * +gboolean stanza_is_room_nick_change(xmpp_stanza_t * const stanza) { if (stanza == NULL) { - return NULL; + return FALSE; } if (strcmp(xmpp_stanza_get_name(stanza), STANZA_NAME_PRESENCE) != 0) { - return NULL; + return FALSE; } xmpp_stanza_t *x = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_X); if (x == NULL) { - return NULL; + return FALSE; } char *ns = xmpp_stanza_get_ns(x); if (ns == NULL) { - return NULL; + return FALSE; } if (strcmp(ns, STANZA_NS_MUC_USER) != 0) { - return NULL; + return FALSE; } xmpp_stanza_t *x_children = xmpp_stanza_get_children(x); if (x_children == NULL) { - return NULL; + return FALSE; } - gboolean is_nick_change = FALSE; while (x_children != NULL) { if (strcmp(xmpp_stanza_get_name(x_children), STANZA_NAME_STATUS) == 0) { char *code = xmpp_stanza_get_attribute(x_children, STANZA_ATTR_CODE); if (strcmp(code, "303") == 0) { - is_nick_change = TRUE; - break; + return TRUE; } } x_children = xmpp_stanza_get_next(x_children); } - if (is_nick_change) { - xmpp_stanza_t *x_children = xmpp_stanza_get_children(x); - while (x_children != NULL) { - if (strcmp(xmpp_stanza_get_name(x_children), STANZA_NAME_ITEM) == 0) { - char *new_nick = xmpp_stanza_get_attribute(x_children, STANZA_ATTR_NICK); - if (new_nick != NULL) { - return new_nick; - } - } - - x_children = xmpp_stanza_get_next(x_children); - } - } - - return NULL; + return FALSE; } char * diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h index 50b14c75..ad777f24 100644 --- a/src/xmpp/stanza.h +++ b/src/xmpp/stanza.h @@ -146,7 +146,7 @@ gboolean stanza_get_delay(xmpp_stanza_t * const stanza, GTimeVal *tv_stamp); gboolean stanza_is_muc_presence(xmpp_stanza_t * const stanza); gboolean stanza_is_muc_self_presence(xmpp_stanza_t * const stanza, const char * const self_jid); -char * stanza_is_room_nick_change(xmpp_stanza_t * const stanza); +gboolean stanza_is_room_nick_change(xmpp_stanza_t * const stanza); char * stanza_get_new_nick(xmpp_stanza_t * const stanza); |