From ac7bc02c63a5aed8decfcbbdc5582e9e5b389030 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 5 Oct 2014 03:52:55 +0100 Subject: Added /room kick command --- src/command/command.c | 10 ++++++++++ src/command/commands.c | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'src/command') diff --git a/src/command/command.c b/src/command/command.c index 1f8977b7..90f168d1 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -1251,6 +1251,7 @@ cmd_init(void) autocomplete_add(room_ac, "config"); autocomplete_add(room_ac, "info"); autocomplete_add(room_ac, "subject"); + autocomplete_add(room_ac, "kick"); autocomplete_add(room_ac, "role"); autocomplete_add(room_ac, "affiliation"); @@ -2311,6 +2312,15 @@ _room_autocomplete(char *input, int *size) return result; } + char *recipient = ui_current_recipient(); + Autocomplete nick_ac = muc_roster_ac(recipient); + if (nick_ac != NULL) { + result = autocomplete_param_with_ac(input, size, "/room kick", nick_ac, TRUE); + if (result != NULL) { + return result; + } + } + result = autocomplete_param_with_ac(input, size, "/room", room_ac, TRUE); if (result != NULL) { return result; diff --git a/src/command/commands.c b/src/command/commands.c index ad8e93ea..39981b5f 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -2127,6 +2127,7 @@ cmd_room(gchar **args, struct cmd_help_t help) (g_strcmp0(args[0], "destroy") != 0) && (g_strcmp0(args[0], "config") != 0) && (g_strcmp0(args[0], "subject") != 0) && + (g_strcmp0(args[0], "kick") != 0) && (g_strcmp0(args[0], "role") != 0) && (g_strcmp0(args[0], "affiliation") != 0) && (g_strcmp0(args[0], "info") != 0)) { @@ -2179,6 +2180,21 @@ cmd_room(gchar **args, struct cmd_help_t help) return TRUE; } + if (g_strcmp0(args[0], "kick") == 0) { + char *nick = args[1]; + if (nick) { + if (muc_roster_contains_nick(room, nick)) { + char *reason = args[2]; + iq_room_kick_occupant(room, nick, reason); + } else { + win_save_vprint(window, '!', NULL, 0, 0, "", "Occupant does not exist: %s", nick); + } + } else { + cons_show("Usage: %s", help.usage); + } + return TRUE; + } + if (g_strcmp0(args[0], "affiliation") == 0) { char *cmd = args[1]; if (cmd == NULL) { -- cgit 1.4.1-2-gfad0