summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-12-28 16:57:36 +0100
committermathieui <mathieui@mathieui.net>2013-12-28 16:57:36 +0100
commit83b44c863ecbecab4dbd7d05d4ad4973a1293781 (patch)
treec77ad634c3916d9a305c9140ce68400a19314765 /src
parent91392c721f2c918d427469272be38d98258ba206 (diff)
downloadpoezio-83b44c863ecbecab4dbd7d05d4ad4973a1293781.tar.gz
poezio-83b44c863ecbecab4dbd7d05d4ad4973a1293781.tar.bz2
poezio-83b44c863ecbecab4dbd7d05d4ad4973a1293781.tar.xz
poezio-83b44c863ecbecab4dbd7d05d4ad4973a1293781.zip
Fix #2281 (display iq results when sent with /rawxml)
Diffstat (limited to 'src')
-rw-r--r--src/core.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/core.py b/src/core.py
index 5450df5b..9c99fb26 100644
--- a/src/core.py
+++ b/src/core.py
@@ -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>