diff sat/stdui/ui_profile_manager.py @ 3120:0c29155ac68b

core: backend autoconnection: A new Connection/autoconnect_backend param can be set for a profile or component to be started automatically with backend. This is specially useful for components, but can be useful for client profile too (e.g. on Android we need to start profile with backend to get notifications, this part will come with following commits). The new Sqlite.getIndParamValues method allows to retrieve the same parameters for all profiles.
author Goffi <goffi@goffi.org>
date Sat, 25 Jan 2020 21:08:32 +0100
parents ab2696e34d29
children 9d0df638c8b4
line wrap: on
line diff
--- a/sat/stdui/ui_profile_manager.py	Sat Jan 25 21:08:29 2020 +0100
+++ b/sat/stdui/ui_profile_manager.py	Sat Jan 25 21:08:32 2020 +0100
@@ -21,14 +21,16 @@
 from sat.core.i18n import D_
 from sat.core.constants import Const as C
 from sat.core.log import getLogger
-
-log = getLogger(__name__)
 from sat.core import exceptions
 from sat.tools import xml_tools
 from sat.memory.memory import ProfileSessions
+from twisted.internet import defer
 from twisted.words.protocols.jabber import jid
 
 
+log = getLogger(__name__)
+
+
 class ProfileManager(object):
     """Manage profiles."""
 
@@ -143,7 +145,7 @@
         d = self.host.memory.setParam(
             "Password", xmpp_password, "Connection", profile_key=profile
         )
-        d.addCallback(lambda __: self.host.connect(profile))
+        d.addCallback(lambda __: defer.ensureDeferred(self.host.connect(profile)))
         d.addCallback(lambda __: {})
         d.addErrback(lambda __: self._changeXMPPPassword({}, profile))
         return d