summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTulio Casagrande <tcasagra@thoughtworks.com>2017-01-24 18:05:08 -0200
committerRuben Pollan <meskio@sindominio.net>2017-01-31 09:44:25 +0100
commit74ca3ef54cd013ced72948bc7fef4fddf0ea53bb (patch)
tree7d427f3efc8b86cb0683a4a6c781ba05e38c94b5
parent9a48a359c478718622a7c94b160677d8f9e67c84 (diff)
Extract method for easy reuse
Signed-off-by: Ruben Pollan <meskio@sindominio.net>
-rw-r--r--src/leap/bitmask/mail/incoming/service.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/leap/bitmask/mail/incoming/service.py b/src/leap/bitmask/mail/incoming/service.py
index 5b7ed84..62e65c8 100644
--- a/src/leap/bitmask/mail/incoming/service.py
+++ b/src/leap/bitmask/mail/incoming/service.py
@@ -458,6 +458,11 @@ class IncomingMail(Service):
signkey.fingerprint)
return decrmsg.as_string()
+ d = self._decrypt_by_content_type(msg, senderAddress, encoding)
+ d.addCallback(add_leap_header)
+ return d
+
+ def _decrypt_by_content_type(self, msg, senderAddress, encoding):
if msg.get_content_type() == MULTIPART_ENCRYPTED:
d = self._decrypt_multipart_encrypted_msg(msg, senderAddress)
elif msg.get_content_type() == MULTIPART_SIGNED:
@@ -465,7 +470,7 @@ class IncomingMail(Service):
else:
d = self._maybe_decrypt_inline_encrypted_msg(
msg, encoding, senderAddress)
- d.addCallback(add_leap_header)
+ d.addErrback(self._errback)
return d
def _add_verified_signature_header(self, decrmsg, fingerprint):