diff options
author | James Booth <boothj5@gmail.com> | 2014-09-15 22:51:53 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-09-15 22:51:53 +0100 |
commit | 6b575aa8fced566b6a2dfb5f5a9543363e211390 (patch) | |
tree | 51b5663177163da97c11bc124d2ef48ceda31abb /src/command | |
parent | c5b697dba7caff1477c7248544bb8ec5e6871ffa (diff) | |
download | profani-tty-6b575aa8fced566b6a2dfb5f5a9543363e211390.tar.gz |
Added /form show
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/command.c | 8 | ||||
-rw-r--r-- | src/command/commands.c | 7 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/command/command.c b/src/command/command.c index d0b38f55..0f820a33 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -317,12 +317,13 @@ static struct cmd_t command_defs[] = { "/form", cmd_form, parse_args, 1, 3, NULL, - { "/form submit|cancel|set|add|remove [tag value]", "Form manipulation.", - { "/form submit|cancel|set|add|remove [tag value]", - "----------------------------------------------", + { "/form show|submit|cancel|set|add|remove [tag value]", "Form manipulation.", + { "/form show|submit|cancel|set|add|remove [tag value]", + "---------------------------------------------------", "set tag value - Set tagged form field to value.", "add tag value - Add value to tagged form field.", "remove tag value - Remove value from tagged form field.", + "show - Show the current form.", "submit - Submit the current form.", "cancel - Cancel changes to the current form.", NULL } } }, @@ -1228,6 +1229,7 @@ cmd_init(void) form_ac = autocomplete_new(); autocomplete_add(form_ac, "submit"); autocomplete_add(form_ac, "cancel"); + autocomplete_add(form_ac, "show"); autocomplete_add(form_ac, "set"); autocomplete_add(form_ac, "add"); autocomplete_add(form_ac, "remove"); diff --git a/src/command/commands.c b/src/command/commands.c index c2a85b23..0f181f31 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1805,6 +1805,7 @@ cmd_form(gchar **args, struct cmd_help_t help) if ((g_strcmp0(args[0], "submit") != 0) && (g_strcmp0(args[0], "cancel") != 0) && + (g_strcmp0(args[0], "show") != 0) && (g_strcmp0(args[0], "set") != 0) && (g_strcmp0(args[0], "add") != 0) && (g_strcmp0(args[0], "remove") != 0)) { @@ -1817,6 +1818,12 @@ cmd_form(gchar **args, struct cmd_help_t help) gchar **split_recipient = g_strsplit(recipient, " ", 2); char *room = split_recipient[0]; + if (g_strcmp0(args[0], "show") == 0) { + ui_show_form(current, room, current->form); + g_strfreev(split_recipient); + return TRUE; + } + if (g_strcmp0(args[0], "submit") == 0) { iq_submit_room_config(room, current->form); |