Last active
February 2, 2021 16:24
-
-
Save gahr/2ba871a6595ab700125b8f95f0939abc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void set_copy_flags(struct Email *e, bool decode, bool decrypt, | |
| CopyMessageFlags *cmflags, CopyHeaderFlags *chflags) | |
| { | |
| *cmflags = MUTT_CM_NO_FLAGS; | |
| *chflags = CH_UPDATE_LEN; | |
| assert(!(decode & decrypt)); | |
| const bool needs_decrypt = decrypt && (e->security & SEC_ENCRYPT); | |
| const bool want_pgp = WithCrypto & APPLICATION_PGP; | |
| const bool is_pgp = mutt_is_application_pgp(e->body) & SEC_ENCRYPT; | |
| const bool want_smime = WithCrypto & APPLICATION_SMIME; | |
| const bool is_smime = mutt_is_application_smime(e->body) & SEC_ENCRYPT; | |
| if (needs_decrypt && want_pgp && mutt_is_multipart_encrypted(e->body)) | |
| { | |
| *chflags = CH_NONEWLINE | CH_XMIT | CH_MIME; | |
| *cmflags = MUTT_CM_DECODE_PGP; | |
| } | |
| else if (needs_decrypt && want_pgp && is_pgp) | |
| { | |
| *chflags = CH_XMIT | CH_MIME | CH_TXTPLAIN; | |
| *cmflags = MUTT_CM_DECODE | MUTT_CM_CHARCONV; | |
| } | |
| else if (needs_decrypt && want_smime && is_smime) | |
| { | |
| *chflags = CH_NONEWLINE | CH_XMIT | CH_MIME; | |
| *cmflags = MUTT_CM_DECODE_SMIME; | |
| } | |
| else if (decode) | |
| { | |
| *chflags = CH_XMIT | CH_MIME | CH_TXTPLAIN | CH_DECODE /* then decode RFC2047 headers, */; | |
| *cmflags = MUTT_CM_DECODE | MUTT_CM_CHARCONV; | |
| if (C_CopyDecodeWeed) | |
| { | |
| *chflags |= CH_WEED; /* and respect $weed. */ | |
| *cmflags |= MUTT_CM_WEED; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment