Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_app.py @ 2009:90134b2e3dc4
primitivus, quick_frontends: show global notifications counter in contact_list + method to get these notifications in QuickApp
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 17 Jul 2016 17:32:46 +0200 |
parents | 19b9d3f8a6c7 |
children | f09562b0704d |
comparison
equal
deleted
inserted
replaced
2008:8a749ec21c50 | 2009:90134b2e3dc4 |
---|---|
605 self.callListeners('notification', entity, notif_data, profile=profile) | 605 self.callListeners('notification', entity, notif_data, profile=profile) |
606 | 606 |
607 def getNotifs(self, entity, type_=None, profile=C.PROF_KEY_NONE): | 607 def getNotifs(self, entity, type_=None, profile=C.PROF_KEY_NONE): |
608 """return notifications for given entity | 608 """return notifications for given entity |
609 | 609 |
610 @param entity(jid.JID, None): bare jid of the entity to check | 610 @param entity(jid.JID, None, C.ENTITY_ALL): bare jid of the entity to check |
611 None to get general notifications | 611 None to get general notifications |
612 C.ENTITY_ALL to get all notifications | |
612 @param type_(unicode, None): notification type to filter | 613 @param type_(unicode, None): notification type to filter |
613 None to get all notifications | 614 None to get all notifications |
614 @return (list[dict]): list of notifications | 615 @return (list[dict]): list of notifications |
615 """ | 616 """ |
616 notif_dict = self.profiles[profile].notifications | 617 notif_dict = self.profiles[profile].notifications |
618 ret = [] | |
619 if entity == C.ENTITY_ALL: | |
620 for type_notifs in notif_dict.itervalues(): | |
621 for notifs_list in type_notifs.itervalues(): | |
622 ret.extend(notifs_list) | |
623 return ret | |
617 key = '' if entity is None else entity.bare | 624 key = '' if entity is None else entity.bare |
618 key_notifs = notif_dict.setdefault(key, {}) | 625 key_notifs = notif_dict.setdefault(key, {}) |
619 if type_ is not None: | 626 if type_ is not None: |
620 return key_notifs.get(type_, []) | 627 return key_notifs.get(type_, ret) |
621 ret = [] | |
622 for notifs_list in key_notifs.itervalues(): | 628 for notifs_list in key_notifs.itervalues(): |
623 ret.extend(notifs_list) | 629 ret.extend(notifs_list) |
624 return ret | 630 return ret |
625 | 631 |
626 def clearNotifs(self, entity, type_=None, profile=C.PROF_KEY_NONE): | 632 def clearNotifs(self, entity, type_=None, profile=C.PROF_KEY_NONE): |