about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command/commands.c20
-rw-r--r--src/ui/mucconfwin.c13
-rw-r--r--src/ui/ui.h4
-rw-r--r--src/xmpp/iq.c3
4 files changed, 22 insertions, 18 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 4b4b8249..c87e3eaa 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -2485,11 +2485,11 @@ 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...");
-                mucconfwin_show_form_field(window, form, tag);
+                mucconfwin_show_form_field(confwin, form, tag);
             } else if (g_strcmp0(value, "off") == 0) {
                 form_set_value(form, tag, "0");
                 ui_current_print_line("Field updated...");
-                mucconfwin_show_form_field(window, form, tag);
+                mucconfwin_show_form_field(confwin, form, tag);
             } else {
                 ui_current_print_line("Invalid command, usage:");
                 mucconfwin_field_help(confwin, tag);
@@ -2508,7 +2508,7 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
             } else {
                 form_set_value(form, tag, value);
                 ui_current_print_line("Field updated...");
-                mucconfwin_show_form_field(window, form, tag);
+                mucconfwin_show_form_field(confwin, form, tag);
             }
             break;
         case FIELD_LIST_SINGLE:
@@ -2520,7 +2520,7 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
             } else {
                 form_set_value(form, tag, value);
                 ui_current_print_line("Field updated...");
-                mucconfwin_show_form_field(window, form, tag);
+                mucconfwin_show_form_field(confwin, form, tag);
             }
             break;
 
@@ -2544,7 +2544,7 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
             if (g_strcmp0(cmd, "add") == 0) {
                 form_add_value(form, tag, value);
                 ui_current_print_line("Field updated...");
-                mucconfwin_show_form_field(window, form, tag);
+                mucconfwin_show_form_field(confwin, form, tag);
                 break;
             }
             if (g_strcmp0(args[0], "remove") == 0) {
@@ -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...");
-                    mucconfwin_show_form_field(window, form, tag);
+                    mucconfwin_show_form_field(confwin, form, tag);
                 } else {
                     ui_current_print_line("Could not remove %s from %s", value, tag);
                 }
@@ -2601,7 +2601,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...");
-                        mucconfwin_show_form_field(window, form, tag);
+                        mucconfwin_show_form_field(confwin, form, tag);
                     } else {
                         ui_current_print_line("Value %s already selected for %s", value, tag);
                     }
@@ -2618,7 +2618,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...");
-                        mucconfwin_show_form_field(window, form, tag);
+                        mucconfwin_show_form_field(confwin, form, tag);
                     } else {
                         ui_current_print_line("Value %s is not currently set for %s", value, tag);
                     }
@@ -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...");
-                    mucconfwin_show_form_field(window, form, tag);
+                    mucconfwin_show_form_field(confwin, 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...");
-                    mucconfwin_show_form_field(window, form, tag);
+                    mucconfwin_show_form_field(confwin, form, tag);
                 } else {
                     ui_current_print_line("Field %s does not contain %s", tag, value);
                 }
diff --git a/src/ui/mucconfwin.c b/src/ui/mucconfwin.c
index 12850e1a..dd614306 100644
--- a/src/ui/mucconfwin.c
+++ b/src/ui/mucconfwin.c
@@ -75,21 +75,24 @@ mucconfwin_show_form(ProfMucConfWin *confwin)
 }
 
 void
-mucconfwin_show_form_field(ProfWin *window, DataForm *form, char *tag)
+mucconfwin_show_form_field(ProfMucConfWin *confwin, DataForm *form, char *tag)
 {
+    assert(confwin != NULL);
+
     FormField *field = form_get_field_by_tag(form, tag);
+    ProfWin *window = (ProfWin*)confwin;
     _mucconfwin_form_field(window, tag, field);
     win_println(window, 0, "");
 }
 
 void
-mucconfwin_handle_configuration(const char *const roomjid, DataForm *form)
+mucconfwin_handle_configuration(ProfMucConfWin *confwin, DataForm *form)
 {
-    ProfWin *window = wins_new_muc_config(roomjid, form);
-    ProfMucConfWin *confwin = (ProfMucConfWin*)window;
-    assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
+    assert(confwin != NULL);
 
+    ProfWin *window = (ProfWin*)confwin;
     ui_focus_win(window);
+
     mucconfwin_show_form(confwin);
 
     win_print(window, '-', 0, NULL, 0, 0, "", "");
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 2deb9514..c3d65978 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -108,12 +108,12 @@ 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 mucconfwin_handle_configuration(const char *const roomjid, DataForm *form);
+void mucconfwin_handle_configuration(ProfMucConfWin *confwin, 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 mucconfwin_show_form(ProfMucConfWin *confwin);
-void mucconfwin_show_form_field(ProfWin *window, DataForm *form, char *tag);
+void mucconfwin_show_form_field(ProfMucConfWin *confwin, 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);
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index ad5a88bf..9aa8cdb7 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -1260,7 +1260,8 @@ _room_config_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
     }
 
     DataForm *form = form_create(x);
-    mucconfwin_handle_configuration(from, form);
+    ProfMucConfWin *confwin = (ProfMucConfWin*)wins_new_muc_config(from, form);
+    mucconfwin_handle_configuration(confwin, form);
 
     return 0;
 }