Diffusion GpgOL b8276a4f3ace

Take plain body from OOM and not MAPI

Authored by aheinecke on Dec 12 2017, 8:23 AM.

Description

Take plain body from OOM and not MAPI

* src/mail.cpp (Mail::Mail): Initialize cache variables.
(Mail::take_cached_html_body): Optimize as take to avoid
string copies.
(Mail::take_cached_plain_body): New.
(Mail::update_oom_data): Also cache plain body.
* src/mail.h: Update accordingly.
* src/mimemaker.cpp (add_body): Adapt to take html
body logic.
(do_mime_sign, mime_encrypt): Prefer cached body over MAPI.

At least for multipart/alternative mails the MAPI property
is not updated correctly if the mail was saved as draft.
As we know that the update_oom_data / caching logic works
nicely for the HTML body we can use a similar logic for
the plain body to avoid any MAPI weirdness.

Details