Mercurial > libervia-backend
diff sat_frontends/primitivus/chat.py @ 2988:b5f8cb26ef6f
quick frontend (chat), primitivus(chat): properly clear occupants on resync:
occupants widgets were not cleared in Primitivus on resync while occupants dictionary was, resulting in nicknames sometimes apearing doubled in Primitivus MUC rooms.
A new occupantsClear method has been added in QuickChat, so it can be overriden by frontends to clear widgets or other representations of occupants.
fix 304
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 06 Jul 2019 12:22:25 +0200 |
parents | 5bba8953061e |
children | 4d5b9d4c7448 |
line wrap: on
line diff
--- a/sat_frontends/primitivus/chat.py Fri Jul 05 15:58:15 2019 +0200 +++ b/sat_frontends/primitivus/chat.py Sat Jul 06 12:22:25 2019 +0200 @@ -245,6 +245,9 @@ occupant_data = self.parent.occupants[occupant] self.occupants_walker.append(OccupantWidget(occupant_data)) + def clear(self): + del self.occupants_walker[:] + def updateFooter(self): """update footer widget""" txt = OCCUPANTS_FOOTER.format(len(self.parent.occupants)) @@ -498,6 +501,10 @@ if occupant is not None: self.occupants_widget.removeUser(occupant) + def occupantsClear(self): + super(Chat, self).occupantsClear() + self.occupants_widget.clear() + def _occupantsClicked(self, occupant, clicked_wid): assert self.type == C.CHAT_GROUP contact_list = self.host.contact_lists[self.profile]