# HG changeset patch # User Goffi # Date 1526055639 -7200 # Node ID 0112c1f7dcf0a7c8cb71be8688f852c33522ed30 # Parent f8e4d855001edb0ac099f2a3b3e903008d637e5f plugin XEP-0050: filter form received from form-processing entity, to only keep "form" and "result" types diff -r f8e4d855001e -r 0112c1f7dcf0 sat/plugins/plugin_xep_0050.py --- a/sat/plugins/plugin_xep_0050.py Fri May 11 18:18:06 2018 +0200 +++ b/sat/plugins/plugin_xep_0050.py Fri May 11 18:20:39 2018 +0200 @@ -299,9 +299,11 @@ for note_elt in command_elt.elements(NS_COMMANDS, 'note'): notes.append((self._getDataLvl(note_elt.getAttribute('type', 'info')), unicode(note_elt))) - try: - data_elt = command_elt.elements(data_form.NS_X_DATA, 'x').next() - except StopIteration: + for data_elt in command_elt.elements(data_form.NS_X_DATA, 'x'): + if data_elt['type'] in ('form', 'result'): + break + else: + # no matching data element found if status != XEP_0050.STATUS.COMPLETED: log.warning(_("No known payload found in ad-hoc command result, aborting")) del self.requesting[session_id]