about summary refs log tree commit diff stats
path: root/src/command/commands.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-10-09 13:16:36 +0100
committerJames Booth <boothj5@gmail.com>2014-10-09 13:16:36 +0100
commit778a495fbd708fbb1ac9c6f9eb3c4890a4a51bc3 (patch)
treeaf21682295ed35d7659bb90d5e21e6eea00a4660 /src/command/commands.c
parentf6e0a219ffb49b77a1d022ba5b33ca5c3a763c0b (diff)
downloadprofani-tty-778a495fbd708fbb1ac9c6f9eb3c4890a4a51bc3.tar.gz
Added /occupants commands, unfinished
Diffstat (limited to 'src/command/commands.c')
-rw-r--r--src/command/commands.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index ff202df4..f3f9e4eb 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -2327,6 +2327,35 @@ cmd_room(gchar **args, struct cmd_help_t help)
 }
 
 gboolean
+cmd_occupants(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 '/occupants' does not apply to this window.");
+        return TRUE;
+    }
+
+    char *room = ui_current_recipient();
+
+    if (g_strcmp0(args[0], "show") == 0) {
+        ui_room_show_occupants(room);
+    } else if (g_strcmp0(args[0], "hide") == 0) {
+        ui_room_hide_occupants(room);
+    } else {
+        cons_show("Usage: %s", help.usage);
+    }
+
+    return TRUE;
+}
+
+gboolean
 cmd_rooms(gchar **args, struct cmd_help_t help)
 {
     jabber_conn_status_t conn_status = jabber_get_connection_status();