about summary refs log tree commit diff stats
path: root/src/event
diff options
context:
space:
mode:
Diffstat (limited to 'src/event')
-rw-r--r--src/event/client_events.c13
-rw-r--r--src/event/client_events.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/event/client_events.c b/src/event/client_events.c
index 4dcda4f3..c393ccd4 100644
--- a/src/event/client_events.c
+++ b/src/event/client_events.c
@@ -47,6 +47,7 @@
 #include "plugins/plugins.h"
 #include "ui/window_list.h"
 #include "xmpp/chat_session.h"
+#include "xmpp/session.h"
 #include "xmpp/xmpp.h"
 
 #ifdef HAVE_LIBOTR
@@ -95,6 +96,18 @@ cl_ev_disconnect(void)
 }
 
 void
+cl_ev_reconnect(void)
+{
+    if (connection_get_status() != JABBER_DISCONNECTED) {
+        connection_disconnect();
+        ev_disconnect_cleanup();
+        // on intentional disconnect reset the counter
+        ev_reset_connection_counter();
+    }
+    session_reconnect_now();
+}
+
+void
 cl_ev_presence_send(const resource_presence_t presence_type, const int idle_secs)
 {
     char* signed_status = NULL;
diff --git a/src/event/client_events.h b/src/event/client_events.h
index fed2bb37..a35e97b5 100644
--- a/src/event/client_events.h
+++ b/src/event/client_events.h
@@ -42,6 +42,7 @@ jabber_conn_status_t cl_ev_connect_jid(const char* const jid, const char* const
 jabber_conn_status_t cl_ev_connect_account(ProfAccount* account);
 
 void cl_ev_disconnect(void);
+void cl_ev_reconnect(void);
 
 void cl_ev_presence_send(const resource_presence_t presence_type, const int idle_secs);