summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slixmpp/plugins/xep_0030/disco.py15
-rw-r--r--slixmpp/plugins/xep_0115/caps.py3
-rw-r--r--slixmpp/plugins/xep_0163.py5
3 files changed, 14 insertions, 9 deletions
diff --git a/slixmpp/plugins/xep_0030/disco.py b/slixmpp/plugins/xep_0030/disco.py
index cf654189..f368bc12 100644
--- a/slixmpp/plugins/xep_0030/disco.py
+++ b/slixmpp/plugins/xep_0030/disco.py
@@ -9,6 +9,7 @@
import logging
from slixmpp import Iq
+from slixmpp import future_wrapper
from slixmpp.plugins import BasePlugin
from slixmpp.xmlstream.handler import Callback
from slixmpp.xmlstream.matcher import StanzaPath
@@ -294,6 +295,7 @@ class XEP_0030(BasePlugin):
'cached': cached}
return self.api['has_identity'](jid, node, ifrom, data)
+ @future_wrapper
def get_info(self, jid=None, node=None, local=None,
cached=None, **kwargs):
"""
@@ -368,9 +370,9 @@ class XEP_0030(BasePlugin):
iq['to'] = jid
iq['type'] = 'get'
iq['disco_info']['node'] = node if node else ''
- iq.send(timeout=kwargs.get('timeout', None),
- callback=kwargs.get('callback', None),
- timeout_callback=kwargs.get('timeout_callback', None))
+ return iq.send(timeout=kwargs.get('timeout', None),
+ callback=kwargs.get('callback', None),
+ timeout_callback=kwargs.get('timeout_callback', None))
def set_info(self, jid=None, node=None, info=None):
"""
@@ -381,6 +383,7 @@ class XEP_0030(BasePlugin):
info = info['disco_info']
self.api['set_info'](jid, node, None, info)
+ @future_wrapper
def get_items(self, jid=None, node=None, local=False, **kwargs):
"""
Retrieve the disco#items results from a given JID/node combination.
@@ -429,9 +432,9 @@ class XEP_0030(BasePlugin):
raise NotImplementedError("XEP 0059 has not yet been fixed")
return self.xmpp['xep_0059'].iterate(iq, 'disco_items')
else:
- iq.send(timeout=kwargs.get('timeout', None),
- callback=kwargs.get('callback', None),
- timeout_callback=kwargs.get('timeout_callback', None))
+ return iq.send(timeout=kwargs.get('timeout', None),
+ callback=kwargs.get('callback', None),
+ timeout_callback=kwargs.get('timeout_callback', None))
def set_items(self, jid=None, node=None, **kwargs):
"""
diff --git a/slixmpp/plugins/xep_0115/caps.py b/slixmpp/plugins/xep_0115/caps.py
index e7335bb5..c6f9ea10 100644
--- a/slixmpp/plugins/xep_0115/caps.py
+++ b/slixmpp/plugins/xep_0115/caps.py
@@ -280,9 +280,10 @@ class XEP_0115(BasePlugin):
binary = hash(S.encode('utf8')).digest()
return base64.b64encode(binary).decode('utf-8')
+ @asyncio.coroutine
def update_caps(self, jid=None, node=None, preserve=False):
try:
- info = self.xmpp['xep_0030'].get_info(jid, node, local=True)
+ info = yield from self.xmpp['xep_0030'].get_info(jid, node, local=True)
if isinstance(info, Iq):
info = info['disco_info']
ver = self.generate_verstring(info, self.hash)
diff --git a/slixmpp/plugins/xep_0163.py b/slixmpp/plugins/xep_0163.py
index e974a808..b85c662c 100644
--- a/slixmpp/plugins/xep_0163.py
+++ b/slixmpp/plugins/xep_0163.py
@@ -8,6 +8,7 @@
import logging
+from slixmpp import asyncio
from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.plugins.base import BasePlugin, register_plugin
@@ -61,7 +62,7 @@ class XEP_0163(BasePlugin):
for ns in namespace:
self.xmpp['xep_0030'].add_feature('%s+notify' % ns,
jid=jid)
- self.xmpp['xep_0115'].update_caps(jid)
+ asyncio.async(self.xmpp['xep_0115'].update_caps(jid))
def remove_interest(self, namespace, jid=None):
"""
@@ -80,7 +81,7 @@ class XEP_0163(BasePlugin):
for ns in namespace:
self.xmpp['xep_0030'].del_feature(jid=jid,
feature='%s+notify' % namespace)
- self.xmpp['xep_0115'].update_caps(jid)
+ asyncio.async(self.xmpp['xep_0115'].update_caps(jid))
def publish(self, stanza, node=None, id=None, options=None, ifrom=None,
timeout_callback=None, callback=None, timeout=None):