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)
|
||||
return
|
||||
# This is the first request, if a initial form is specified, we return it
|
||||
# directly.
|
||||
# This is the first request, if an initial form is specified, we return it
|
||||
# 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:
|
||||
await self._send_answer(
|
||||
AdHocCallbackData(form=self.command.form, status=Status.EXECUTING),
|
||||
session_id,
|
||||
session_data_private,
|
||||
iq_elt,
|
||||
)
|
||||
return
|
||||
if next(command_elt.elements(data_form.NS_X_DATA, "x"), None):
|
||||
forms[0] = self.command.form
|
||||
page_idx = session_data_private["page_idx"] = 1
|
||||
else:
|
||||
await self._send_answer(
|
||||
AdHocCallbackData(
|
||||
form=self.command.form, status=Status.EXECUTING
|
||||
),
|
||||
session_id,
|
||||
session_data_private,
|
||||
iq_elt,
|
||||
)
|
||||
return
|
||||
|
||||
if action == Action.CANCEL:
|
||||
ret_data = AdHocCallbackData(form=None, status=Status.CANCELED)
|
||||
|
|
|
|||
Loading…
Reference in a new issue