1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Added field updated message, show form mofified indicator for /wins

This commit is contained in:
James Booth 2014-09-17 00:49:06 +01:00
parent 0de9c1bdda
commit 60eedc7c6d
2 changed files with 13 additions and 0 deletions

View File

@ -1877,14 +1877,17 @@ cmd_form(gchar **args, struct cmd_help_t help)
case FIELD_TEXT_PRIVATE:
case FIELD_JID_SINGLE:
form_set_value(current->form, tag, value);
ui_current_print_line("Field updated...");
ui_show_form_field(current, current->form, tag);
break;
case FIELD_BOOLEAN:
if (g_strcmp0(value, "on") == 0) {
form_set_value(current->form, tag, "1");
ui_current_print_line("Field updated...");
ui_show_form_field(current, current->form, tag);
} else if (g_strcmp0(value, "off") == 0) {
form_set_value(current->form, tag, "0");
ui_current_print_line("Field updated...");
ui_show_form_field(current, current->form, tag);
} else {
ui_current_print_line("Value %s not valid for boolean field: %s", value, tag);
@ -1894,6 +1897,7 @@ cmd_form(gchar **args, struct cmd_help_t help)
valid = form_field_contains_option(current->form, tag, value);
if (valid == TRUE) {
form_set_value(current->form, tag, value);
ui_current_print_line("Field updated...");
ui_show_form_field(current, current->form, tag);
} else {
ui_current_print_line("Value %s not a valid option for field: %s", value, tag);
@ -1935,6 +1939,7 @@ cmd_form(gchar **args, struct cmd_help_t help)
if (valid) {
added = form_add_unique_value(current->form, tag, value);
if (added) {
ui_current_print_line("Field updated...");
ui_show_form_field(current, current->form, tag);
} else {
ui_current_print_line("Value %s already selected for %s", value, tag);
@ -1945,11 +1950,13 @@ cmd_form(gchar **args, struct cmd_help_t help)
break;
case FIELD_TEXT_MULTI:
form_add_value(current->form, tag, value);
ui_current_print_line("Field updated...");
ui_show_form_field(current, current->form, tag);
break;
case FIELD_JID_MULTI:
added = form_add_unique_value(current->form, tag, value);
if (added) {
ui_current_print_line("Field updated...");
ui_show_form_field(current, current->form, tag);
} else {
ui_current_print_line("JID %s already exists in %s", value, tag);
@ -1991,6 +1998,7 @@ cmd_form(gchar **args, struct cmd_help_t help)
if (valid == TRUE) {
removed = form_remove_value(current->form, tag, value);
if (removed) {
ui_current_print_line("Field updated...");
ui_show_form_field(current, current->form, tag);
} else {
ui_current_print_line("Value %s is not currently set for %s", value, tag);
@ -2017,6 +2025,7 @@ cmd_form(gchar **args, struct cmd_help_t help)
removed = form_remove_text_multi_value(current->form, tag, index);
if (removed) {
ui_current_print_line("Field updated...");
ui_show_form_field(current, current->form, tag);
} else {
ui_current_print_line("Could not remove %s from %s", value, tag);
@ -2025,6 +2034,7 @@ cmd_form(gchar **args, struct cmd_help_t help)
case FIELD_JID_MULTI:
removed = form_remove_value(current->form, tag, value);
if (removed) {
ui_current_print_line("Field updated...");
ui_show_form_field(current, current->form, tag);
} else {
ui_current_print_line("Field %s does not contain %s", tag, value);

View File

@ -618,6 +618,9 @@ wins_create_summary(void)
case WIN_MUC_CONFIG:
muc_config_string = g_string_new("");
g_string_printf(muc_config_string, "%d: %s", ui_index, window->from);
if ((window->form != NULL) && (window->form->modified)) {
g_string_append(muc_config_string, " *");
}
result = g_slist_append(result, strdup(muc_config_string->str));
g_string_free(muc_config_string, TRUE);