diff options
author | James Booth <boothj5@gmail.com> | 2012-10-27 19:34:26 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-10-27 19:34:26 +0100 |
commit | d4fb72f6c9fd4d646afff94db86b7345d6a96d71 (patch) | |
tree | 97e2c0482da9ade2ffcc3895ebf4b33160dc66cc /src/command.c | |
parent | 053a5f3120bec49bf4d9cbf9264ba03faa033533 (diff) | |
parent | 847850742c55876676e22e6b7918361dfe086145 (diff) | |
download | profani-tty-d4fb72f6c9fd4d646afff94db86b7345d6a96d71.tar.gz |
Merge branch 'master' into chatstates
Conflicts: docs/profanity.1
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..."); |