XEP0050: Add support for payload in completed response
When sending the command to complete the task, the adhoc plugin does not provide the ability to send a payload from the _handle_command_complete method.
This commit is contained in:
parent
be14f0cc52
commit
4a24f58be2
1 changed files with 13 additions and 0 deletions
|
@ -425,12 +425,25 @@ class XEP_0050(BasePlugin):
|
|||
|
||||
del self.sessions[sessionid]
|
||||
|
||||
payload = session['payload']
|
||||
if payload is None:
|
||||
payload = []
|
||||
if not isinstance(payload, list):
|
||||
payload = [payload]
|
||||
|
||||
for item in payload:
|
||||
register_stanza_plugin(Command, item.__class__, iterable=True)
|
||||
|
||||
iq.reply()
|
||||
iq['command']['node'] = node
|
||||
iq['command']['sessionid'] = sessionid
|
||||
iq['command']['actions'] = []
|
||||
iq['command']['status'] = 'completed'
|
||||
iq['command']['notes'] = session['notes']
|
||||
|
||||
for item in payload:
|
||||
iq['command'].append(item)
|
||||
|
||||
iq.send()
|
||||
else:
|
||||
raise XMPPError('item-not-found')
|
||||
|
|
Loading…
Reference in a new issue