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:
Robert Robinson 2015-09-03 10:15:41 -06:00
parent be14f0cc52
commit 4a24f58be2

View file

@ -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')