summaryrefslogtreecommitdiff
path: root/service/pixelated/bitmask_libraries/session.py
diff options
context:
space:
mode:
Diffstat (limited to 'service/pixelated/bitmask_libraries/session.py')
-rw-r--r--service/pixelated/bitmask_libraries/session.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/service/pixelated/bitmask_libraries/session.py b/service/pixelated/bitmask_libraries/session.py
index ca3c80ff..7abe2a63 100644
--- a/service/pixelated/bitmask_libraries/session.py
+++ b/service/pixelated/bitmask_libraries/session.py
@@ -55,7 +55,7 @@ class LeapSession(object):
- ``incoming_mail_fetcher`` Background job for fetching incoming mails from LEAP server (LeapIncomingMail)
"""
- def __init__(self, provider, user_auth, mail_store, soledad_session, nicknym, soledad_account, smtp):
+ def __init__(self, provider, user_auth, mail_store, soledad_session, nicknym, smtp):
self.smtp = smtp
self.config = provider.config
self.provider = provider
@@ -63,15 +63,17 @@ class LeapSession(object):
self.mail_store = mail_store
self.soledad_session = soledad_session
self.nicknym = nicknym
- self.account = soledad_account
@defer.inlineCallbacks
def initial_sync(self):
yield self.sync()
yield self.after_first_sync()
+ defer.returnValue(self)
+ @defer.inlineCallbacks
def after_first_sync(self):
yield self.nicknym.generate_openpgp_key()
+ self.account = self._create_account(self.account_email, self.soledad_session)
self.incoming_mail_fetcher = yield self._create_incoming_mail_fetcher(
self.nicknym,
self.soledad_session,
@@ -79,6 +81,10 @@ class LeapSession(object):
self.account_email())
reactor.callFromThread(self.incoming_mail_fetcher.startService)
+ def _create_account(self, user_mail, soledad_session):
+ account = IMAPAccount(user_mail, soledad_session.soledad)
+ return account
+
def account_email(self):
name = self.user_auth.username
return self.provider.address_for(name)
@@ -131,11 +137,10 @@ class LeapSessionFactory(object):
mail_store = LeapMailStore(soledad.soledad)
nicknym = self._create_nicknym(account_email, auth.token, auth.uuid, soledad)
- account = self._create_account(account_email, soledad)
smtp = LeapSmtp(self._provider, auth, nicknym.keymanager)
- return LeapSession(self._provider, auth, mail_store, soledad, nicknym, account, smtp)
+ return LeapSession(self._provider, auth, mail_store, soledad, nicknym, smtp)
def _lookup_session(self, key):
global SESSIONS
@@ -163,8 +168,5 @@ class LeapSessionFactory(object):
def _create_nicknym(self, email_address, token, uuid, soledad_session):
return NickNym(self._provider, self._config, soledad_session, email_address, token, uuid)
- def _create_account(self, user_mail, soledad_session):
- account = IMAPAccount(user_mail, soledad_session.soledad)
- return account
# memstore = MemoryStore(permanent_store=SoledadStore(soledad_session.soledad))
# return SoledadBackedAccount(uuid, soledad_session.soledad, memstore)