summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG37
-rw-r--r--changes/bug-7480_extract_attach_and_openpgp1
-rw-r--r--changes/feature-7471_disable-local-bind-for-docker1
-rw-r--r--src/leap/mail/adaptors/soledad.py18
-rw-r--r--src/leap/mail/imap/mailbox.py39
-rw-r--r--src/leap/mail/imap/server.py6
-rw-r--r--src/leap/mail/incoming/service.py16
7 files changed, 80 insertions, 38 deletions
diff --git a/CHANGELOG b/CHANGELOG
index dc678e6..50aab8e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,28 +1,31 @@
-0.4.0rc2 Aug 26, 2015:
- o Fix nested multipart rendering. Closes: #7244
- o Bugfix: fix keyerror when inserting msg on pending_inserts dict.
- o Bugfix: Return the first cdoc if no body found
- o Feature: add very basic support for message sequence numbers.
- o Lots of style fixes and tests updates.
- o Bugfix: fixed syntax error in models.py.
-
-0.4.0rc1 Jul 10, 2015:
- o Parse OpenPGP header and import keys from it. Closes: #3879.
- o Don't add any footer to the emails. Closes: #4692.
- o Adapt to new events api on leap.common. Related to #5359.
- o Discover public keys via attachment. Closes: #5937.
- o Creates a OutgoingMail class that has the logic for encrypting, signing and
+0.4.0 Oct 28, 2015:
+ o Expose generic and protocol-agnostic public mail API.
+ o Make use of the twisted-based, async soledad API.
+ o Create a OutgoingMail class that has the logic for encrypting, signing and
sending messages. Factors that logic out of EncryptedMessage so it can be
used by other clients. Closes: #6357.
- o Refactor email fetching outside IMAP to it's own independient IncomingMail
+ o Refactor email fetching outside IMAP to its own independient IncomingMail
class. Closes: #6361.
- o Port `enum` to `enum34`. Closes #6601.
+ o Adapt to new events api on leap.common. Related to #5359.
+ o Discover public keys via attachment. Closes: #5937.
o Add public key as attachment. Closes: #6617.
+ o Parse OpenPGP header and import keys from it. Closes: #3879.
+ o Don't add any footer to the emails. Closes: #4692.
o Add listener for each email added to inbox in IncomingMail. Closes: #6742.
o Ability to reindex local UIDs after a soledad sync. Closes: #6996.
- o Update SMTP gateway docs. Closes #7169.
+ o Feature: add very basic support for message sequence numbers.
o Send a BYE command to all open connections, so that the MUA is notified
when the server is shutted down.
+ o Fix nested multipart rendering. Closes: #7244
+ o Update SMTP gateway docs. Closes #7169.
+ o Bugfix: fix keyerror when inserting msg on pending_inserts dict.
+ o Bugfix: Return the first cdoc if no body found
+ o Lots of style fixes and tests updates.
+ o If the auth token has expired signal the GUI to request her to log in again
+ (Closes: #7430)
+ o don't extract openpgp header if valid attached key (Closes: #7480)
+ o disable local only tcp bind on docker containers to allow access to IMAP
+ and SMTP. Related to #7471.
0.3.11 Jan 05, 2015:
o Port `enum` to `enum34` (Closes #6601)
diff --git a/changes/bug-7480_extract_attach_and_openpgp b/changes/bug-7480_extract_attach_and_openpgp
deleted file mode 100644
index 27f668a..0000000
--- a/changes/bug-7480_extract_attach_and_openpgp
+++ /dev/null
@@ -1 +0,0 @@
-- don't extract openpgp header if valid attached key (Closes: #7480)
diff --git a/changes/feature-7471_disable-local-bind-for-docker b/changes/feature-7471_disable-local-bind-for-docker
deleted file mode 100644
index a1ccb67..0000000
--- a/changes/feature-7471_disable-local-bind-for-docker
+++ /dev/null
@@ -1 +0,0 @@
-- disable local only tcp bind on docker containers to allow access to IMAP and SMTP. Related to #7471.
diff --git a/src/leap/mail/adaptors/soledad.py b/src/leap/mail/adaptors/soledad.py
index d114707..8de83f7 100644
--- a/src/leap/mail/adaptors/soledad.py
+++ b/src/leap/mail/adaptors/soledad.py
@@ -939,15 +939,33 @@ class SoledadMailAdaptor(SoledadIndexMixin):
d = defer.gatherResults(d_docs)
return d
+ def _err_log_failure_part_docs(failure):
+ # See https://leap.se/code/issues/7495.
+ # This avoids blocks, but the real cause still needs to be
+ # isolated (0.9.0rc3) -- kali
+ log.msg("BUG ---------------------------------------------------")
+ log.msg("BUG: Error while retrieving part docs for mdoc id %s" %
+ mdoc_id)
+ log.err(failure)
+ log.msg("BUG (please report above info) ------------------------")
+ return []
+
+ def _err_log_cannot_find_msg(failure):
+ log.msg("BUG: Error while getting msg (uid=%s)" % uid)
+ return None
+
if get_cdocs:
d = store.get_doc(mdoc_id)
d.addCallback(wrap_meta_doc)
d.addCallback(get_part_docs_from_mdoc_wrapper)
+ d.addErrback(_err_log_failure_part_docs)
+
else:
d = get_parts_doc_from_mdoc_id()
d.addCallback(self._get_msg_from_variable_doc_list,
msg_class=MessageClass, uid=uid)
+ d.addErrback(_err_log_cannot_find_msg)
return d
def _get_msg_from_variable_doc_list(self, doc_list, msg_class, uid=None):
diff --git a/src/leap/mail/imap/mailbox.py b/src/leap/mail/imap/mailbox.py
index c7accbb..bfc0bfc 100644
--- a/src/leap/mail/imap/mailbox.py
+++ b/src/leap/mail/imap/mailbox.py
@@ -77,6 +77,32 @@ INIT_FLAGS = (MessageFlags.SEEN_FLAG, MessageFlags.ANSWERED_FLAG,
MessageFlags.LIST_FLAG)
+def make_collection_listener(mailbox):
+ """
+ Wrap a mailbox in a class that can be hashed according to the mailbox name.
+
+ This means that dicts or sets will use this new equality rule, so we won't
+ collect multiple instances of the same mailbox in collections like the
+ MessageCollection set where we keep track of listeners.
+ """
+
+ class HashableMailbox(object):
+
+ def __init__(self, mbox):
+ self.mbox = mbox
+
+ def __hash__(self):
+ return hash(self.mbox.mbox_name)
+
+ def __eq__(self, other):
+ return self.mbox.mbox_name == other.mbox.mbox_name
+
+ def notify_new(self):
+ self.mbox.notify_new()
+
+ return HashableMailbox(mailbox)
+
+
class IMAPMailbox(object):
"""
A Soledad-backed IMAP mailbox.
@@ -118,7 +144,7 @@ class IMAPMailbox(object):
self.rw = rw
self._uidvalidity = None
self.collection = collection
- self.collection.addListener(self)
+ self.collection.addListener(make_collection_listener(self))
@property
def mbox_name(self):
@@ -383,6 +409,7 @@ class IMAPMailbox(object):
def notify_new(self, *args):
"""
Notify of new messages to all the listeners.
+
This will be called indirectly by the underlying collection, that will
notify this IMAPMailbox whenever there are changes in the number of
messages in the collection, since we have added ourselves to the
@@ -405,13 +432,15 @@ class IMAPMailbox(object):
def _get_notify_count(self):
"""
- Get message count and recent count for this mailbox
- Executed in a separate thread. Called from notify_new.
+ Get message count and recent count for this mailbox.
:return: a deferred that will fire with a tuple, with number of
messages and number of recent messages.
:rtype: Deferred
"""
+ # XXX this is way too expensive in cases like multiple APPENDS.
+ # We should have a way of keep a cache or do a self-increment for that
+ # kind of calls.
d_exists = defer.maybeDeferred(self.getMessageCount)
d_recent = defer.maybeDeferred(self.getRecentCount)
d_list = [d_exists, d_recent]
@@ -875,8 +904,8 @@ class IMAPMailbox(object):
uid when the copy succeed.
:rtype: Deferred
"""
- if PROFILE_CMD:
- do_profile_cmd(d, "COPY")
+ # if PROFILE_CMD:
+ # do_profile_cmd(d, "COPY")
# A better place for this would be the COPY/APPEND dispatcher
# in server.py, but qtreactor hangs when I do that, so this seems
diff --git a/src/leap/mail/imap/server.py b/src/leap/mail/imap/server.py
index 8f14936..99e7174 100644
--- a/src/leap/mail/imap/server.py
+++ b/src/leap/mail/imap/server.py
@@ -269,12 +269,6 @@ class LEAPIMAPServer(imap4.IMAP4Server):
select_FETCH = (do_FETCH, imap4.IMAP4Server.arg_seqset,
imap4.IMAP4Server.arg_fetchatt)
- def notifyNew(self, ignored=None):
- """
- Notify new messages to listeners.
- """
- reactor.callFromThread(self.mbox.notify_new)
-
def _cbSelectWork(self, mbox, cmdName, tag):
"""
Callback for selectWork
diff --git a/src/leap/mail/incoming/service.py b/src/leap/mail/incoming/service.py
index d554c51..d8b91ba 100644
--- a/src/leap/mail/incoming/service.py
+++ b/src/leap/mail/incoming/service.py
@@ -228,18 +228,18 @@ class IncomingMail(Service):
def _log_synced(result):
log.msg('FETCH soledad SYNCED.')
return result
- try:
- log.msg('FETCH: syncing soledad...')
- d = self._soledad.sync()
- d.addCallback(_log_synced)
- return d
- # TODO is this still raised? or should we do failure.trap
- # instead?
- except InvalidAuthTokenError:
+
+ def _signal_invalid_auth(failure):
+ failure.trap(InvalidAuthTokenError)
# if the token is invalid, send an event so the GUI can
# disable mail and show an error message.
emit_async(catalog.SOLEDAD_INVALID_AUTH_TOKEN)
+ log.msg('FETCH: syncing soledad...')
+ d = self._soledad.sync()
+ d.addCallbacks(_log_synced, _signal_invalid_auth)
+ return d
+
def _signal_fetch_to_ui(self, doclist):
"""
Send leap events to ui.