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
This commit is contained in:
Goffi 2019-07-06 12:22:25 +02:00
commit 31a9e2bd09

View file

@ -393,6 +393,13 @@ class QuickChat(quick_widgets.QuickWidget):
self.sync = True
self._resync_lock = False
def occupantsClear(self):
"""Remove all occupants
Must be overridden by frontends to clear their own representations of occupants
"""
self.occupants.clear()
def resync(self):
if self._resync_lock:
return
@ -408,7 +415,7 @@ class QuickChat(quick_widgets.QuickWidget):
self.historyPrint(callback=self._resyncComplete, profile=self.profile)
return
if self.type == C.CHAT_GROUP:
self.occupants.clear()
self.occupantsClear()
self.host.bridge.mucOccupantsGet(
unicode(self.target), self.profile, callback=self.updateOccupants,
errback=log.error)