diff options
Diffstat (limited to 'src/command/command.c')
-rw-r--r-- | src/command/command.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c index d181f48a..d5919496 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -102,6 +102,7 @@ static gboolean _cmd_tiny(gchar **args, struct cmd_help_t help); static gboolean _cmd_close(gchar **args, struct cmd_help_t help); static gboolean _cmd_clear(gchar **args, struct cmd_help_t help); static gboolean _cmd_join(gchar **args, struct cmd_help_t help); +static gboolean _cmd_leave(gchar **args, struct cmd_help_t help); static gboolean _cmd_invite(gchar **args, struct cmd_help_t help); static gboolean _cmd_invites(gchar **args, struct cmd_help_t help); static gboolean _cmd_decline(gchar **args, struct cmd_help_t help); @@ -358,6 +359,14 @@ static struct cmd_t main_commands[] = "Example : /join jdev (as user@jabber.org will join jdev@conference.jabber.org)", NULL } } }, + { "/leave", + _cmd_leave, parse_args, 0, 0, + { "/leave", "Leave a chat room.", + { "/leave", + "------", + "Leave the current chat room.", + NULL } } }, + { "/invite", _cmd_invite, parse_args_with_freetext, 1, 2, { "/invite jid [message]", "Invite contact to chat room.", @@ -2664,6 +2673,30 @@ _cmd_close(gchar **args, struct cmd_help_t help) } static gboolean +_cmd_leave(gchar **args, struct cmd_help_t help) +{ + jabber_conn_status_t conn_status = jabber_get_connection_status(); + win_type_t win_type = ui_current_win_type(); + int index = ui_current_win_index(); + + if (win_type != WIN_MUC) { + cons_show("You can only use the /leave command in a chat room."); + cons_alert(); + return TRUE; + } + + // handle leaving rooms, or chat + if (conn_status == JABBER_CONNECTED) { + ui_close_connected_win(index); + } + + // close the window + ui_close_win(index); + + return TRUE; +} + +static gboolean _cmd_set_beep(gchar **args, struct cmd_help_t help) { return _cmd_set_boolean_preference(args[0], help, "Sound", PREF_BEEP); |