about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/command.c5
-rw-r--r--src/profanity.c9
-rw-r--r--src/profanity.h1
3 files changed, 11 insertions, 4 deletions
diff --git a/src/command.c b/src/command.c
index 83f37664..864c0eba 100644
--- a/src/command.c
+++ b/src/command.c
@@ -953,10 +953,7 @@ _cmd_disconnect(gchar **args, struct cmd_help_t help)
 {
     if (jabber_get_connection_status() == JABBER_CONNECTED) {
         char *jid = strdup(jabber_get_jid());
-        jabber_disconnect();
-        contact_list_clear();
-        jabber_restart();
-        cons_show("%s logged out successfully.", jid);
+        prof_handle_disconnect(jid);
         free(jid);
     } else {
         cons_show("You are not currently connected.");
diff --git a/src/profanity.c b/src/profanity.c
index a008a88a..cc6cb199 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -216,6 +216,15 @@ prof_handle_failed_login(void)
 }
 
 void
+prof_handle_disconnect(const char * const jid)
+{
+    jabber_disconnect();
+    contact_list_clear();
+    jabber_restart();
+    cons_show("%s logged out successfully.", jid);
+}
+
+void
 prof_handle_room_history(const char * const room_jid, const char * const nick,
     GTimeVal tv_stamp, const char * const message)
 {
diff --git a/src/profanity.h b/src/profanity.h
index d60e9352..a5b5b117 100644
--- a/src/profanity.h
+++ b/src/profanity.h
@@ -29,6 +29,7 @@ void prof_run(const int disable_tls, char *log_level);
 
 void prof_handle_login_success(const char *jid);
 void prof_handle_lost_connection(void);
+void prof_handle_disconnect(const char * const jid);
 void prof_handle_failed_login(void);
 void prof_handle_typing(char *from);
 void prof_handle_contact_online(char *contact, char *show, char *status);