diff sat/plugins/plugin_misc_account.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 82eee2c383d9
children 9d0df638c8b4
line wrap: on
line diff
--- a/sat/plugins/plugin_misc_account.py	Sat Jan 25 21:08:29 2020 +0100
+++ b/sat/plugins/plugin_misc_account.py	Sat Jan 25 21:08:32 2020 +0100
@@ -20,7 +20,6 @@
 from sat.core.i18n import _, D_
 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 Sessions
@@ -32,6 +31,10 @@
 from twisted.words.protocols.jabber import jid
 from sat.tools.common import email as sat_email
 
+
+log = getLogger(__name__)
+
+
 #  FIXME: this plugin code is old and need a cleaning
 # TODO: account deletion/password change need testing
 
@@ -742,7 +745,8 @@
         d.addCallback(
             lambda __: self.host.memory.getProfileName(jid_s)
         )  # checks if the profile has been successfuly created
-        d.addCallback(self.host.connect, password, {}, 0)
+        d.addCallback(lambda profile: defer.ensureDeferred(
+            self.host.connect(profile, password, {}, 0)))
 
         def connected(result):
             self.sendEmails(None, profile=jid_s)