summaryrefslogtreecommitdiff
path: root/src/leap/mail/imap/fetch.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/mail/imap/fetch.py')
-rw-r--r--src/leap/mail/imap/fetch.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/leap/mail/imap/fetch.py b/src/leap/mail/imap/fetch.py
index 3b15c6a..2b25d82 100644
--- a/src/leap/mail/imap/fetch.py
+++ b/src/leap/mail/imap/fetch.py
@@ -29,7 +29,8 @@ from twisted.internet.threads import deferToThread
from leap.common import events as leap_events
from leap.common.check import leap_assert, leap_assert_type
-from leap.soledad import Soledad
+from leap.soledad.client import Soledad
+from leap.soledad.common.crypto import ENC_SCHEME_KEY, ENC_JSON_KEY
from leap.common.events.events_pb2 import IMAP_FETCHED_INCOMING
from leap.common.events.events_pb2 import IMAP_MSG_PROCESSING
@@ -47,9 +48,6 @@ class LeapIncomingMail(object):
Fetches mail from the incoming queue.
"""
- ENC_SCHEME_KEY = "_enc_scheme"
- ENC_JSON_KEY = "_enc_json"
-
RECENT_FLAG = "\\Recent"
INCOMING_KEY = "incoming"
@@ -104,7 +102,6 @@ class LeapIncomingMail(object):
Calls a deferred that will execute the fetch callback
in a separate thread
"""
- logger.debug('fetching mail...')
d = deferToThread(self._sync_soledad)
d.addCallbacks(self._process_doclist, self._sync_soledad_err)
return d
@@ -125,7 +122,6 @@ class LeapIncomingMail(object):
def _sync_soledad(self):
log.msg('syncing soledad...')
- logger.debug('in soledad sync')
try:
self._soledad.sync()
@@ -159,11 +155,11 @@ class LeapIncomingMail(object):
leap_events.signal(
IMAP_MSG_PROCESSING, str(index), str(num_mails))
keys = doc.content.keys()
- if self.ENC_SCHEME_KEY in keys and self.ENC_JSON_KEY in keys:
+ if ENC_SCHEME_KEY in keys and ENC_JSON_KEY in keys:
# XXX should check for _enc_scheme == "pubkey" || "none"
# that is what incoming mail uses.
- encdata = doc.content[self.ENC_JSON_KEY]
+ encdata = doc.content[ENC_JSON_KEY]
defer.Deferred(self._decrypt_msg(doc, encdata))
else:
logger.debug('This does not look like a proper msg.')
@@ -212,6 +208,7 @@ class LeapIncomingMail(object):
return False
logger.debug('got incoming message: %s' % (rawmsg,))
+ # XXX factor out gpg bits.
try:
pgp_beg = "-----BEGIN PGP MESSAGE-----"
pgp_end = "-----END PGP MESSAGE-----"