1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-07-21 18:24:14 -04:00

Renamed mucconfwin functions

This commit is contained in:
James Booth 2015-11-02 22:05:17 +00:00
parent a761ea7176
commit a3e9178ea2
5 changed files with 49 additions and 49 deletions

View File

@ -2485,14 +2485,14 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
if (g_strcmp0(value, "on") == 0) {
form_set_value(form, tag, "1");
ui_current_print_line("Field updated...");
ui_show_form_field(window, form, tag);
mucconfwin_show_form_field(window, form, tag);
} else if (g_strcmp0(value, "off") == 0) {
form_set_value(form, tag, "0");
ui_current_print_line("Field updated...");
ui_show_form_field(window, form, tag);
mucconfwin_show_form_field(window, form, tag);
} else {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
}
break;
@ -2503,24 +2503,24 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
value = args[0];
if (value == NULL) {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
} else {
form_set_value(form, tag, value);
ui_current_print_line("Field updated...");
ui_show_form_field(window, form, tag);
mucconfwin_show_form_field(window, form, tag);
}
break;
case FIELD_LIST_SINGLE:
value = args[0];
if ((value == NULL) || !form_field_contains_option(form, tag, value)) {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
} else {
form_set_value(form, tag, value);
ui_current_print_line("Field updated...");
ui_show_form_field(window, form, tag);
mucconfwin_show_form_field(window, form, tag);
}
break;
@ -2531,32 +2531,32 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
}
if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
break;
}
if (value == NULL) {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
break;
}
if (g_strcmp0(cmd, "add") == 0) {
form_add_value(form, tag, value);
ui_current_print_line("Field updated...");
ui_show_form_field(window, form, tag);
mucconfwin_show_form_field(window, form, tag);
break;
}
if (g_strcmp0(args[0], "remove") == 0) {
if (!g_str_has_prefix(value, "val")) {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
break;
}
if (strlen(value) < 4) {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
break;
}
@ -2564,7 +2564,7 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
int index = strtol(&value[3], NULL, 10);
if ((index < 1) || (index > form_get_value_count(form, tag))) {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
break;
}
@ -2572,7 +2572,7 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
removed = form_remove_text_multi_value(form, tag, index);
if (removed) {
ui_current_print_line("Field updated...");
ui_show_form_field(window, form, tag);
mucconfwin_show_form_field(window, form, tag);
} else {
ui_current_print_line("Could not remove %s from %s", value, tag);
}
@ -2585,13 +2585,13 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
}
if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
break;
}
if (value == NULL) {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
break;
}
@ -2601,13 +2601,13 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
added = form_add_unique_value(form, tag, value);
if (added) {
ui_current_print_line("Field updated...");
ui_show_form_field(window, form, tag);
mucconfwin_show_form_field(window, form, tag);
} else {
ui_current_print_line("Value %s already selected for %s", value, tag);
}
} else {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
}
break;
@ -2618,13 +2618,13 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
removed = form_remove_value(form, tag, value);
if (removed) {
ui_current_print_line("Field updated...");
ui_show_form_field(window, form, tag);
mucconfwin_show_form_field(window, form, tag);
} else {
ui_current_print_line("Value %s is not currently set for %s", value, tag);
}
} else {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
}
}
@ -2636,13 +2636,13 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
}
if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
break;
}
if (value == NULL) {
ui_current_print_line("Invalid command, usage:");
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
ui_current_print_line("");
break;
}
@ -2650,7 +2650,7 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
added = form_add_unique_value(form, tag, value);
if (added) {
ui_current_print_line("Field updated...");
ui_show_form_field(window, form, tag);
mucconfwin_show_form_field(window, form, tag);
} else {
ui_current_print_line("JID %s already exists in %s", value, tag);
}
@ -2660,7 +2660,7 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
removed = form_remove_value(form, tag, value);
if (removed) {
ui_current_print_line("Field updated...");
ui_show_form_field(window, form, tag);
mucconfwin_show_form_field(window, form, tag);
} else {
ui_current_print_line("Field %s does not contain %s", tag, value);
}
@ -2702,16 +2702,16 @@ cmd_form(ProfWin *window, const char *const command, gchar **args)
assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
if (g_strcmp0(args[0], "show") == 0) {
ui_show_form(confwin);
mucconfwin_show_form(confwin);
return TRUE;
}
if (g_strcmp0(args[0], "help") == 0) {
char *tag = args[1];
if (tag) {
ui_show_form_field_help(confwin, tag);
mucconfwin_field_help(confwin, tag);
} else {
ui_show_form_help(confwin);
mucconfwin_form_help(confwin);
const gchar **help_text = NULL;
Command *command = g_hash_table_lookup(commands, "/form");

View File

@ -39,10 +39,10 @@
#include "ui/win_types.h"
#include "window_list.h"
static void _ui_handle_form_field(ProfWin *window, char *tag, FormField *field);
static void _mucconfwin_form_field(ProfWin *window, char *tag, FormField *field);
void
ui_show_form(ProfMucConfWin *confwin)
mucconfwin_show_form(ProfMucConfWin *confwin)
{
ProfWin *window = (ProfWin*) confwin;
if (confwin->form->title) {
@ -53,7 +53,7 @@ ui_show_form(ProfMucConfWin *confwin)
}
win_print(window, '-', 0, NULL, 0, 0, "", "");
ui_show_form_help(confwin);
mucconfwin_form_help(confwin);
GSList *fields = confwin->form->fields;
GSList *curr_field = fields;
@ -67,7 +67,7 @@ ui_show_form(ProfMucConfWin *confwin)
}
} else if (g_strcmp0(field->type, "hidden") != 0 && field->var) {
char *tag = g_hash_table_lookup(confwin->form->var_to_tag, field->var);
_ui_handle_form_field(window, tag, field);
_mucconfwin_form_field(window, tag, field);
}
curr_field = g_slist_next(curr_field);
@ -75,22 +75,22 @@ ui_show_form(ProfMucConfWin *confwin)
}
void
ui_show_form_field(ProfWin *window, DataForm *form, char *tag)
mucconfwin_show_form_field(ProfWin *window, DataForm *form, char *tag)
{
FormField *field = form_get_field_by_tag(form, tag);
_ui_handle_form_field(window, tag, field);
_mucconfwin_form_field(window, tag, field);
win_println(window, 0, "");
}
void
ui_handle_room_configuration(const char *const roomjid, DataForm *form)
mucconfwin_handle_configuration(const char *const roomjid, DataForm *form)
{
ProfWin *window = wins_new_muc_config(roomjid, form);
ProfMucConfWin *confwin = (ProfMucConfWin*)window;
assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
ui_focus_win(window);
ui_show_form(confwin);
mucconfwin_show_form(confwin);
win_print(window, '-', 0, NULL, 0, 0, "", "");
win_print(window, '-', 0, NULL, 0, 0, "", "Use '/form submit' to save changes.");
@ -100,7 +100,7 @@ ui_handle_room_configuration(const char *const roomjid, DataForm *form)
}
void
ui_show_form_field_help(ProfMucConfWin *confwin, char *tag)
mucconfwin_field_help(ProfMucConfWin *confwin, char *tag)
{
ProfWin *window = (ProfWin*) confwin;
FormField *field = form_get_field_by_tag(confwin->form, tag);
@ -181,7 +181,7 @@ ui_show_form_field_help(ProfMucConfWin *confwin, char *tag)
}
void
ui_show_form_help(ProfMucConfWin *confwin)
mucconfwin_form_help(ProfMucConfWin *confwin)
{
if (confwin->form->instructions) {
ProfWin *window = (ProfWin*) confwin;
@ -192,7 +192,7 @@ ui_show_form_help(ProfMucConfWin *confwin)
}
static void
_ui_handle_form_field(ProfWin *window, char *tag, FormField *field)
_mucconfwin_form_field(ProfWin *window, char *tag, FormField *field)
{
win_vprint(window, '-', 0, NULL, NO_EOL, THEME_AWAY, "", "[%s] ", tag);
win_vprint(window, '-', 0, NULL, NO_EOL | NO_DATE, 0, "", "%s", field->label);

View File

@ -108,14 +108,14 @@ void ui_handle_recipient_error(const char *const recipient, const char *const er
void ui_handle_error(const char *const err_msg);
void ui_clear_win_title(void);
void ui_goodbye_title(void);
void ui_handle_room_configuration(const char *const roomjid, DataForm *form);
void mucconfwin_handle_configuration(const char *const roomjid, DataForm *form);
void ui_handle_room_configuration_form_error(const char *const roomjid, const char *const message);
void ui_handle_room_config_submit_result(const char *const roomjid);
void ui_handle_room_config_submit_result_error(const char *const roomjid, const char *const message);
void ui_show_form(ProfMucConfWin *confwin);
void ui_show_form_field(ProfWin *window, DataForm *form, char *tag);
void ui_show_form_help(ProfMucConfWin *confwin);
void ui_show_form_field_help(ProfMucConfWin *confwin, char *tag);
void mucconfwin_show_form(ProfMucConfWin *confwin);
void mucconfwin_show_form_field(ProfWin *window, DataForm *form, char *tag);
void mucconfwin_form_help(ProfMucConfWin *confwin);
void mucconfwin_field_help(ProfMucConfWin *confwin, char *tag);
void ui_show_lines(ProfWin *window, const gchar** lines);
void ui_redraw_all_room_rosters(void);
void ui_show_all_room_rosters(void);

View File

@ -1260,7 +1260,7 @@ _room_config_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
}
DataForm *form = form_create(x);
ui_handle_room_configuration(from, form);
mucconfwin_handle_configuration(from, form);
return 0;
}

View File

@ -244,7 +244,7 @@ void ui_handle_error(const char * const err_msg)
void ui_clear_win_title(void) {}
void ui_goodbye_title(void) {}
void ui_handle_room_configuration(const char * const roomjid, DataForm *form) {}
void mucconfwin_handle_configuration(const char * const roomjid, DataForm *form) {}
void ui_handle_room_configuration_form_error(const char * const roomjid, const char * const message) {}
void ui_handle_room_config_submit_result(const char * const roomjid) {}
void ui_handle_room_config_submit_result_error(const char * const roomjid, const char * const message) {}
@ -257,10 +257,10 @@ void mucwin_role_set_error(ProfMucWin *mucwin, const char * const nick, const ch
void mucwin_role_list_error(ProfMucWin *mucwin, const char * const role, const char * const error) {}
void mucwin_handle_role_list(ProfMucWin *mucwin, const char * const role, GSList *nicks) {}
void mucwin_kick_error(ProfMucWin *mucwin, const char * const nick, const char * const error) {}
void ui_show_form(ProfMucConfWin *confwin) {}
void ui_show_form_field(ProfWin *window, DataForm *form, char *tag) {}
void ui_show_form_help(ProfMucConfWin *confwin) {}
void ui_show_form_field_help(ProfMucConfWin *confwin, char *tag) {}
void mucconfwin_show_form(ProfMucConfWin *confwin) {}
void mucconfwin_show_form_field(ProfWin *window, DataForm *form, char *tag) {}
void mucconfwin_form_help(ProfMucConfWin *confwin) {}
void mucconfwin_field_help(ProfMucConfWin *confwin, char *tag) {}
void ui_show_lines(ProfWin *window, const gchar** lines) {}
void ui_redraw_all_room_rosters(void) {}
void ui_show_all_room_rosters(void) {}