If no resource is left, we shouldn't have caps left either!

This commit is contained in:
js 2008-07-23 18:38:52 +00:00
parent 701fe4267f
commit ea26f8eabc
1 changed files with 8 additions and 0 deletions

View File

@ -180,9 +180,17 @@ class CapsCache(object):
con.discoverInfo(jid, '%s#%s' % (node, hash)) con.discoverInfo(jid, '%s#%s' % (node, hash))
def is_supported(self, contact, feature): def is_supported(self, contact, feature):
# No resource -> can't have any caps
if not contact or not contact.resource: if not contact or not contact.resource:
return False return False
# Unfortunately, if all resources are offline, the contact
# includes the last resource that was online. Check for its
# show, so we can be sure it's existant. Otherwise, we still
# return caps for a contact that has no resources left.
if contact.show == 'offline':
return False
# FIXME: We assume everything is supported if we got no caps. # FIXME: We assume everything is supported if we got no caps.
# This is the "Asterix way", after 0.12 release, I will # This is the "Asterix way", after 0.12 release, I will
# likely implement a fallback to disco (could be disabled # likely implement a fallback to disco (could be disabled