diff options
-rw-r--r-- | sleekxmpp/plugins/xep_0115/caps.py | 19 |
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") |