about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/message.c8
-rw-r--r--src/xmpp/message.h1
-rw-r--r--src/xmpp/session.c1
3 files changed, 10 insertions, 0 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 47cf35d7..9f0ffb2b 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -179,6 +179,14 @@ message_handlers_init(void)
 }
 
 void
+message_handlers_clear(void)
+{
+    if (pubsub_event_handlers) {
+        g_hash_table_remove_all(pubsub_event_handlers);
+    }
+}
+
+void
 message_pubsub_event_handler_add(const char *const node, ProfMessageCallback func, ProfMessageFreeCallback free_func, void *userdata)
 {
     ProfMessageHandler *handler = malloc(sizeof(ProfMessageHandler));
diff --git a/src/xmpp/message.h b/src/xmpp/message.h
index 0c81ca39..a42644fd 100644
--- a/src/xmpp/message.h
+++ b/src/xmpp/message.h
@@ -39,6 +39,7 @@ typedef int(*ProfMessageCallback)(xmpp_stanza_t *const stanza, void *const userd
 typedef void(*ProfMessageFreeCallback)(void *userdata);
 
 void message_handlers_init(void);
+void message_handlers_clear(void);
 void message_pubsub_event_handler_add(const char *const node, ProfMessageCallback func, ProfMessageFreeCallback free_func, void *userdata);
 
 #endif
diff --git a/src/xmpp/session.c b/src/xmpp/session.c
index 787dc0b3..1d873012 100644
--- a/src/xmpp/session.c
+++ b/src/xmpp/session.c
@@ -216,6 +216,7 @@ session_disconnect(void)
         iq_handlers_clear();
 
         connection_disconnect();
+        message_handlers_clear();
 
         connection_clear_data();
         chat_sessions_clear();