# HG changeset patch # User souliane # Date 1403095972 -7200 # Node ID 387bbc459d8f1c96ef1e21063df2705d50d69c83 # Parent a65ad0e738f7a369dfa44971ccbcc4f37796edb3 plugin XEP-0050: handle note element in command answer diff -r a65ad0e738f7 -r 387bbc459d8f src/plugins/plugin_xep_0050.py --- a/src/plugins/plugin_xep_0050.py Mon Jun 16 20:06:08 2014 +0200 +++ b/src/plugins/plugin_xep_0050.py Wed Jun 18 14:52:52 2014 +0200 @@ -262,7 +262,18 @@ remote_session_id = command_elt.getAttribute('sessionid') if remote_session_id: session_data['remote_id'] = remote_session_id - data_elt = command_elt.elements(data_form.NS_X_DATA, 'x').next() + try: + data_elt = command_elt.elements(data_form.NS_X_DATA, 'x').next() + except StopIteration: + # FIXME: command answer can contains several 'note' elements + try: + data_elt = command_elt.elements(NS_COMMANDS, 'note').next() + xml_ui = xml_tools.XMLUI('popup', title=data_elt.getAttribute('type')) + xml_ui.addText(str(data_elt)) + return xml_ui + except StopIteration: + log.error(_('Unmanaged command answer: %s') % command_elt.toXml()) + return None if session_id is None: return xml_tools.dataFormResult2XMLUI(data_elt) form = data_form.Form.fromElement(data_elt)