summaryrefslogtreecommitdiff
path: root/src/leap/mail/incoming
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
commit04baa4e421d22b02b259284c3f119d8480a989fa (patch)
treec78425e0baa7b157240404059e1f85496628b0e9 /src/leap/mail/incoming
parente2b3cc5c88dd8f66ec02fe644944218d58e996d8 (diff)
[refactor] log the added key explicitely
Diffstat (limited to 'src/leap/mail/incoming')
-rw-r--r--src/leap/mail/incoming/service.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/leap/mail/incoming/service.py b/src/leap/mail/incoming/service.py
index 4ae4a40..d554c51 100644
--- a/src/leap/mail/incoming/service.py
+++ b/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))