about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorPaul Fariello <paul@fariello.eu>2018-09-10 12:28:28 +0200
committerPaul Fariello <paul@fariello.eu>2018-09-10 12:28:28 +0200
commit6de60e7efc75d3eaa8e8d6b3676d3ee115ba0bd8 (patch)
treec46475ea949a82e7e55e9b778386dd481bfcde68 /src
parentb7556b4e414c5fd1652b1401e38298e7ba71313d (diff)
downloadprofani-tty-6de60e7efc75d3eaa8e8d6b3676d3ee115ba0bd8.tar.gz
Add support for ad-hoc response with forms
Diffstat (limited to 'src')
-rw-r--r--src/command/cmd_funcs.c4
-rw-r--r--src/xmpp/iq.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index f8c9d9e2..42f85182 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -3899,11 +3899,11 @@ cmd_form(ProfWin *window, const char *const command, gchar **args)
         return TRUE;
     }
 
-    if (g_strcmp0(args[0], "submit") == 0) {
+    if (g_strcmp0(args[0], "submit") == 0 && confwin->submit != NULL) {
         confwin->submit(confwin);
     }
 
-    if (g_strcmp0(args[0], "cancel") == 0) {
+    if (g_strcmp0(args[0], "cancel") == 0 && confwin->cancel != NULL) {
         confwin->cancel(confwin);
     }
 
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index d155a574..3b5f1990 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -1176,6 +1176,12 @@ _command_exec_response_handler(xmpp_stanza_t *const stanza, void *const userdata
             const char *value = xmpp_stanza_get_text(note);
             win_handle_command_exec_result_note(win, type, value);
         }
+        xmpp_stanza_t *x = xmpp_stanza_get_child_by_ns(cmd, STANZA_NS_DATA);
+        if (x) {
+            DataForm *form = form_create(x);
+            ProfConfWin *confwin = (ProfConfWin*)wins_new_config(from, form, NULL, NULL, NULL);
+            confwin_handle_configuration(confwin, form);
+        }
     } else if (g_strcmp0(status, "executing") == 0) {
         win_handle_command_exec_status(win, command, "executing");