From 02a4beb6febefa60fb1948a1b173d48793944f59 Mon Sep 17 00:00:00 2001 From: James Booth Date: Fri, 10 Oct 2014 13:35:50 +0100 Subject: Moved /room kick to /kick --- src/command/commands.c | 50 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 16 deletions(-) (limited to 'src/command/commands.c') diff --git a/src/command/commands.c b/src/command/commands.c index 2309b008..a50a778b 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -2107,6 +2107,40 @@ cmd_form(gchar **args, struct cmd_help_t help) return TRUE; } +gboolean +cmd_kick(gchar **args, struct cmd_help_t help) +{ + jabber_conn_status_t conn_status = jabber_get_connection_status(); + + if (conn_status != JABBER_CONNECTED) { + cons_show("You are not currently connected."); + return TRUE; + } + + win_type_t win_type = ui_current_win_type(); + if (win_type != WIN_MUC) { + cons_show("Command '/kick' only applies in chat rooms."); + return TRUE; + } + + char *room = ui_current_recipient(); + ProfWin *window = wins_get_by_recipient(room); + + char *nick = args[0]; + if (nick) { + if (muc_roster_contains_nick(room, nick)) { + char *reason = args[1]; + 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; +} + gboolean cmd_room(gchar **args, struct cmd_help_t help) { @@ -2127,7 +2161,6 @@ 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], "ban") != 0) && (g_strcmp0(args[0], "role") != 0) && (g_strcmp0(args[0], "affiliation") != 0) && @@ -2181,21 +2214,6 @@ 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], "ban") == 0) { char *jid = args[1]; if (jid) { -- cgit 1.4.1-2-gfad0 /a>) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
[colours]
bkgnd=default
titlebar=blue
titlebar.text=bold_white
titlebar.brackets=white
titlebar.unencrypted=cyan
titlebar.encrypted=white
titlebar.untrusted=cyan
titlebar.trusted=white
titlebar.online=bold_white
titlebar.offline=cyan
titlebar.away=white
titlebar.chat=bold_white
titlebar.dnd=cyan
titlebar.xa=bold_cyan
statusbar=blue
statusbar.text=bold_white
statusbar.time=bold_white
statusbar.brackets=white
statusbar.active=cyan
statusbar.new=white
main.text=blue
main.text.me=bold_cyan
main.text.them=bold_white
main.splash=bold_white
main.help.header=bold_blue
main.time=cyan
input.text=white
subscribed=bold_cyan
unsubscribed=blue
otr.started.trusted=white
otr.started.untrusted=cyan
otr.ended=cyan
otr.trusted=white
otr.untrusted=cyan
online=bold_cyan
away=bold_blue
chat=white
dnd=blue
xa=cyan
offline=bold_black
incoming=bold_cyan
mention=bold_blue
trigger=bold_blue
typing=cyan
gone=blue
error=bold_white
roominfo=white
roommention=bold_blue
roommention.term=bold_blue
roomtrigger=bold_blue
roomtrigger.term=bold_blue
me=cyan
them=white
roster.header=bold_white
roster.chat=white
roster.online=bold_cyan
roster.away=bold_blue
roster.xa=cyan
roster.dnd=blue
roster.offline=bold_black
roster.chat.active=white
roster.online.active=bold_cyan
roster.away.active=bold_blue
roster.xa.active=cyan
roster.dnd.active=blue
roster.offline.active=bold_black
roster.chat.unread=white
roster.online.unread=bold_cyan
roster.away.unread=bold_blue
roster.xa.unread=cyan
roster.dnd.unread=blue
roster.offline.unread=bold_black
roster.room=cyan
roster.room.unread=bold_cyan
roster.room.mention=bold_blue
roster.room.trigger=bold_blue
occupants.header=bold_white
receipt.sent=white