summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-12-31 19:18:00 -0500
committerLance Stout <lancestout@gmail.com>2011-12-31 19:18:00 -0500
commit35954cdc90f1f404c81b7ede47c2fae420e182e8 (patch)
treef4e05eecf6a4fef988868e492e24634c830f2471
parentfa912aeb84a95d1cf72639587488aa64cf556aa7 (diff)
downloadslixmpp-35954cdc90f1f404c81b7ede47c2fae420e182e8.tar.gz
slixmpp-35954cdc90f1f404c81b7ede47c2fae420e182e8.tar.bz2
slixmpp-35954cdc90f1f404c81b7ede47c2fae420e182e8.tar.xz
slixmpp-35954cdc90f1f404c81b7ede47c2fae420e182e8.zip
Fix a few holes in caps.
Protip: Don't test using a custom disco handler that always returns the same feature set :p
-rw-r--r--sleekxmpp/plugins/xep_0115/caps.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/sleekxmpp/plugins/xep_0115/caps.py b/sleekxmpp/plugins/xep_0115/caps.py
index 306629f6..db5b9bf3 100644
--- a/sleekxmpp/plugins/xep_0115/caps.py
+++ b/sleekxmpp/plugins/xep_0115/caps.py
@@ -245,14 +245,23 @@ class xep_0115(base_plugin):
return base64.b64encode(binary)
def update_caps(self, jid=None, node=None):
- info = self.disco.get_info(jid, node, local=True)
- if isinstance(info, Iq):
- info = info['disco_info']
- ver = self.generate_verstring(info, self.hash)
- self.cache_caps(ver, info)
- self.assign_verstring(jid, ver)
+ try:
+ info = self.disco.get_info(jid, node, local=True)
+ if isinstance(info, Iq):
+ info = info['disco_info']
+ ver = self.generate_verstring(info, self.hash)
+ self.disco.set_info(
+ jid=jid,
+ node='%s#%s' % (self.caps_node, ver),
+ info=info)
+ self.cache_caps(ver, info)
+ self.assign_verstring(jid, ver)
+ except XMPPError:
+ return
def get_verstring(self, jid=None):
+ if jid in ('', None):
+ jid = self.xmpp.boundjid.full
return self._run_node_handler('get_verstring', jid)
def assign_verstring(self, jid=None, verstring=None):