changeset 2685:eb69ec549d05

quick frontend (app): create the contact list immediatly on plug This avoid crash when contact list is used while connexion is not done yet or not possible (e.g. server unavailable).
author Goffi <goffi@goffi.org>
date Mon, 05 Nov 2018 09:13:05 +0100
parents a7529543bbb1
children ce1e15d59496
files sat_frontends/quick_frontend/quick_app.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sat_frontends/quick_frontend/quick_app.py	Fri Oct 05 13:42:06 2018 +0200
+++ b/sat_frontends/quick_frontend/quick_app.py	Mon Nov 05 09:13:05 2018 +0100
@@ -73,6 +73,9 @@
 
     def plug(self):
         """Plug the profile to the host"""
+        # first of all we create the contact lists
+        self.host.contact_lists.addProfile(self.profile)
+
         # we get the essential params
         self.bridge.asyncGetParamA(
             "JabberID",
@@ -155,9 +158,8 @@
         self._plug_profile_gotCachedValues({})
 
     def _plug_profile_gotCachedValues(self, cached_values):
+        contact_list = self.host.contact_lists[self.profile]
         # add the contact list and its listener
-        contact_list = self.host.contact_lists.addProfile(self.profile)
-
         for entity_s, data in cached_values.iteritems():
             for key, value in data.iteritems():
                 self.host.entityDataUpdatedHandler(entity_s, key, value, self.profile)