summaryrefslogtreecommitdiff
path: root/src/fixes.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/fixes.py')
-rw-r--r--src/fixes.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/fixes.py b/src/fixes.py
index 69106c81..b7c8d03b 100644
--- a/src/fixes.py
+++ b/src/fixes.py
@@ -1,4 +1,3 @@
-from sleekxmpp.xmlstream import ET
"""
Module used to provide fixes for sleekxmpp functions not yet fixed
upstream.
@@ -7,6 +6,20 @@ TODO: Check that they are fixed and remove those hacks
"""
+from sleekxmpp.xmlstream import ET
+import logging
+
+log = logging.getLogger(__name__)
+
+def has_identity(xmpp, jid, identity):
+ try:
+ iq = xmpp.plugin['xep_0030'].get_info(jid=jid, block=True, timeout=1)
+ ident = lambda x: x[0]
+ return identity in map(ident, iq['disco_info']['identities'])
+ except:
+ log.debug('Traceback while retrieving identity', exc_info=True)
+ return False
+
def get_version(xmpp, jid, callback=None, **kwargs):
def handle_result(res):
if res and res['type'] != 'error':