From 1a33c3389f6514a773f4c870a43ee06757dad5d5 Mon Sep 17 00:00:00 2001 From: Goffi Date: Sun, 15 Jan 2017 16:00:41 +0100 Subject: [PATCH] quick frontend (contact list): bare_default in getCache now default to True, plus added None: if None is used, bare_default will be used only if the entity is not in a room --- frontends/src/quick_frontend/quick_contact_list.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontends/src/quick_frontend/quick_contact_list.py b/frontends/src/quick_frontend/quick_contact_list.py index 9ae8e81d..66738bf2 100644 --- a/frontends/src/quick_frontend/quick_contact_list.py +++ b/frontends/src/quick_frontend/quick_contact_list.py @@ -204,7 +204,7 @@ class ProfileContactList(object): def fill(self): handler.fill(self.profile) - def getCache(self, entity, name=None, bare_default=False): + def getCache(self, entity, name=None, bare_default=True): """Return a cache value for a contact @param entity(jid.JID): entity of the contact from who we want data (resource is used if given) @@ -212,9 +212,10 @@ class ProfileContactList(object): - if no resource is given (bare jid), the main resource is used, according to priority - if resource is given, it is used @param name(unicode): name the data to get, or None to get everything - @param bare_default(bool): if True and entity is a full jid, the value of bare jid + @param bare_default(bool, None): if True and entity is a full jid, the value of bare jid will be returned if not value is found for the requested resource. If False, None is returned if no value is found for the requested resource. + If None, bare_default will be set to False if entity is in a room, True else @return: full cache if no name is given, or value of "name", or None """ # FIXME: resource handling need to be reworked @@ -247,6 +248,8 @@ class ProfileContactList(object): try: return cache[C.CONTACT_RESOURCES][entity.resource][name] except KeyError: + if bare_default is None: + bare_default = not self.isRoom(entity.bare) if not bare_default: return None