Commit 83b44c86 authored by mathieui's avatar mathieui

Fix #2281 (display iq results when sent with /rawxml)

parent 91392c72
......@@ -31,6 +31,7 @@ from sleekxmpp import JID, InvalidJID
from common import safeJID
from sleekxmpp.xmlstream.stanzabase import StanzaBase
from sleekxmpp.xmlstream.handler import Callback
from sleekxmpp.xmlstream.matcher import StanzaPath
log = logging.getLogger(__name__)
......@@ -2526,14 +2527,35 @@ class Core(object):
if not arg:
return
try:
StanzaBase(self.xmpp, xml=ET.fromstring(arg)).send()
stanza = StanzaBase(self.xmpp, xml=ET.fromstring(arg))
if stanza.xml.tag == 'iq' and \
stanza.xml.attrib.get('type') == 'get' and \
stanza.xml.attrib.get('id'):
iq_id = stanza.xml.attrib.get('id')
def iqfunc(iq):
self.information('%s' % iq, 'Iq')
self.xmpp.remove_handler('Iq %s' % iq_id)
self.xmpp.register_handler(
Callback('Iq %s' % iq_id,
StanzaPath('iq@id=%s' % iq_id),
iqfunc
)
)
log.debug('handler')
log.debug('%s %s', stanza.xml.tag, stanza.xml.attrib)
stanza.send()
except:
self.information(_('Could not send custom stanza'), 'Error')
log.debug('/rawxml: Could not send custom stanza (%s)',
repr(arg),
exc_info=True)
def command_load(self, arg):
"""
/load <plugin>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment