summaryrefslogtreecommitdiff
path: root/service/pixelated
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-07-31 13:05:12 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-08-11 17:00:31 +0200
commit12636acfa193fb6871367771582f43a95611bfba (patch)
treefc33a2c2c91cc28f62810b073f1c7a8756e5f7f5 /service/pixelated
parent94a4e0ce68ba66e5888a7ad696dd891123962a75 (diff)
Added mail_store to LeapSession.
- Issue #420
Diffstat (limited to 'service/pixelated')
-rw-r--r--service/pixelated/bitmask_libraries/session.py9
-rw-r--r--service/pixelated/maintenance.py2
2 files changed, 7 insertions, 4 deletions
diff --git a/service/pixelated/bitmask_libraries/session.py b/service/pixelated/bitmask_libraries/session.py
index b4015e09..2098c9ce 100644
--- a/service/pixelated/bitmask_libraries/session.py
+++ b/service/pixelated/bitmask_libraries/session.py
@@ -22,6 +22,7 @@ from leap.mail.incoming.service import IncomingMail
from twisted.internet import reactor
from .nicknym import NickNym
from leap.auth import SRPAuth
+from pixelated.adapter.mailstore import LeapMailStore
from .soledad import SoledadSessionFactory
from .smtp import LeapSmtp
from leap.mail.imap.account import IMAPAccount
@@ -45,6 +46,8 @@ class LeapSession(object):
- ``user_auth`` the secure remote password session data after authenticating with LEAP. See http://en.wikipedia.org/wiki/Secure_Remote_Password_protocol (SRPSession)
+ - ``mail_store`` the MailStore to access the users mails
+
- ``soledad_session`` the soledad session. See https://leap.se/soledad (LeapSecureRemotePassword)
- ``nicknym`` the nicknym instance. See https://leap.se/nicknym (NickNym)
@@ -52,11 +55,12 @@ class LeapSession(object):
- ``incoming_mail_fetcher`` Background job for fetching incoming mails from LEAP server (LeapIncomingMail)
"""
- def __init__(self, provider, user_auth, soledad_session, nicknym, soledad_account, incoming_mail_fetcher, smtp):
+ def __init__(self, provider, user_auth, mail_store, soledad_session, nicknym, soledad_account, incoming_mail_fetcher, smtp):
self.smtp = smtp
self.config = provider.config
self.provider = provider
self.user_auth = user_auth
+ self.mail_store = mail_store
self.soledad_session = soledad_session
self.nicknym = nicknym
self.account = soledad_account
@@ -116,6 +120,7 @@ class LeapSessionFactory(object):
account_email = self._provider.address_for(username)
soledad = SoledadSessionFactory.create(self._provider, auth.token, auth.uuid, password)
+ mail_store = LeapMailStore(soledad.soledad)
nicknym = self._create_nicknym(account_email, auth.token, auth.uuid, soledad)
account = self._create_account(account_email, soledad)
@@ -123,7 +128,7 @@ class LeapSessionFactory(object):
smtp = LeapSmtp(self._provider, auth, nicknym.keymanager)
- return LeapSession(self._provider, auth, soledad, nicknym, account, deferred_incoming_mail_fetcher, smtp)
+ return LeapSession(self._provider, auth, mail_store, soledad, nicknym, account, deferred_incoming_mail_fetcher, smtp)
def _lookup_session(self, key):
global SESSIONS
diff --git a/service/pixelated/maintenance.py b/service/pixelated/maintenance.py
index 1b8a9bc9..4bb06ceb 100644
--- a/service/pixelated/maintenance.py
+++ b/service/pixelated/maintenance.py
@@ -18,7 +18,6 @@ import logging
from mailbox import Maildir
from twisted.internet import reactor, defer
from twisted.internet.threads import deferToThread
-from pixelated.adapter.mailstore import LeapMailStore
from pixelated.config.leap import initialize_leap
from pixelated.config import logger, arguments
@@ -48,7 +47,6 @@ def initialize():
def execute_command(args, leap_session):
def init_soledad():
- leap_session.mail_store = LeapMailStore(leap_session.soledad_session.soledad)
return leap_session
def get_soledad_handle(leap_session):