diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2012-04-23 22:23:42 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2012-04-23 22:23:42 +0200 |
commit | b0340a0a8e58b2a3608fd04f1dbd79d260f81cbb (patch) | |
tree | cf802f53f1dc0834af7c4890e52ade5e14710de7 /alot/crypto.py | |
parent | 40756e734ae4ec14d0a9705910b0d6385517d27f (diff) |
remove custom passphrase cb, eliminate code duplication
Diffstat (limited to 'alot/crypto.py')
-rw-r--r-- | alot/crypto.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/alot/crypto.py b/alot/crypto.py index 47eeb7ed..911e3a17 100644 --- a/alot/crypto.py +++ b/alot/crypto.py @@ -1,10 +1,21 @@ # vim:ts=4:sw=4:expandtab import re +from email.generator import Generator +from cStringIO import StringIO import pyme.core import pyme.constants +def email_as_string(mail): + # Converting inner_msg to text with as_string() mangles lines + # beginning with "From", therefore we do it the hard way. + fp = StringIO() + g = Generator(fp, mangle_from_=False) + g.flatten(mail) + return RFC3156_canonicalize(fp.getvalue()) + + def _engine_file_name_by_protocol(engines, protocol): for engine in engines: if engine.protocol == protocol: |