Moved iq error handling to one place
This commit is contained in:
17
src/jabber.c
17
src/jabber.c
@@ -815,6 +815,14 @@ _iq_handler(xmpp_conn_t * const conn,
|
|||||||
char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);
|
char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);
|
||||||
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
||||||
|
|
||||||
|
if (g_strcmp0(type, "error")) {
|
||||||
|
if (id != NULL) {
|
||||||
|
log_error("IQ error received, id: %s.", id);
|
||||||
|
} else {
|
||||||
|
log_error("IQ error recieved.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// handle the initial roster request
|
// handle the initial roster request
|
||||||
if (g_strcmp0(id, "roster") == 0) {
|
if (g_strcmp0(id, "roster") == 0) {
|
||||||
return _roster_handler(conn, stanza, ctx, id, type, from);
|
return _roster_handler(conn, stanza, ctx, id, type, from);
|
||||||
@@ -926,9 +934,6 @@ _roster_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
|||||||
{
|
{
|
||||||
xmpp_stanza_t *query, *item;
|
xmpp_stanza_t *query, *item;
|
||||||
|
|
||||||
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0)
|
|
||||||
log_error("Roster query failed");
|
|
||||||
else {
|
|
||||||
query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
|
query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
|
||||||
item = xmpp_stanza_get_children(query);
|
item = xmpp_stanza_get_children(query);
|
||||||
|
|
||||||
@@ -958,7 +963,6 @@ _roster_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
|||||||
* when I set dnd status and reconnect for some reason */
|
* when I set dnd status and reconnect for some reason */
|
||||||
// send initial presence
|
// send initial presence
|
||||||
jabber_update_presence(PRESENCE_ONLINE, NULL, 0);
|
jabber_update_presence(PRESENCE_ONLINE, NULL, 0);
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1039,10 +1043,6 @@ _caps_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
|||||||
xmpp_ctx_t * ctx, const char * const id, const char * const type,
|
xmpp_ctx_t * ctx, const char * const id, const char * const type,
|
||||||
const char * const from)
|
const char * const from)
|
||||||
{
|
{
|
||||||
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
|
|
||||||
log_error("Roster query failed");
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
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);
|
||||||
char *node = xmpp_stanza_get_attribute(query, STANZA_ATTR_NODE);
|
char *node = xmpp_stanza_get_attribute(query, STANZA_ATTR_NODE);
|
||||||
if (node == NULL) {
|
if (node == NULL) {
|
||||||
@@ -1107,7 +1107,6 @@ _caps_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_ping_timed_handler(xmpp_conn_t * const conn, void * const userdata)
|
_ping_timed_handler(xmpp_conn_t * const conn, void * const userdata)
|
||||||
|
|||||||
Reference in New Issue
Block a user