Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0050.py @ 2585:0112c1f7dcf0
plugin XEP-0050: filter form received from form-processing entity, to only keep "form" and "result" types
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 11 May 2018 18:20:39 +0200 |
parents | 26edcf3a30eb |
children | 56f94936df1e |
comparison
equal
deleted
inserted
replaced
2584:f8e4d855001e | 2585:0112c1f7dcf0 |
---|---|
297 session_data['remote_id'] = remote_session_id | 297 session_data['remote_id'] = remote_session_id |
298 notes = [] | 298 notes = [] |
299 for note_elt in command_elt.elements(NS_COMMANDS, 'note'): | 299 for note_elt in command_elt.elements(NS_COMMANDS, 'note'): |
300 notes.append((self._getDataLvl(note_elt.getAttribute('type', 'info')), | 300 notes.append((self._getDataLvl(note_elt.getAttribute('type', 'info')), |
301 unicode(note_elt))) | 301 unicode(note_elt))) |
302 try: | 302 for data_elt in command_elt.elements(data_form.NS_X_DATA, 'x'): |
303 data_elt = command_elt.elements(data_form.NS_X_DATA, 'x').next() | 303 if data_elt['type'] in ('form', 'result'): |
304 except StopIteration: | 304 break |
305 else: | |
306 # no matching data element found | |
305 if status != XEP_0050.STATUS.COMPLETED: | 307 if status != XEP_0050.STATUS.COMPLETED: |
306 log.warning(_("No known payload found in ad-hoc command result, aborting")) | 308 log.warning(_("No known payload found in ad-hoc command result, aborting")) |
307 del self.requesting[session_id] | 309 del self.requesting[session_id] |
308 return xml_tools.XMLUI(C.XMLUI_DIALOG, | 310 return xml_tools.XMLUI(C.XMLUI_DIALOG, |
309 dialog_opt = {C.XMLUI_DATA_TYPE: C.XMLUI_DIALOG_NOTE, | 311 dialog_opt = {C.XMLUI_DATA_TYPE: C.XMLUI_DIALOG_NOTE, |