Author: js Date: 2008-07-23 20:38:52 +0200 (Wed, 23 Jul 2008) New Revision: 10015
Modified: trunk/src/common/caps.py Log: If no resource is left, we shouldn't have caps left either!
Modified: trunk/src/common/caps.py =================================================================== --- trunk/src/common/caps.py 2008-07-23 18:34:26 UTC (rev 10014) +++ trunk/src/common/caps.py 2008-07-23 18:38:52 UTC (rev 10015) @@ -180,9 +180,17 @@ con.discoverInfo(jid, '%s#%s' % (node, hash)) def is_supported(self, contact, feature): + # No resource -> can't have any caps if not contact or not contact.resource: 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. # This is the "Asterix way", after 0.12 release, I will # likely implement a fallback to disco (could be disabled