diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-11-07 07:26:59 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-11-07 07:26:59 -0300 |
commit | c84b997124ea08338363c7b2b95747e30bf9e498 (patch) | |
tree | 0d79e447070e6ecf6612e5abdba69f68354e820a | |
parent | 1d00ebd21d09e21aefb76e3b25791327343e4477 (diff) | |
parent | dd0fb652aeef31719d888d40ed7d1268e8f2bd36 (diff) |
Merge remote-tracking branch 'kali/bug/fix-mail-reinitialization' into develop
-rw-r--r-- | changes/VERSION_COMPAT | 1 | ||||
-rw-r--r-- | changes/bug_4394_fix-mail-reinitialization | 1 | ||||
-rw-r--r-- | src/leap/bitmask/gui/mainwindow.py | 18 | ||||
-rw-r--r-- | src/leap/bitmask/services/mail/conductor.py | 35 |
4 files changed, 32 insertions, 23 deletions
diff --git a/changes/VERSION_COMPAT b/changes/VERSION_COMPAT index cc00ecf7..e689170c 100644 --- a/changes/VERSION_COMPAT +++ b/changes/VERSION_COMPAT @@ -8,3 +8,4 @@ # # BEGIN DEPENDENCY LIST ------------------------- # leap.foo.bar>=x.y.z +leap.mail >= 0.3.7 diff --git a/changes/bug_4394_fix-mail-reinitialization b/changes/bug_4394_fix-mail-reinitialization new file mode 100644 index 00000000..f05fce6a --- /dev/null +++ b/changes/bug_4394_fix-mail-reinitialization @@ -0,0 +1 @@ +- Initialize mail service with the userid after login, to allow multiple accounts. Closes: #4394 diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 549097ae..a91f4e71 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -904,7 +904,6 @@ class MainWindow(QtGui.QMainWindow): Once the user is properly authenticated, try starting the EIP service """ - # In general we want to "filter" likely complicated error # messages, but in this case, the messages make more sense as # they come. Since they are "Unknown user" or "Unknown @@ -913,19 +912,20 @@ class MainWindow(QtGui.QMainWindow): if ok: self._logged_user = self._login_widget.get_user() - # We leave a bit of room for the user to see the - # "Succeeded" message and then we switch to the EIP status - # panel - QtCore.QTimer.singleShot(1000, self._switch_to_status) + user = self._logged_user + domain = self._provider_config.get_domain() + userid = "%s@%s" % (user, domain) + logger.debug("USERID: " % userid) + self._mail_conductor.userid = userid self._login_defer = None + self._start_eip_bootstrap() else: self._login_widget.set_enabled(True) - def _switch_to_status(self): - # TODO this method name is confusing as hell. + def _start_eip_bootstrap(self): """ Changes the stackedWidget index to the EIP status one and - triggers the eip bootstrapping + triggers the eip bootstrapping. """ self._login_widget.logged_in() @@ -948,6 +948,8 @@ class MainWindow(QtGui.QMainWindow): else: self._mail_status.set_disabled() + # XXX the config should be downloaded from the start_eip + # method. self._download_eip_config() ################################################################### diff --git a/src/leap/bitmask/services/mail/conductor.py b/src/leap/bitmask/services/mail/conductor.py index c294381b..4d34a13b 100644 --- a/src/leap/bitmask/services/mail/conductor.py +++ b/src/leap/bitmask/services/mail/conductor.py @@ -81,16 +81,12 @@ class IMAPControl(object): "We need a non-null keymanager for initializing imap " "service") - if self.imap_service is None: - # first time. - self.imap_service, \ - self.imap_port, \ + self.imap_service, self.imap_port, \ self.imap_factory = imap.start_imap_service( self._soledad, - self._keymanager) - else: - # we have the fetcher. just start it. - self.imap_service.start_loop() + self._keymanager, + userid=self.userid) + self.imap_service.start_loop() def stop_imap_service(self): """ @@ -339,11 +335,25 @@ class MailConductor(IMAPControl, SMTPControl): SMTPControl.__init__(self) self._soledad = soledad self._keymanager = keymanager - self._mail_machine = None - self._mail_connection = mail_connection.MailConnection() + self.userid = None + + @property + def userid(self): + return self._userid + + @userid.setter + def _userid(self, userid): + """ + Sets the user id this conductor is configured for. + + :param userid: the user id, in the form "user@provider" + :type userid: str + """ + self._userid = userid + def start_mail_machine(self, **kwargs): """ Starts mail machine. @@ -354,15 +364,10 @@ class MailConductor(IMAPControl, SMTPControl): # we have instantiated the connections while building the composite # machines, and we have to use the qtsigs instantiated there. - # XXX we could probably use a proxy here too to make the thing - # transparent. self.set_imap_connection(imap.conn) self.set_smtp_connection(smtp.conn) self._mail_machine = mail - # XXX ------------------- - # need to keep a reference? - #self._mail_events = mail.events self._mail_machine.start() self._imap_machine = imap |