Add initial draft encryption support
authorAndre Heinecke <aheinecke@gnupg.org>
Wed, 10 Apr 2019 07:30:24 +0000 (09:30 +0200)
committerAndre Heinecke <aheinecke@gnupg.org>
Wed, 10 Apr 2019 07:30:24 +0000 (09:30 +0200)
commit9e4788126247e53310f8f2324843184bb57cf663
treeceb0c1f79a19dc96c26c6b808bf4f70b67b423e3
parent49c36afbba982a1ba25b93aba3cdf26202c7efd4
Add initial draft encryption support

* src/common_indep.h (opt): Add option draft_key.
* src/cryptcontroller.cpp (CryptController::resolve_keys): Handle
draft and resolve to draft key.
(CryptController::do_crypto): Don't sign draft encrypts.
* src/mail.cpp (Mail::Mail): New state variable for drafts.
(do_crypt): Handle draft encryption.
(Mail::encryptSignStart_o): Disable inline pgp for drafts.
(Mail::updateCryptOOM_o): Don't wipe but trick Outlook when
encrypting drafts.
(Mail::prepareCrypto_o): New. Factored out from send event.
* src/mail.h: Update accordingly.
* src/mailitem-events.cpp (BeforeAutoSave): New. Start
encryption.
(Write, AfterWrite): Add handling for drafts.
* src/main.c (read_options): Read draftKey and draftEnc.
* src/windowmessages.cpp (CRYPTO_DONE): Handle drafts.

--
This uses some tricks to add draft encryption in a
way that the user does not notice. E.g. when an
autosave happens.

It's still a bit fragile and needs more work but the
basics work for explict draft save and autosave.

GnuPG-Bug-Id: T4388
src/common_indep.h
src/cryptcontroller.cpp
src/mail.cpp
src/mail.h
src/mailitem-events.cpp
src/main.c
src/windowmessages.cpp