summaryrefslogtreecommitdiff
path: root/service/pixelated/support/ext_fetch.py
blob: ab0def9f47436e9514e3bdc7c2e85a733a1e3183 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import leap.mail.imap.fetch as fetch


def mark_as_encrypted(f):

    def w(*args, **kwargs):
        msg, was_decrypted = f(*args)
        msg.add_header('X-Pixelated-encryption-status', 'true' if was_decrypted else 'false')
        return msg, was_decrypted
    return w


fetch.LeapIncomingMail._maybe_decrypt_inline_encrypted_msg = mark_as_encrypted(fetch.LeapIncomingMail._maybe_decrypt_inline_encrypted_msg)
fetch.LeapIncomingMail._decrypt_multipart_encrypted_msg = mark_as_encrypted(fetch.LeapIncomingMail._decrypt_multipart_encrypted_msg)