Philipp Hörist pushed to branch mainwindow at gajim / gajim
Commits: a6d61265 by lovetox at 2021-03-07T20:31:42+01:00 Add methods for accessing resources
- - - - -
1 changed file:
- gajim/common/modules/contacts.py
Changes:
===================================== gajim/common/modules/contacts.py ===================================== @@ -154,9 +154,22 @@ def get_resource(self, resource): contact = self.add_resource(resource) return contact
+ def get_resources(self): + resources = [] + for contact in self._resources.values(): + if contact.show != PresenceShowExt.OFFLINE: + resources.append(contact) + return resources + + def iter_resources(self): + for contact in self._resources.values(): + if contact.show != PresenceShowExt.OFFLINE: + yield contact + @property def is_available(self): - return any([contact.is_available for contact in self._resources.values()]) + return any([contact.is_available for contact + in self._resources.values()])
@property def show(self):
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/a6d61265c77b887db157c154c23d75fca...