diff options
-rw-r--r-- | src/leap/mail/incoming/service.py | 11 |
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)) |