diff options
author | James Booth <boothj5@gmail.com> | 2014-09-12 00:39:37 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-09-12 00:39:37 +0100 |
commit | 6c45f8ffae8adae7edc827f8f97f66e7355aff7a (patch) | |
tree | 9b86016392941ca0cfe992fd934b8db242ed29cc /src/command | |
parent | 38959e0c33f292a7824aeb64ddb6f5e2b2831206 (diff) | |
download | profani-tty-6c45f8ffae8adae7edc827f8f97f66e7355aff7a.tar.gz |
Check room config tag exists before setting
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/commands.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/command/commands.c b/src/command/commands.c index 33b93dbb..d0e906d8 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1901,19 +1901,23 @@ cmd_room(gchar **args, struct cmd_help_t help) if (args[1] != NULL) { tag = args[1]; } else { - cons_show("Usage: %s", help.usage); + ui_current_print_line("/room set command requires a field tag and value"); g_strfreev(split_recipient); return TRUE; } if (args[2] != NULL) { value = args[2]; } else { - cons_show("Usage: %s", help.usage); + ui_current_print_line("/room set command requires a field tag and value"); g_strfreev(split_recipient); return TRUE; } - form_set_value_by_tag(current->form, tag, value); - cons_show("Field set."); + if (!form_tag_exists(current->form, tag)) { + ui_current_print_line("Form does not contain a field with tag %s", tag); + } else { + form_set_value_by_tag(current->form, tag, value); + ui_current_print_line("%s set to %s", tag, value); + } } if ((g_strcmp0(args[0], "submit") == 0) || |