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
@ -425,12 +425,25 @@ class XEP_0050(BasePlugin):
|
|||||||
|
|
||||||
del self.sessions[sessionid]
|
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.reply()
|
||||||
iq['command']['node'] = node
|
iq['command']['node'] = node
|
||||||
iq['command']['sessionid'] = sessionid
|
iq['command']['sessionid'] = sessionid
|
||||||
iq['command']['actions'] = []
|
iq['command']['actions'] = []
|
||||||
iq['command']['status'] = 'completed'
|
iq['command']['status'] = 'completed'
|
||||||
iq['command']['notes'] = session['notes']
|
iq['command']['notes'] = session['notes']
|
||||||
|
|
||||||
|
for item in payload:
|
||||||
|
iq['command'].append(item)
|
||||||
|
|
||||||
iq.send()
|
iq.send()
|
||||||
else:
|
else:
|
||||||
raise XMPPError('item-not-found')
|
raise XMPPError('item-not-found')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user