Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
3119:790489521b15 | 3120:0c29155ac68b |
---|---|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 from sat.core.i18n import _, D_ | 20 from sat.core.i18n import _, D_ |
21 from sat.core.log import getLogger | 21 from sat.core.log import getLogger |
22 | 22 |
23 log = getLogger(__name__) | |
24 from sat.core import exceptions | 23 from sat.core import exceptions |
25 from sat.tools import xml_tools | 24 from sat.tools import xml_tools |
26 from sat.memory.memory import Sessions | 25 from sat.memory.memory import Sessions |
27 from sat.memory.crypto import PasswordHasher | 26 from sat.memory.crypto import PasswordHasher |
28 from sat.core.constants import Const as C | 27 from sat.core.constants import Const as C |
29 import configparser | 28 import configparser |
30 from twisted.internet import defer | 29 from twisted.internet import defer |
31 from twisted.python.failure import Failure | 30 from twisted.python.failure import Failure |
32 from twisted.words.protocols.jabber import jid | 31 from twisted.words.protocols.jabber import jid |
33 from sat.tools.common import email as sat_email | 32 from sat.tools.common import email as sat_email |
33 | |
34 | |
35 log = getLogger(__name__) | |
36 | |
34 | 37 |
35 # FIXME: this plugin code is old and need a cleaning | 38 # FIXME: this plugin code is old and need a cleaning |
36 # TODO: account deletion/password change need testing | 39 # TODO: account deletion/password change need testing |
37 | 40 |
38 | 41 |
740 | 743 |
741 d = self.createProfile(password, jid_s, jid_s) | 744 d = self.createProfile(password, jid_s, jid_s) |
742 d.addCallback( | 745 d.addCallback( |
743 lambda __: self.host.memory.getProfileName(jid_s) | 746 lambda __: self.host.memory.getProfileName(jid_s) |
744 ) # checks if the profile has been successfuly created | 747 ) # checks if the profile has been successfuly created |
745 d.addCallback(self.host.connect, password, {}, 0) | 748 d.addCallback(lambda profile: defer.ensureDeferred( |
749 self.host.connect(profile, password, {}, 0))) | |
746 | 750 |
747 def connected(result): | 751 def connected(result): |
748 self.sendEmails(None, profile=jid_s) | 752 self.sendEmails(None, profile=jid_s) |
749 return result | 753 return result |
750 | 754 |