Mercurial > libervia-backend
diff sat/core/sat_main.py @ 2595:973d4551ffae
core: added local_device argument to discoFindByFeatures
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 25 May 2018 10:52:01 +0200 |
parents | 26edcf3a30eb |
children | 9446f1ea9eac |
line wrap: on
line diff
--- a/sat/core/sat_main.py Fri May 25 10:52:01 2018 +0200 +++ b/sat/core/sat_main.py Fri May 25 10:52:01 2018 +0200 @@ -671,12 +671,12 @@ def findFeaturesSet(self, *args, **kwargs): return self.memory.disco.findFeaturesSet(*args, **kwargs) - def _findByFeatures(self, namespaces, identities, bare_jids, service, roster, own_jid, profile_key): + def _findByFeatures(self, namespaces, identities, bare_jids, service, roster, own_jid, local_device, profile_key): client = self.getClient(profile_key) - return self.findByFeatures(client, namespaces, identities, bare_jids, service, roster, own_jid) + return self.findByFeatures(client, namespaces, identities, bare_jids, service, roster, own_jid, local_device) @defer.inlineCallbacks - def findByFeatures(self, client, namespaces, identities=None, bare_jids=False, service=True, roster=True, own_jid=True): + def findByFeatures(self, client, namespaces, identities=None, bare_jids=False, service=True, roster=True, own_jid=True, local_device=False): """retrieve all services or contacts managing a set a features @param namespaces(list[unicode]): features which must be handled @@ -688,6 +688,7 @@ @param roster(bool): if True, return entities in roster full jid of all matching resources available will be returned @param own_jid(bool): if True, return profile's jid resources + @param local_device(bool): if True, return profile's jid local resource (i.e. client.jid) @return (tuple(dict[jid.JID(), tuple[unicode, unicode, unicode]]*3)): found entities in a tuple with: - service entities - own entities @@ -732,6 +733,8 @@ continue for resource in resources: full_jid = jid.JID(tuple=(jid_.user, jid_.host, resource)) + if full_jid == client.jid and not local_device: + continue infos = yield self.getDiscoInfos(client, full_jid) if infos.features.issuperset(namespaces): if identities is not None and not set(infos.identities.keys()).issuperset(identities):