about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-25 22:57:53 +0000
committerJames Booth <boothj5@gmail.com>2014-01-25 22:57:53 +0000
commite1aca3b1f6ff9cd6196bef280b29abe2dc8ef639 (patch)
tree5d703749b2edb752112a011fb9d4d140a61f5fad
parent9b825518099f5569742b2a9ad495bc6ec2d7af4d (diff)
downloadprofani-tty-e1aca3b1f6ff9cd6196bef280b29abe2dc8ef639.tar.gz
Add message and presence error handlers seperately
-rw-r--r--src/xmpp/connection.c11
-rw-r--r--src/xmpp/message.c1
-rw-r--r--src/xmpp/presence.c1
-rw-r--r--src/xmpp/roster.c1
4 files changed, 3 insertions, 11 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index 075321f7..8566a8d6 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -347,16 +347,6 @@ connection_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
     xmpp_stanza_t *error_stanza = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_ERROR);
     xmpp_stanza_t *text_stanza = xmpp_stanza_get_child_by_name(error_stanza, STANZA_NAME_TEXT);
 
-    // handle specific errors by ID
-    char *id = xmpp_stanza_get_id(stanza);
-    if (id != NULL) {
-
-        // ignore if server doesn't support bookmarks
-        if (strcmp("bookmark_init_request", id) == 0) {
-            return 1;
-        }
-    }
-
     if (error_stanza == NULL) {
         log_debug("error message without <error/> received");
     } else {
@@ -499,7 +489,6 @@ _connection_handler(xmpp_conn_t * const conn,
 
         chat_sessions_init();
 
-        xmpp_handler_add(conn, connection_error_handler, NULL, NULL, STANZA_TYPE_ERROR, ctx);
         roster_add_handlers();
         message_add_handlers();
         presence_add_handlers();
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index f93d0acf..89ea5b7d 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -57,6 +57,7 @@ message_add_handlers(void)
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
 
+    HANDLE(NULL,                 STANZA_TYPE_ERROR,      connection_error_handler);
     HANDLE(NULL,                 STANZA_TYPE_GROUPCHAT,  _groupchat_handler);
     HANDLE(NULL,                 STANZA_TYPE_CHAT,       _chat_handler);
     HANDLE(STANZA_NS_MUC_USER,   NULL,                   _muc_user_handler);
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index 2126d8a5..9b11c898 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -72,6 +72,7 @@ presence_add_handlers(void)
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
 
+    HANDLE(NULL,               STANZA_TYPE_ERROR,        connection_error_handler);
     HANDLE(STANZA_NS_MUC_USER, NULL,                     _muc_user_handler);
     HANDLE(NULL,               STANZA_TYPE_UNAVAILABLE,  _unavailable_handler);
     HANDLE(NULL,               STANZA_TYPE_SUBSCRIBE,    _subscribe_handler);
diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c
index 68e34e63..542da2d0 100644
--- a/src/xmpp/roster.c
+++ b/src/xmpp/roster.c
@@ -68,6 +68,7 @@ roster_add_handlers(void)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
+
     HANDLE(STANZA_TYPE_SET,    _roster_set_handler);
     HANDLE(STANZA_TYPE_RESULT, _roster_result_handler);
 }