Mercurial > libervia-backend
comparison sat_frontends/quick_frontend/quick_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 | 49458e12e414 |
children | ab2696e34d29 |
comparison
equal
deleted
inserted
replaced
2987:8990ed9aad31 | 2988:b5f8cb26ef6f |
---|---|
391 | 391 |
392 def _resyncComplete(self): | 392 def _resyncComplete(self): |
393 self.sync = True | 393 self.sync = True |
394 self._resync_lock = False | 394 self._resync_lock = False |
395 | 395 |
396 def occupantsClear(self): | |
397 """Remove all occupants | |
398 | |
399 Must be overridden by frontends to clear their own representations of occupants | |
400 """ | |
401 self.occupants.clear() | |
402 | |
396 def resync(self): | 403 def resync(self): |
397 if self._resync_lock: | 404 if self._resync_lock: |
398 return | 405 return |
399 self._resync_lock = True | 406 self._resync_lock = True |
400 log.debug(u"resynchronising {self}".format(self=self)) | 407 log.debug(u"resynchronising {self}".format(self=self)) |
406 else: | 413 else: |
407 # we have no message yet, we can get normal history | 414 # we have no message yet, we can get normal history |
408 self.historyPrint(callback=self._resyncComplete, profile=self.profile) | 415 self.historyPrint(callback=self._resyncComplete, profile=self.profile) |
409 return | 416 return |
410 if self.type == C.CHAT_GROUP: | 417 if self.type == C.CHAT_GROUP: |
411 self.occupants.clear() | 418 self.occupantsClear() |
412 self.host.bridge.mucOccupantsGet( | 419 self.host.bridge.mucOccupantsGet( |
413 unicode(self.target), self.profile, callback=self.updateOccupants, | 420 unicode(self.target), self.profile, callback=self.updateOccupants, |
414 errback=log.error) | 421 errback=log.error) |
415 self.historyPrint( | 422 self.historyPrint( |
416 size=C.HISTORY_LIMIT_NONE, | 423 size=C.HISTORY_LIMIT_NONE, |