summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-04-08 16:00:36 -0400
committerLance Stout <lancestout@gmail.com>2012-04-08 16:00:36 -0400
commit8a8926c5e80df922dbfc205c698a904e9ce30771 (patch)
tree7388424cd27f1d609f9df70cb37e2ec88a39bbf8
parentf9d0ee824be43ae7879446917f8d8ae80070c74e (diff)
downloadslixmpp-8a8926c5e80df922dbfc205c698a904e9ce30771.tar.gz
slixmpp-8a8926c5e80df922dbfc205c698a904e9ce30771.tar.bz2
slixmpp-8a8926c5e80df922dbfc205c698a904e9ce30771.tar.xz
slixmpp-8a8926c5e80df922dbfc205c698a904e9ce30771.zip
Fix errors in caps related to unwrapped disco data and full JIDs.
-rw-r--r--sleekxmpp/plugins/xep_0115/caps.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/sleekxmpp/plugins/xep_0115/caps.py b/sleekxmpp/plugins/xep_0115/caps.py
index 3509feec..5e5d2320 100644
--- a/sleekxmpp/plugins/xep_0115/caps.py
+++ b/sleekxmpp/plugins/xep_0115/caps.py
@@ -36,6 +36,7 @@ class XEP_0115(BasePlugin):
def plugin_init(self):
self.hashes = {'sha-1': hashlib.sha1,
+ 'sha1': hashlib.sha1,
'md5': hashlib.md5}
self.hash = self.config.get('hash', 'sha-1')
@@ -77,6 +78,8 @@ class XEP_0115(BasePlugin):
disco = self.xmpp['xep_0030']
self.static = StaticCaps(self.xmpp, disco.static)
+ self.api.settings['client_bare'] = False
+ self.api.settings['component_bare'] = False
for op in self._disco_ops:
self.api.register(getattr(self.static, op), op, default=True)
@@ -125,21 +128,21 @@ class XEP_0115(BasePlugin):
if pres['caps']['hash'] not in self.hashes:
try:
log.debug("Unknown caps hash: %s", pres['caps']['hash'])
- self.xmpp['xep_003'].get_info(jid=pres['from'].full)
+ self.xmpp['xep_0030'].get_info(jid=pres['from'])
return
except XMPPError:
return
log.debug("New caps verification string: %s", pres['caps']['ver'])
try:
- caps = self.xmpp['xep_0030'].get_info(
- jid=pres['from'].full,
- node='%s#%s' % (pres['caps']['node'],
- pres['caps']['ver']))
+ node = '%s#%s' % (pres['caps']['node'], pres['caps']['ver'])
+ caps = self.xmpp['xep_0030'].get_info(pres['from'], node)
+
+ if isinstance(caps, Iq):
+ caps = caps['disco_info']
- if self._validate_caps(caps['disco_info'],
- pres['caps']['hash'],
- pres['caps']['ver']):
+ if self._validate_caps(caps, pres['caps']['hash'],
+ pres['caps']['ver']):
self.assign_verstring(pres['from'], pres['caps']['ver'])
except XMPPError:
log.debug("Could not retrieve disco#info results for caps")