diff options
author | Robert Robinson <rerobins@gmail.com> | 2015-09-03 10:15:41 -0600 |
---|---|---|
committer | Robert Robinson <rerobins@gmail.com> | 2015-09-03 10:15:41 -0600 |
commit | 4a24f58be26f8d5040dab2ddc3428bd989296fdb (patch) | |
tree | 278b9efca332382349b318e004ab91bfdc043e1b /sleekxmpp/plugins/xep_0050/adhoc.py | |
parent | be14f0cc52a748134e2f1e77a4d10b11e8ff8b25 (diff) | |
download | slixmpp-4a24f58be26f8d5040dab2ddc3428bd989296fdb.tar.gz slixmpp-4a24f58be26f8d5040dab2ddc3428bd989296fdb.tar.bz2 slixmpp-4a24f58be26f8d5040dab2ddc3428bd989296fdb.tar.xz slixmpp-4a24f58be26f8d5040dab2ddc3428bd989296fdb.zip |
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.
Diffstat (limited to 'sleekxmpp/plugins/xep_0050/adhoc.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0050/adhoc.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sleekxmpp/plugins/xep_0050/adhoc.py b/sleekxmpp/plugins/xep_0050/adhoc.py index 5f4ea94c..7ab659f4 100644 --- a/sleekxmpp/plugins/xep_0050/adhoc.py +++ b/sleekxmpp/plugins/xep_0050/adhoc.py @@ -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') |