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-09-10 23:05:35 +0100
committerJames Booth <boothj5@gmail.com>2014-09-10 23:05:35 +0100
commiteba3a7cb303af47624ea890e2c3164010684e60f (patch)
treebae0fd04c2deee50ee3c12ad3ad67782e579bb76 /src/command/commands.c
parent5aa75b1f8bbd71c8d617f78c34123a08eeee9bce (diff)
downloadprofani-tty-eba3a7cb303af47624ea890e2c3164010684e60f.tar.gz
Implemented /room config submit for saving room configuration
Diffstat (limited to 'src/command/commands.c')
-rw-r--r--src/command/commands.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 17eb9157..8dc351aa 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -1798,7 +1798,7 @@ cmd_room(gchar **args, struct cmd_help_t help)
     }
 
     win_type_t win_type = ui_current_win_type();
-    if (win_type != WIN_MUC) {
+    if (win_type != WIN_MUC && win_type != WIN_MUC_CONFIG) {
         cons_show("Command /room only usable in chat rooms.");
         return TRUE;
     }
@@ -1811,6 +1811,7 @@ cmd_room(gchar **args, struct cmd_help_t help)
     if ((g_strcmp0(args[1], "accept") != 0) &&
             (g_strcmp0(args[1], "cancel") != 0) &&
             (g_strcmp0(args[1], "destroy") != 0) &&
+            (g_strcmp0(args[1], "submit") != 0) &&
             (g_strcmp0(args[1], "edit") != 0)) {
         cons_show("Usage: %s", help.usage);
         return TRUE;
@@ -1857,6 +1858,20 @@ cmd_room(gchar **args, struct cmd_help_t help)
         return TRUE;
     }
 
+    if (g_strcmp0(args[1], "submit") == 0) {
+        ProfWin *current = wins_get_current();
+        if (current->type != WIN_MUC_CONFIG) {
+            cons_show("Room configuration can only be submitted when in the room configuration window.");
+            return TRUE;
+        } else {
+            gchar **split_recipient = g_strsplit(room, " ", 2);
+            room = split_recipient[0];
+            iq_submit_room_config(room, current->form);
+            g_strfreev(split_recipient);
+            return TRUE;
+        }
+    }
+
     if (g_strcmp0(args[1], "cancel") == 0) {
         iq_room_config_cancel(room);
         return TRUE;