1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-16 21:35:24 +00:00

Add support for ad-hoc response with forms

This commit is contained in:
Paul Fariello 2018-09-10 12:28:28 +02:00
parent b7556b4e41
commit 6de60e7efc
2 changed files with 8 additions and 2 deletions

View File

@ -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);
}

View File

@ -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");