summaryrefslogtreecommitdiff
path: root/mail/src/leap
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-09-22 14:45:57 -0400
committerKali Kaneko <kali@leap.se>2015-09-22 15:31:04 -0400
commitcc437cd97cb8ee43e6042cd510963f57a7db53c2 (patch)
tree5c0f450cc294ec9cec69c9bbf2c284304f5924b2 /mail/src/leap
parentdc4983956fc849c4a9e0f6ee7464cabbc103ec17 (diff)
[refactor] log the added key explicitely
Diffstat (limited to 'mail/src/leap')
-rw-r--r--mail/src/leap/mail/incoming/service.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/mail/src/leap/mail/incoming/service.py b/mail/src/leap/mail/incoming/service.py
index 4ae4a40..d554c51 100644
--- a/mail/src/leap/mail/incoming/service.py
+++ b/mail/src/leap/mail/incoming/service.py
@@ -689,12 +689,16 @@ class IncomingMail(Service):
:type address: str
:return: A Deferred that will be fired when all the keys are stored
- with a boolean True if there was a valid key attached or
- False in other case
+ with a boolean: True if there was a valid key attached, or
+ False otherwise.
:rtype: Deferred
"""
MIME_KEY = "application/pgp-keys"
+ def log_key_added(ignored):
+ logger.debug('Added key found in attachment for %s' % address)
+ return True
+
def failed_put_key(failure):
logger.info("An error has ocurred adding attached key for %s: %s"
% (address, failure.getErrorMessage()))
@@ -703,12 +707,11 @@ class IncomingMail(Service):
deferreds = []
for attachment in attachments:
if MIME_KEY == attachment.get_content_type():
- logger.debug("Add key from attachment")
d = self._keymanager.put_raw_key(
attachment.get_payload(),
OpenPGPKey,
address=address)
- d.addCallbacks(lambda _: True, failed_put_key)
+ d.addCallbacks(log_key_added, failed_put_key)
deferreds.append(d)
d = defer.gatherResults(deferreds)
d.addCallback(lambda result: any(result))