diff options
Diffstat (limited to 'src/command.c')
-rw-r--r-- | src/command.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/command.c b/src/command.c index b30e9cae..361f53b4 100644 --- a/src/command.c +++ b/src/command.c @@ -65,6 +65,7 @@ static gboolean _cmd_about(const char * const inp, struct cmd_help_t help); static gboolean _cmd_prefs(const char * const inp, struct cmd_help_t help); static gboolean _cmd_who(const char * const inp, struct cmd_help_t help); static gboolean _cmd_connect(const char * const inp, struct cmd_help_t help); +static gboolean _cmd_disconnect(const char * const inp, struct cmd_help_t help); static gboolean _cmd_msg(const char * const inp, struct cmd_help_t help); static gboolean _cmd_tiny(const char * const inp, struct cmd_help_t help); static gboolean _cmd_close(const char * const inp, struct cmd_help_t help); @@ -124,6 +125,15 @@ static struct cmd_t main_commands[] = "Example: /connect myuser@gmail.com", NULL } } }, + { "/disconnect", + _cmd_disconnect, + { "/disconnect", "Logout of current jabber session.", + { "/disconnect", + "------------------", + "Disconnect from the current jabber session.", + "See the /connect command for connecting again.", + NULL } } }, + { "/prefs", _cmd_prefs, { "/prefs", "Show current preferences.", @@ -272,7 +282,7 @@ static struct cmd_t setting_commands[] = "Config file section : [ui]", "Config file value : showsplash=true|false", NULL } } }, - + { "/vercheck", _cmd_vercheck, { "/vercheck [on|off]", "Check for a new release.", @@ -565,6 +575,23 @@ _cmd_connect(const char * const inp, struct cmd_help_t help) } static gboolean +_cmd_disconnect(const char * const inp, 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); + free(jid); + } else { + cons_show("You are not currently connected."); + } + + return TRUE; +} + +static gboolean _cmd_quit(const char * const inp, struct cmd_help_t help) { log_info("Profanity is shutting down..."); |