Changed id handlers so they are removed if they do not return true.
This commit is contained in:
@@ -34,12 +34,30 @@ void handler_fire_stanza(xmpp_conn_t * const conn,
|
|||||||
/* call id handlers */
|
/* call id handlers */
|
||||||
id = xmpp_stanza_get_id(stanza);
|
id = xmpp_stanza_get_id(stanza);
|
||||||
if (id) {
|
if (id) {
|
||||||
item = (xmpp_handlist_t *)hash_get(conn->id_handlers, id);
|
prev = NULL;
|
||||||
for (; item; item = item->next) {
|
item = (xmpp_handlist_t *)hash_get(conn->id_handlers, id);
|
||||||
if (item->user_handler && !conn->authenticated)
|
while (item) {
|
||||||
continue;
|
xmpp_handlist_t *next = item->next;
|
||||||
|
|
||||||
((xmpp_handler)(item->handler))(conn, stanza, item->userdata);
|
if (item->user_handler && !conn->authenticated) {
|
||||||
|
item = next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!((xmpp_handler)(item->handler))(conn, stanza, item->userdata)) {
|
||||||
|
/* handler is one-shot, so delete it */
|
||||||
|
if (prev)
|
||||||
|
prev->next = next;
|
||||||
|
else {
|
||||||
|
hash_drop(conn->id_handlers, id);
|
||||||
|
hash_add(conn->id_handlers, id, next);
|
||||||
|
}
|
||||||
|
xmpp_free(conn->ctx, item);
|
||||||
|
item = NULL;
|
||||||
|
}
|
||||||
|
if (item)
|
||||||
|
prev = item;
|
||||||
|
item = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user