primitivus, quick_frontends: show global notifications counter in contact_list + method to get these notifications in QuickApp
This commit is contained in:
parent
8c9161bc87
commit
73a8db4e64
1 changed files with 19 additions and 3 deletions
|
|
@ -607,18 +607,24 @@ class QuickApp(object):
|
|||
def getNotifs(self, entity, type_=None, profile=C.PROF_KEY_NONE):
|
||||
"""return notifications for given entity
|
||||
|
||||
@param entity(jid.JID, None): bare jid of the entity to check
|
||||
@param entity(jid.JID, None, C.ENTITY_ALL): bare jid of the entity to check
|
||||
None to get general notifications
|
||||
C.ENTITY_ALL to get all notifications
|
||||
@param type_(unicode, None): notification type to filter
|
||||
None to get all notifications
|
||||
@return (list[dict]): list of notifications
|
||||
"""
|
||||
notif_dict = self.profiles[profile].notifications
|
||||
ret = []
|
||||
if entity == C.ENTITY_ALL:
|
||||
for type_notifs in notif_dict.itervalues():
|
||||
for notifs_list in type_notifs.itervalues():
|
||||
ret.extend(notifs_list)
|
||||
return ret
|
||||
key = '' if entity is None else entity.bare
|
||||
key_notifs = notif_dict.setdefault(key, {})
|
||||
if type_ is not None:
|
||||
return key_notifs.get(type_, [])
|
||||
ret = []
|
||||
return key_notifs.get(type_, ret)
|
||||
for notifs_list in key_notifs.itervalues():
|
||||
ret.extend(notifs_list)
|
||||
return ret
|
||||
|
|
|
|||
Loading…
Reference in a new issue