changeset 439:12d188cb1206

core: use of new profileConnected method: bookmarks cache is now retrieved in profileConnected, as getting it in ProfilePlugged could result in an exception is client was not fully connected (if plugins were not all initialised).
author Goffi <goffi@goffi.org>
date Sat, 07 Mar 2020 00:05:49 +0100
parents 58d3ea442f9c
children 167c3e198f73
files cagou/core/cagou_main.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Sat Mar 07 00:05:49 2020 +0100
+++ b/cagou/core/cagou_main.py	Sat Mar 07 00:05:49 2020 +0100
@@ -548,16 +548,18 @@
         del self.app._profile_manager
         super(Cagou, self).postInit(profile_manager)
 
+    def profilePlugged(self, profile):
+        super().profilePlugged(profile)
+        # FIXME: this won't work with multiple profiles
+        self.app.connected = self.profiles[profile].connected
+
     def _bookmarksListCb(self, bookmarks_dict, profile):
         bookmarks = set()
         for data in bookmarks_dict.values():
             bookmarks.update({jid.JID(k) for k in data.keys()})
         self.profiles[profile]._bookmarks = sorted(bookmarks)
 
-    def profilePlugged(self, profile):
-        super().profilePlugged(profile)
-        # FIXME: this won't work with multiple profiles
-        self.app.connected = self.profiles[profile].connected
+    def profileConnected(self, profile):
         self.bridge.bookmarksList(
             "muc", "all", profile,
             callback=partial(self._bookmarksListCb, profile=profile),