1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Changed room help colour, added whitespace after invalid field setting

This commit is contained in:
James Booth 2014-10-24 00:21:00 +01:00
parent 0b61c75969
commit 5fc35bd6a6
2 changed files with 19 additions and 4 deletions

View File

@ -1835,6 +1835,7 @@ cmd_form_field(char *tag, gchar **args)
} else { } else {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
} }
break; break;
@ -1845,6 +1846,7 @@ cmd_form_field(char *tag, gchar **args)
if (value == NULL) { if (value == NULL) {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
} else { } else {
form_set_value(form, tag, value); form_set_value(form, tag, value);
ui_current_print_line("Field updated..."); ui_current_print_line("Field updated...");
@ -1856,6 +1858,7 @@ cmd_form_field(char *tag, gchar **args)
if ((value == NULL) || !form_field_contains_option(form, tag, value)) { if ((value == NULL) || !form_field_contains_option(form, tag, value)) {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
} else { } else {
form_set_value(form, tag, value); form_set_value(form, tag, value);
ui_current_print_line("Field updated..."); ui_current_print_line("Field updated...");
@ -1871,11 +1874,13 @@ cmd_form_field(char *tag, gchar **args)
if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) { if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
break; break;
} }
if (value == NULL) { if (value == NULL) {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
break; break;
} }
if (g_strcmp0(cmd, "add") == 0) { if (g_strcmp0(cmd, "add") == 0) {
@ -1888,11 +1893,13 @@ cmd_form_field(char *tag, gchar **args)
if (!g_str_has_prefix(value, "val")) { if (!g_str_has_prefix(value, "val")) {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
break; break;
} }
if (strlen(value) < 4) { if (strlen(value) < 4) {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
break; break;
} }
@ -1900,6 +1907,7 @@ cmd_form_field(char *tag, gchar **args)
if ((index < 1) || (index > form_get_value_count(form, tag))) { if ((index < 1) || (index > form_get_value_count(form, tag))) {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
break; break;
} }
@ -1920,11 +1928,13 @@ cmd_form_field(char *tag, gchar **args)
if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) { if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
break; break;
} }
if (value == NULL) { if (value == NULL) {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
break; break;
} }
if (g_strcmp0(args[0], "add") == 0) { if (g_strcmp0(args[0], "add") == 0) {
@ -1940,6 +1950,7 @@ cmd_form_field(char *tag, gchar **args)
} else { } else {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
} }
break; break;
} }
@ -1956,6 +1967,7 @@ cmd_form_field(char *tag, gchar **args)
} else { } else {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
} }
} }
break; break;
@ -1967,11 +1979,13 @@ cmd_form_field(char *tag, gchar **args)
if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) { if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
break; break;
} }
if (value == NULL) { if (value == NULL) {
ui_current_print_line("Invalid command, usage:"); ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(current, form, tag); ui_show_form_field_help(current, form, tag);
ui_current_print_line("");
break; break;
} }
if (g_strcmp0(args[0], "add") == 0) { if (g_strcmp0(args[0], "add") == 0) {

View File

@ -2556,7 +2556,8 @@ static void
_ui_show_form(ProfWin *window, const char * const room, DataForm *form) _ui_show_form(ProfWin *window, const char * const room, DataForm *form)
{ {
if (form->title != NULL) { if (form->title != NULL) {
win_save_print(window, '-', NULL, 0, 0, "", form->title); win_save_print(window, '-', NULL, NO_EOL, 0, "", "Form title: ");
win_save_print(window, '-', NULL, NO_DATE, 0, "", form->title);
} else { } else {
win_save_vprint(window, '-', NULL, 0, 0, "", "Configuration for room %s.", room); win_save_vprint(window, '-', NULL, 0, 0, "", "Configuration for room %s.", room);
} }
@ -2607,9 +2608,9 @@ _ui_handle_room_configuration(const char * const room, DataForm *form)
ui_show_form(window, room, form); ui_show_form(window, room, form);
win_save_print(window, '-', NULL, 0, 0, "", ""); win_save_print(window, '-', NULL, 0, 0, "", "");
win_save_print(window, '-', NULL, 0, COLOUR_ROOMINFO, "", "Use '/form submit' to save changes."); win_save_print(window, '-', NULL, 0, 0, "", "Use '/form submit' to save changes.");
win_save_print(window, '-', NULL, 0, COLOUR_ROOMINFO, "", "Use '/form cancel' to cancel changes."); win_save_print(window, '-', NULL, 0, 0, "", "Use '/form cancel' to cancel changes.");
win_save_print(window, '-', NULL, 0, COLOUR_ROOMINFO, "", "See '/form help' for more information."); win_save_print(window, '-', NULL, 0, 0, "", "See '/form help' for more information.");
win_save_print(window, '-', NULL, 0, 0, "", ""); win_save_print(window, '-', NULL, 0, 0, "", "");
} }