plugin XEP-0050: fix handling of form submitted in the first request:
form submitted on first request (without retrieval first) was broken, this patch fixes it.
This commit is contained in:
parent
8e4e96dcbb
commit
da20bba2ab
1 changed files with 16 additions and 9 deletions
|
|
@ -580,16 +580,23 @@ class AdHocCommandHandler(XMPPHandler):
|
||||||
)
|
)
|
||||||
await self._send_error(Error.BAD_ACTION, session_id, iq_elt)
|
await self._send_error(Error.BAD_ACTION, session_id, iq_elt)
|
||||||
return
|
return
|
||||||
# This is the first request, if a initial form is specified, we return it
|
# This is the first request, if an initial form is specified, we return it
|
||||||
# directly.
|
# directly, unless the client already submitted it: we then record it as
|
||||||
|
# forms[0] and process them directly
|
||||||
if self.command.form is not None:
|
if self.command.form is not None:
|
||||||
await self._send_answer(
|
if next(command_elt.elements(data_form.NS_X_DATA, "x"), None):
|
||||||
AdHocCallbackData(form=self.command.form, status=Status.EXECUTING),
|
forms[0] = self.command.form
|
||||||
session_id,
|
page_idx = session_data_private["page_idx"] = 1
|
||||||
session_data_private,
|
else:
|
||||||
iq_elt,
|
await self._send_answer(
|
||||||
)
|
AdHocCallbackData(
|
||||||
return
|
form=self.command.form, status=Status.EXECUTING
|
||||||
|
),
|
||||||
|
session_id,
|
||||||
|
session_data_private,
|
||||||
|
iq_elt,
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
if action == Action.CANCEL:
|
if action == Action.CANCEL:
|
||||||
ret_data = AdHocCallbackData(form=None, status=Status.CANCELED)
|
ret_data = AdHocCallbackData(form=None, status=Status.CANCELED)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue