summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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>