Fix errors in caps related to unwrapped disco data and full JIDs.
This commit is contained in:
parent
f9d0ee824b
commit
8a8926c5e8
@ -36,6 +36,7 @@ class XEP_0115(BasePlugin):
|
|||||||
|
|
||||||
def plugin_init(self):
|
def plugin_init(self):
|
||||||
self.hashes = {'sha-1': hashlib.sha1,
|
self.hashes = {'sha-1': hashlib.sha1,
|
||||||
|
'sha1': hashlib.sha1,
|
||||||
'md5': hashlib.md5}
|
'md5': hashlib.md5}
|
||||||
|
|
||||||
self.hash = self.config.get('hash', 'sha-1')
|
self.hash = self.config.get('hash', 'sha-1')
|
||||||
@ -77,6 +78,8 @@ class XEP_0115(BasePlugin):
|
|||||||
disco = self.xmpp['xep_0030']
|
disco = self.xmpp['xep_0030']
|
||||||
self.static = StaticCaps(self.xmpp, disco.static)
|
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:
|
for op in self._disco_ops:
|
||||||
self.api.register(getattr(self.static, op), op, default=True)
|
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:
|
if pres['caps']['hash'] not in self.hashes:
|
||||||
try:
|
try:
|
||||||
log.debug("Unknown caps hash: %s", pres['caps']['hash'])
|
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
|
return
|
||||||
except XMPPError:
|
except XMPPError:
|
||||||
return
|
return
|
||||||
|
|
||||||
log.debug("New caps verification string: %s", pres['caps']['ver'])
|
log.debug("New caps verification string: %s", pres['caps']['ver'])
|
||||||
try:
|
try:
|
||||||
caps = self.xmpp['xep_0030'].get_info(
|
node = '%s#%s' % (pres['caps']['node'], pres['caps']['ver'])
|
||||||
jid=pres['from'].full,
|
caps = self.xmpp['xep_0030'].get_info(pres['from'], node)
|
||||||
node='%s#%s' % (pres['caps']['node'],
|
|
||||||
pres['caps']['ver']))
|
if isinstance(caps, Iq):
|
||||||
|
caps = caps['disco_info']
|
||||||
|
|
||||||
if self._validate_caps(caps['disco_info'],
|
if self._validate_caps(caps, pres['caps']['hash'],
|
||||||
pres['caps']['hash'],
|
pres['caps']['ver']):
|
||||||
pres['caps']['ver']):
|
|
||||||
self.assign_verstring(pres['from'], pres['caps']['ver'])
|
self.assign_verstring(pres['from'], pres['caps']['ver'])
|
||||||
except XMPPError:
|
except XMPPError:
|
||||||
log.debug("Could not retrieve disco#info results for caps")
|
log.debug("Could not retrieve disco#info results for caps")
|
||||||
|
Loading…
Reference in New Issue
Block a user