mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added form validation for boolean type
This commit is contained in:
parent
b111419693
commit
524a52d0ac
@ -1918,9 +1918,21 @@ cmd_room(gchar **args, struct cmd_help_t help)
|
||||
form_field_type_t field_type = form_get_field_type_by_tag(current->form, tag);
|
||||
switch (field_type) {
|
||||
case FIELD_TEXT_SINGLE:
|
||||
case FIELD_TEXT_PRIVATE:
|
||||
form_set_value_by_tag(current->form, tag, value);
|
||||
ui_current_print_line("%s set to %s", tag, value);
|
||||
break;
|
||||
case FIELD_BOOLEAN:
|
||||
if (g_strcmp0(value, "on") == 0) {
|
||||
form_set_value_by_tag(current->form, tag, "1");
|
||||
ui_current_print_line("%s set to %s", tag, value);
|
||||
} else if (g_strcmp0(value, "off") == 0) {
|
||||
form_set_value_by_tag(current->form, tag, "0");
|
||||
ui_current_print_line("%s set to %s", tag, value);
|
||||
} else {
|
||||
ui_current_print_line("Value %s not valid for boolean field: %s", tag, value);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ui_current_print_line("Value %s not valid for field: %s", tag, value);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user