comparison sat_frontends/quick_frontend/quick_contact_list.py @ 2686:ce1e15d59496

quick frontend (contact list): use property to retrieve "whoami" in ProfileContactList: this avoid a crash introduced by early creation of contact list during profile plugging, and avoid desynchronisation risk.
author Goffi <goffi@goffi.org>
date Fri, 09 Nov 2018 16:17:45 +0100
parents 56f94936df1e
children 003b8b4b56a7
comparison
equal deleted inserted replaced
2685:eb69ec549d05 2686:ce1e15d59496
80 # contacts in roster (bare jids) 80 # contacts in roster (bare jids)
81 self._roster = set() 81 self._roster = set()
82 82
83 # selected entities, full jid 83 # selected entities, full jid
84 self._selected = set() 84 self._selected = set()
85
86 # we keep our own jid
87 self.whoami = self.host.profiles[profile].whoami
88 85
89 # options 86 # options
90 self.show_disconnected = False 87 self.show_disconnected = False
91 self.show_empty_groups = True 88 self.show_empty_groups = True
92 self.show_resources = False 89 self.show_resources = False
119 self.host.addListener("nick", self.nickListener, [self.profile]) 116 self.host.addListener("nick", self.nickListener, [self.profile])
120 self.notifListener = self.onNotification 117 self.notifListener = self.onNotification
121 self.host.addListener("notification", self.notifListener, [self.profile]) 118 self.host.addListener("notification", self.notifListener, [self.profile])
122 # notifListener only update the entity, so we can re-use it 119 # notifListener only update the entity, so we can re-use it
123 self.host.addListener("notificationsClear", self.notifListener, [self.profile]) 120 self.host.addListener("notificationsClear", self.notifListener, [self.profile])
121
122 @property
123 def whoami(self):
124 return self.host.profiles[self.profile].whoami
124 125
125 def _showEmptyGroups(self, show_str): 126 def _showEmptyGroups(self, show_str):
126 # Called only by __init__ 127 # Called only by __init__
127 # self.update is not wanted here, as it is done by 128 # self.update is not wanted here, as it is done by
128 # handler when all profiles are ready 129 # handler when all profiles are ready