4 weeks agoPost release version bump master
Andre Heinecke [Sun, 14 Jul 2019 09:46:06 +0000 (11:46 +0200)]
Post release version bump


4 weeks agoAuto update po files gpgol-2.4.2
Andre Heinecke [Sun, 14 Jul 2019 09:40:31 +0000 (11:40 +0200)]
Auto update po files


4 weeks agoUpdate NEWS for todays release
Andre Heinecke [Sun, 14 Jul 2019 09:35:19 +0000 (11:35 +0200)]
Update NEWS for todays release


4 weeks agoAdd safeguard against plaintext leaks after close
Andre Heinecke [Sun, 14 Jul 2019 09:25:22 +0000 (11:25 +0200)]
Add safeguard against plaintext leaks after close

* src/mail.cpp (Mail::close): Add saveguards against plaintext

The underlying new understanding of this fix is that
close with discard changes does not neccessarily discard
changes in the data model when the same mail is opened
multiple times.

First we improve by:

    mail->setCloseTriggered (false);

After our close, that the user is not asked to save changes
when the mail is opened for the third time.

Then by checking if there is still a body in the data
model we ensure that we do not allow the next write
to pass. The attachment check additionally checks
for leftover attachments.

This can create problems with PGP Partitioned mails
which we might have to improve later by checking with
gpgme_data_identify if it is actually plain text.

But this affects only the moving of mails and annoying
questions when closing outlook. So it should not be
too bad.

GnuPG-Bug-Id: T4622
GnuPG-Bug-Id: T4621

4 weeks agoEnsure passNextWrite is reset after passing it
Andre Heinecke [Sun, 14 Jul 2019 09:23:23 +0000 (11:23 +0200)]
Ensure passNextWrite is reset after passing it

* src/mailitem-events.cpp (Write): After passing a
write because of passNextWrite ensure that it is set back.

This is usually not a problem because the passWrite happens
only after closing with discard changes and usually an unload
follows. But if the mail is open multiple times it could
happen that the state here was broken.

GnuPG-Bug-Id: T4622

4 weeks agoFix mail display when plaintext opt changes in run
Andre Heinecke [Sun, 14 Jul 2019 07:34:49 +0000 (09:34 +0200)]
Fix mail display when plaintext opt changes in run

* src/gpgoladdin.cpp (check_html_preferred): Export.
* src/gpgoladdin.h: Add prototype.
* src/mail.cpp (decryptVerify_o): check_html_preferred for each

This is the safest way and we only read a registry key
so this should not really decrease performance.

GnuPG-Bug-Id: T4611

4 weeks agoPrint sigsum if in debug when invalid
Andre Heinecke [Sun, 14 Jul 2019 06:53:10 +0000 (08:53 +0200)]
Print sigsum if in debug when invalid

* src/parsecontroller.cpp (is_valid_checksum): Print sigsum.

This should help with remotely analyzing problems.

2 months agoPost release version bump
Andre Heinecke [Sat, 15 Jun 2019 04:11:13 +0000 (06:11 +0200)]
Post release version bump


2 months agoAuto update PO files gpgol-2.4.1
Andre Heinecke [Sat, 15 Jun 2019 04:07:07 +0000 (06:07 +0200)]
Auto update PO files


2 months agoUpdate NEWS for todays release
Andre Heinecke [Sat, 15 Jun 2019 04:06:39 +0000 (06:06 +0200)]
Update NEWS for todays release


2 months agoDo not show attachment warning when printing
Andre Heinecke [Tue, 11 Jun 2019 09:59:37 +0000 (11:59 +0200)]
Do not show attachment warning when printing

* src/mail.cpp (Mail::parsing_done): Silently remove
unencrypted attachments.


When printing we have already shown the warning. So we
should not show it again but silently remove any attachments
that are not hidden before our add_attachments. This
also fixes an issue that when printing sometimes the
child mails which are created for preview and print already
have the decrypted attachments.

GnuPG-Bug-Id: T4560

2 months agoAdd silent mode to checkAttachments
Andre Heinecke [Tue, 11 Jun 2019 09:57:16 +0000 (11:57 +0200)]
Add silent mode to checkAttachments

* src/mail.cpp (Mail::checkAttachments_o): Add silent mode
to silently fixup the attachments which are bad.
* src/mail.h: Update accordingly.

2 months agoRemove "Print decrypted" action
Andre Heinecke [Tue, 11 Jun 2019 09:54:08 +0000 (11:54 +0200)]
Remove "Print decrypted" action

* src/gpgoladdin.cpp (GpgolRibbonExtender::GetIDsOfNames): Remove
printDecrypted mapping.
(GpgolRibbonExtender::Invoke): Remove print_decrypted mapping.
(GetCustomUI_MIME): Remove custom print action.
* src/ribbon-callbacks.cpp (print_decrypted): Remove.
* src/ribbon-callbacks.h: Update accordingly.

Since we now handle print on an application level we no longer
need a custom command for printing. Tested with OL 2010 and

GnuPG-Bug-Id: T4560

2 months agoAdd a better comment about the save as
Andre Heinecke [Fri, 7 Jun 2019 13:31:46 +0000 (15:31 +0200)]
Add a better comment about the save as

* src/ribbon-callbacks.cpp (override_file_save_as): Add better comment.

Try to explain it so that I can understand again in some years ;-)

2 months agoImplement File->SaveAs for crypt mail
Andre Heinecke [Fri, 7 Jun 2019 13:23:43 +0000 (15:23 +0200)]
Implement File->SaveAs for crypt mail

* src/application-events.cpp: Ignore next ItemLoad if
ignore next load is true.
* src/gpgoladdin.cpp (GpgolRibbonExtender::GetIDsOfNames): Map
(GpgolRibbonExtender::Invoke): Call override_file_save_as.
(GetCustomUI_MIME): Override FileSaveAs.
* src/gpgoladdin.h: Add a global g_ignore_next_load.
* src/ribbon-callbacks.cpp (override_file_save_as): Set the
variable and then pass the event along.
* src/ribbon-callbacks.h (override_file_save_as): Declare.

While this fix looks trivial the important line is:

    parms->rgvarg[0].pvarVal->boolVal = VARIANT_FALSE;

which passes along the SaveAs command. This is new
knowledge in GpgOL.

GnuPG-Bug-Id: T4318

2 months agoImprove some debug output
Andre Heinecke [Fri, 7 Jun 2019 13:22:03 +0000 (15:22 +0200)]
Improve some debug output

* src/gpgoladdin.cpp (GpgolRibbonExtender::Invoke): Switch
to log_oom and add commented out params analysis code.

2 months agoAdd introspection debug code for variants
Andre Heinecke [Fri, 7 Jun 2019 13:05:21 +0000 (15:05 +0200)]
Add introspection debug code for variants

* src/oomhelp.cpp (format_variant, format_dispparms): Add debug
functions to print variant information.

This can be useful when trying to figure out how stuff that
C# does works in C.

2 months agoAlso do not print categories in quick print
Andre Heinecke [Fri, 7 Jun 2019 11:09:55 +0000 (13:09 +0200)]
Also do not print categories in quick print

* src/mail.h (updateCategories_o): Make public.
* src/ribbon-callbacks.cpp (print_decrypted): Remove categories
before print and add them after.

I think this is the more wanted behavior. If users used the
categories to mark mails as kind of "Top Secret" they should
just buy a stamp.

GnuPG-Bug-Id: T4560

2 months agoImplement printing from the file menu
Andre Heinecke [Fri, 7 Jun 2019 10:50:09 +0000 (12:50 +0200)]
Implement printing from the file menu

* src/application-events.cpp (BeforePrint): Note down that
a before print was seen.
(ItemLoad): If a BeforePrint was seen. Mark the mail.
* src/mail.cpp (setIsPrint, isPrint, m_printing): New state.
(Mail::decryptVerify_o): Do not do async decryption when printing.
Check for childs of print mails.
(Mail::updateCategories_o): Do not set categories for prints.
(Mail::checkIfMailIsChildOfPrintMail_o): Check if the currently
decrypting mail is actually a print.

The BeforePrint event allows us to catch when we are printing. In
that case we do blocking decryption (which we already had implemented
as a debug option \o/).

But we see multiple mailitems here. One is the mail as currently
visible in the Inspector. One is the Mail in the print preview,
which we mark as print. And the last one is the actual printout
that is loaded once the "Print" button is really pressed.

The third one makes the checkIfMailIsChildOfPrintMail_o code

GnuPG-Bug-Id: T4560

2 months agoUse ApplicationEvents_11 Interface
Andre Heinecke [Fri, 7 Jun 2019 10:06:28 +0000 (12:06 +0200)]
Use ApplicationEvents_11 Interface

* src/application-events.cpp (BeforePrint): New value.
(END_EVENT_SINK): Use ApplactionEvents_11.
* src/oomhelp.h: Define ApplactionEvents_11 ID.

BeforePrint is not documented in MSDN but it is shown as
BeforePrint in OutlookSpys event log and it seems to
work with Ol 2016.

Needs to be tested on Ol 2010.

GnuPG-Bug-Id: T4560

2 months agoRevert "Only use IPM.Note.SMIME.MultipartSigned for SMIME"
Andre Heinecke [Tue, 4 Jun 2019 08:38:32 +0000 (10:38 +0200)]
Revert "Only use IPM.Note.SMIME.MultipartSigned for SMIME"

This reverts commit 7323a82d1f8d548b85eb1c4cf7cd1e0c0224c246.

2 months agoPost release version bump
Andre Heinecke [Mon, 3 Jun 2019 14:41:54 +0000 (16:41 +0200)]
Post release version bump


2 months agoRemove leftover dbg output with bad w64 format gpgol-2.4.0
Andre Heinecke [Mon, 3 Jun 2019 14:38:01 +0000 (16:38 +0200)]
Remove leftover dbg output with bad w64 format

* src/keycache.cpp (filter_chain): Remove a dev debug output.

2 months agoUse correct version number in
Andre Heinecke [Mon, 3 Jun 2019 14:35:44 +0000 (16:35 +0200)]
Use correct version number in

* Bump version.

2 months agoUpdate NEWS for todays release
Andre Heinecke [Mon, 3 Jun 2019 14:29:48 +0000 (16:29 +0200)]
Update NEWS for todays release


2 months agoUpdate NEWS for 2.4.0
Andre Heinecke [Mon, 3 Jun 2019 13:35:22 +0000 (15:35 +0200)]
Update NEWS for 2.4.0

* NEWS: Update.

We do a minor bump because of draft encryption
and S/MIME Address book integration.

2 months agoAuto update po files
Andre Heinecke [Mon, 3 Jun 2019 13:27:22 +0000 (15:27 +0200)]
Auto update po files


2 months agoCorrect a confusing debug message
Andre Heinecke [Mon, 3 Jun 2019 13:25:44 +0000 (15:25 +0200)]
Correct a confusing debug message

* src/mapihelp.cpp (mapi_change_message_class): Clarify.

It would have printed Message is not a crypto message even
for crypto messages that already had the right class.

2 months agoIncrease bufsize and linebuf size for broken MUAs
Andre Heinecke [Mon, 3 Jun 2019 13:15:36 +0000 (15:15 +0200)]
Increase bufsize and linebuf size for broken MUAs

* src/mimedataprovider.cpp (BUFSIZE, LINEBUFSIZE): Increase.

RFC-5322 Section 2.1.1. clearly states line lenght limits.
But some MUA's, in this case SecurePIM ignore this and
put the full HTML Mail in a single line.

GnuPG-Bug-Id: T4552

2 months agoOnly use IPM.Note.SMIME.MultipartSigned for SMIME
Andre Heinecke [Mon, 3 Jun 2019 12:48:33 +0000 (14:48 +0200)]
Only use IPM.Note.SMIME.MultipartSigned for SMIME

* src/mimemaker.cpp (finalize_message): Always use
GnuPG-Bug-ID: T4553

2 months agoAdd debug output for exchange version
Andre Heinecke [Mon, 3 Jun 2019 08:06:51 +0000 (10:06 +0200)]
Add debug output for exchange version

* src/oomhelp.cpp (get_ex_major_version_for_addr): Add debug

2 months agoOnly set IPM.Note.SMIME on Exchange 2016 and later
Andre Heinecke [Mon, 3 Jun 2019 07:39:05 +0000 (09:39 +0200)]
Only set IPM.Note.SMIME on Exchange 2016 and later

* src/cryptcontroller.cpp (CryptController::update_mail_mapi):
Pass exchange major version.
* src/mimemaker.cpp (finalize_message): Add exchange_major_version
param and handle it.

This fixes encrypted mails for non exchange servers / older
exchanges. They handle IPM.Note.SMIME apparently not to

As multipart signed is proven to work but shows the wrong
icon for older exchanges we are conservative and only
use it for exchange major version 15 and later.

2 months agoAlways pass write in NeedsFirstAfterWrite state
Andre Heinecke [Tue, 28 May 2019 13:30:04 +0000 (15:30 +0200)]
Always pass write in NeedsFirstAfterWrite state

* src/mailitem-events.cpp (Write): Pass write for

This means that we are currently encrypting this mail,
thus we always want to let the write through. This
might fix an issue that reuqired users to click send

GnuPG-Bug-Id: T4528

2 months agoFix T3656 workaround for encrypted S/MIME
Andre Heinecke [Tue, 28 May 2019 13:27:49 +0000 (15:27 +0200)]
Fix T3656 workaround for encrypted S/MIME

* src/mailitem-events.cpp (Send): Fix msg class check.

The T3656 workaround is an ugly beast and should only
be used when really really necessary. The issue
could have caused the "double forwarding click required"
described in:

GnuPG-Bug-Id: T4528

2 months agoFix moving / closing S/MIME mails with attachments
Andre Heinecke [Tue, 28 May 2019 13:17:45 +0000 (15:17 +0200)]
Fix moving / closing S/MIME mails with attachments

* src/mail.cpp (Mail::close): Save changes after close
to fix T4525

My understanding of this issue and the fix for
it is that Outlook with exchange detects that our mails
are S/MIME mails. As the attachments are modified by us
outlook wants to save the changes on move.

This fails because it can't do the crypto.
Leading to the error. This also happens when
such a mail is closed.

The trick is to save the mail in MAPI (our
plaintext is only in OOM) so that the message class
becomes a gpgol message class in MAPI.
The problem with that is outlined in T4543

GnuPG-Bug-Id: T4525

2 months agoAdd accessor for msgtype
Andre Heinecke [Tue, 28 May 2019 13:13:21 +0000 (15:13 +0200)]
Add accessor for msgtype

* src/mail.h (Mail::msgtype): New.

2 months agoFix refcount error in rare error handler
Andre Heinecke [Tue, 28 May 2019 12:15:36 +0000 (14:15 +0200)]
Fix refcount error in rare error handler

* src/oomhelp.cpp (get_oom_object): Do not release pStart on

get_oom_object should never release the starting pointer.
This happened very rarely but the error condition could
occur on shutdown when Objects become invalid.

2 months agoUse unquoted content id for related attachments
Andre Heinecke [Tue, 28 May 2019 11:20:59 +0000 (13:20 +0200)]
Use unquoted content id for related attachments

* src/mail.cpp (fixup_last_attachment_o): Use unquoted cid.

This fixes forwarding of mails with embedded images.
Previously the content id would be broken.

GnuPG-Bug-Id: T4322

2 months agoSaveguard against related attachment hiding
Andre Heinecke [Tue, 28 May 2019 09:08:21 +0000 (11:08 +0200)]
Saveguard against related attachment hiding

* src/mail.cpp (fixup_last_attachment_o): Search for
cid in html body before setting it.

As outlook hides elements with a content id and
we cannot seem to prevent that we now make extra
sure that the content id is actually referenced
in the mail body before setting it.

This fixes an issue when forwarding attachments
and might also be the reason for other hidden

GnuPG-Bug-Id: T4203
GnuPG-Bug-Id: T4526

2 months agoFix forwarding of plain text mails with CID attachs
Andre Heinecke [Tue, 28 May 2019 08:15:42 +0000 (10:15 +0200)]
Fix forwarding of plain text mails with CID attachs

* src/mimemaker.cpp (add_body_and_attachments): Handle non
related case better.
(write_attachments): Do not filter attachments with CID in
non related case.

Before this the code had the assumption that a content-id
could only exist on an attachment for HTML mails as it otherwise
does not make sense.

But when forwarding mails with attachments they somehow
get a content id and thus in the case of plain text mails
they were filtered out.

GnuPG-Bug-Id: T4526

2 months agoImprove debug output for attachment handling
Andre Heinecke [Tue, 28 May 2019 08:14:44 +0000 (10:14 +0200)]
Improve debug output for attachment handling

* src/mapihelp.cpp (mapi_create_attach_table): Debug attach
method and type.
* src/mimemaker.cpp (write_attachments): Log when attachments
are skipped.

2 months agoFix double free in error handler
Andre Heinecke [Tue, 28 May 2019 08:12:52 +0000 (10:12 +0200)]
Fix double free in error handler

* src/mailitem-events.cpp (Send): Fix double free in error handler.

As this only happened when we failed to obtain the message class
(which is afaik impossible) it was not a real world issue.

2 months agoHandle multipe valid secret keys better
Andre Heinecke [Mon, 20 May 2019 11:48:50 +0000 (13:48 +0200)]
Handle multipe valid secret keys better

* src/keycache.cpp (compareSkeys): New.
(setPgpKeySecret, setSmimeKeySecret): Use it.

This checks for the capabilities of keys and then
orders them to resolve multiple valid signing keys automatically.

Fixes internal encryption with a specific cert only for
sign and one for encrypt.

2 months agoChange S/MIME Message Class handling
Andre Heinecke [Mon, 20 May 2019 11:44:06 +0000 (13:44 +0200)]
Change S/MIME Message Class handling

* src/olflange.cpp (install_forms): Register new icons
* src/mimemaker.cpp (finalize_message): Use SMIME for encryption.
* src/revert.cpp (gpgol_mailitem_revert): Use standard classes.
* src/mapihelp.cpp (change_message_class_ipm_note_smime)
(mapi_change_message_class): Split up MultipartSigned and

This allows us to use better icons which should lead to
less confusion.

Interoperability issues are also addressed by changing
the message class to a value more standard.

GnuPG-Bug-Id: T4278

2 months agoUse similar S/MIME icons as Outlook
Andre Heinecke [Mon, 20 May 2019 11:39:07 +0000 (13:39 +0200)]
Use similar S/MIME icons as Outlook

* forms/ Add new files.
* encr-s-smime.ico, encr-s-yellow.xcf, ribbon-red.xcf,
sign-s-smime.ico, gpgol-form-signed-smime.cfg,
gpgol-form-signed-smime-opaque.cfg, gpgol-form-encrypted-smime.cfg:

This introduces the Message Class
"IPM.Note.GpgOL.SM.MultipartSigned" to display a similar ribbon
as Outlook does and for better distinction internally.

2 months agoFix dangerous memdbg pattern
Andre Heinecke [Mon, 20 May 2019 08:43:43 +0000 (10:43 +0200)]
Fix dangerous memdbg pattern

* src/mapihelp.cpp (is_really_cms_encrypted)
(get_first_attach_mime_tag, mapi_create_attach_table)
(mapi_get_attach, mapi_mark_moss_attach): Use memdbg_addref after
error checking.

This might fix a crash when memdbg was enabled and
errors occoured.

3 months agoUpdate german translation
Andre Heinecke [Wed, 8 May 2019 06:24:25 +0000 (08:24 +0200)]
Update german translation

* po/de.po: Translate new strings

3 months agoAuto update po files
Andre Heinecke [Wed, 8 May 2019 05:59:16 +0000 (07:59 +0200)]
Auto update po files

* po/*: Update

3 months agoOnly autosecure when seckey found for CMS
Andre Heinecke [Mon, 6 May 2019 12:57:16 +0000 (14:57 +0200)]
Only autosecure when seckey found for CMS

* src/keycache.cpp (isMailResolvable): If the prefer smime
option is selected only autosecure if there is a secret CMS cert.

When OpenPGP keys could be found for all recipients
it would toggle autosecure even if S/MIME was preferred.
As we don't have a good way to automatically handle
SMIME key generation we should not automatically toggle
encryption for that case.

GnuPG-Bug-Id: T4483

3 months agoFix T3656 workaround activation
Andre Heinecke [Mon, 6 May 2019 12:16:26 +0000 (14:16 +0200)]
Fix T3656 workaround activation

* src/mailitem-events.cpp (Send): Do not activate T3656 workaround
for non-info path form msg class.

As we set it now it becomes also our class.

3 months agoFix locale of opened dialogs
Andre Heinecke [Mon, 6 May 2019 12:15:11 +0000 (14:15 +0200)]
Fix locale of opened dialogs

* src/w32-gettext.cpp (_nl_locale_name): Check UI language only

In some callbacks e.g. if you click the open options button we
can get an error trying to access the LanguageSettings object
so it is better just to cache it. Outlook requires a restart
for language changes to take effect anyway.

3 months agoFix some draft encrypt sending issues
Andre Heinecke [Mon, 6 May 2019 12:14:12 +0000 (14:14 +0200)]
Fix some draft encrypt sending issues

* src/mailitem-events.cpp (Send): Ensure draft mark is removed.
(Write): Only start draft encrypt on No crypt mails.
(AfterWrite): Release current item on error.

3 months agoAdd S/MIME Addressbook integration
Andre Heinecke [Mon, 6 May 2019 10:20:34 +0000 (12:20 +0200)]
Add S/MIME Addressbook integration

* src/addressbook.cpp (parse_output): New. Move the more
complex output parsing out.
(open_keyadder): Add --cms option. Send CMS certificates, too.
(Addressbook::update_key_o): Fix mem leak of user_props on error.
Add handling for CMS / SMIME.
(Addressbook::edit_key_o): Add handling for CMS.
(Addressbook::check_o): Add handling for CMS.
* src/addressbook.h (callback_args_t): Extend for cms.
* src/cryptcontroller.cpp (CryptController::resolve_keys): Add
overrides and args for SMIME.
* src/keycache.cpp (filter_chain): New. Helper to filter non leaf
(do_update, getOverrides, onAddrBookImportJobDone, importFromAddrBook):
Handle S/MIME.
* src/keycache.h: Update accordingly.

It is now possible to set both S/MIME and OpenPGP Overrides.
This code handles it. It requires an updates keyadder and
keyresolver from Gpg4win-tools together with the latest

GnuPG-Bug-Id: T4479

3 months agoChange addr book ribbon icon to "settings"
Andre Heinecke [Mon, 6 May 2019 10:16:58 +0000 (12:16 +0200)]
Change addr book ribbon icon to "settings"

* src/gpgoladdin.cpp (GetCustomUI): Fix strings for
the new "settings" functionality.

3 months agoAdd note about IPM.Note.SMIME in mimemaker
Andre Heinecke [Mon, 6 May 2019 10:14:55 +0000 (12:14 +0200)]
Add note about IPM.Note.SMIME in mimemaker

* src/mimemaker.cpp (finalize_message): Add a note.

3 months agoAdd new strings for config and keyadder
Andre Heinecke [Mon, 6 May 2019 10:14:20 +0000 (12:14 +0200)]
Add new strings for config and keyadder

* src/addin-options.cpp (I18N_NOOPS): Add new strings.

3 months agoEnsure proto is always set for draft encryption
Andre Heinecke [Thu, 2 May 2019 15:37:37 +0000 (17:37 +0200)]
Ensure proto is always set for draft encryption

* src/cryptcontroller.cpp (CryptController::resolve_keys): Handle
protocol of draft encryption key.

3 months agoDo not start draft encryption while sending
Andre Heinecke [Thu, 2 May 2019 15:36:43 +0000 (17:36 +0200)]
Do not start draft encryption while sending

* src/mailitem-events.cpp (Write): Do not
start draft encryption if encryption is already in


3 months agoUse IPM.Note.SMIME.MultipartSigned again
Andre Heinecke [Thu, 2 May 2019 15:24:38 +0000 (17:24 +0200)]
Use IPM.Note.SMIME.MultipartSigned again

* src/mimemaker.cpp (finalize_message): Use standard form
for S/MIME.

When sending on the same exchange server the mapi properties
and so our message class is kept when sending. So
another (faulty) client without GpgOL might receive this message
with the InfoPathForm MessageClass and might not
handle it as an S/MIME mail.

According to MS-OXOSMIME IPM.Note.SMIME should also be possible
for encrypted mails.
For now we use MultipartSigned again.

3 months agoBump GPGME dependency to 1.13.0
Andre Heinecke [Thu, 2 May 2019 12:03:57 +0000 (14:03 +0200)]
Bump GPGME dependency to 1.13.0

* Bump GPGME dependency.

This was de facto already the case.

3 months agoAdd strings for S/MIME addr book config
Andre Heinecke [Thu, 2 May 2019 12:03:15 +0000 (14:03 +0200)]
Add strings for S/MIME addr book config

* src/addin-options.cpp: Add new strings for the keyadder dialog.

3 months agoBump c++ std to 14
Andre Heinecke [Thu, 2 May 2019 12:00:04 +0000 (14:00 +0200)]
Bump c++ std to 14

* src/ Use -stdc++14

Some useful new features and it should
not hurt.

4 months agoAdd new strings for the config dialog
Andre Heinecke [Fri, 12 Apr 2019 10:10:51 +0000 (12:10 +0200)]
Add new strings for the config dialog

* src/addin-options.cpp (i18n_noops): Add new string.
* po/*: update.

4 months agoPrefer Outlook language over environment
Andre Heinecke [Fri, 12 Apr 2019 10:10:01 +0000 (12:10 +0200)]
Prefer Outlook language over environment

* src/w32-gettext.cpp (_nl_locale_name): Give highest
preference to the Outlook language.

I think this is what users most expect.

4 months agoFix typo in decrypt permanently action
Andre Heinecke [Fri, 12 Apr 2019 10:08:30 +0000 (12:08 +0200)]
Fix typo in decrypt permanently action


4 months agoMake default folder selection account sensitive
Andre Heinecke [Fri, 12 Apr 2019 09:15:32 +0000 (11:15 +0200)]
Make default folder selection account sensitive

* src/oomhelp.cpp (is_mail_in_folder): Use the parent folder
store to check for the default folder.

This fixes the case that only for one account junk and draft
encryption works.

4 months agoDecrypt again after a draft was closed
Andre Heinecke [Fri, 12 Apr 2019 09:13:00 +0000 (11:13 +0200)]
Decrypt again after a draft was closed

* src/mail.cpp (m_decrypt_again, isDecryptAgain, setDecryptAgain):
New state variable.
* src/mail.h: Update accordingly.
* src/mailitem-events.cpp (BeforeRead): Schedule
decrypt if a closed mail was before read again.
(Close): Mark closed drafts for potential decrypt again.
* src/windowmessage.cpp, src/windowmessages.h (DECRYPT): New.

This allows us to detach an inline editor draft, edit it,
close it and continue editing in the inline editor.

4 months agoDon't complain about empty drafts
Andre Heinecke [Fri, 12 Apr 2019 09:11:39 +0000 (11:11 +0200)]
Don't complain about empty drafts

* src/cryptcontroller.cpp (CryptController::collect_data):
Don't complain for drafts.

This is a usual case because autosave can hit if you
only entered recipients and the subject.

4 months agoDon't take base message for drafts
Andre Heinecke [Fri, 12 Apr 2019 09:10:05 +0000 (11:10 +0200)]
Don't take base message for drafts

* src/cryptcontroller.cpp (CryptController::collect_data): Use
message instead of base message.

The base message might have the wrong attachments as this
is a decrypted mail where the MAPI message mirrors the OOM
and the Base Message mirrors what is on the server.

4 months agoAdd safety check for reordered attachments
Andre Heinecke [Fri, 12 Apr 2019 07:46:27 +0000 (09:46 +0200)]
Add safety check for reordered attachments

* src/mapihelp.cpp (mapi_mark_or_create_moss_attach): When
there are two MOSS attachments check for content_type.

Sometimes the attachments are not in the order we expect.
This happened somehow if a draft encrypted by us was opened in
the Web interface.

4 months agoImprove propchange debug output
Andre Heinecke [Fri, 12 Apr 2019 07:45:39 +0000 (09:45 +0200)]
Improve propchange debug output

* src/mailitem-events.cpp (PropertyChange): Log the mail pointer
not the message pointer.

4 months agoFactor out activeInlineResponse in own function
Andre Heinecke [Fri, 12 Apr 2019 07:43:55 +0000 (09:43 +0200)]
Factor out activeInlineResponse in own function

* src/mail.cpp (Mail::isActiveInlineResponse_o): New. checks
if a mail is the inline response.
(Mail::checkSyncCrypto_o): New. Explicitly checks if sync
crypto is needed.
* src/mail.h: Update accordingly.

4 months agoExplicitly note when close is passed for drafs
Andre Heinecke [Thu, 11 Apr 2019 12:45:14 +0000 (14:45 +0200)]
Explicitly note when close is passed for drafs

* src/mailitem-events.cpp (Close): Debug when close
is passed because of draft status.

This allows to determine if a question was intentional or

4 months agoPass crypto mails through write depending on state
Andre Heinecke [Thu, 11 Apr 2019 12:44:06 +0000 (14:44 +0200)]
Pass crypto mails through write depending on state

* src/mailitem-events.cpp (Write): Pass encrypted mails
when the state is Mail::WantsSendMIME.

4 months agoAllow sending of decrypted crypto mails
Andre Heinecke [Thu, 11 Apr 2019 12:43:00 +0000 (14:43 +0200)]
Allow sending of decrypted crypto mails

* src/mailitem-events.cpp (Send): Decrypt mails before
sending if no crypto was requested.

This allows to store a draft encrypted but later send it
without encryption.

4 months agoFix detection of async / sync encryption
Andre Heinecke [Thu, 11 Apr 2019 12:41:47 +0000 (14:41 +0200)]
Fix detection of async / sync encryption

* src/mail.cpp (Mail::prepareEncrypt_o): Move check_inline_response
to the top as this determines the async / sync state.

4 months agoAdd for_encryption parameter to updateOOMData
Andre Heinecke [Thu, 11 Apr 2019 12:39:37 +0000 (14:39 +0200)]
Add for_encryption parameter to updateOOMData

* src/mail.cpp (Mail::updateOOMData_o): Add for_encryption parameter.
(Mail::prepareEncrypt_o): Use it.

Now that we need to send encrypted drafts we can no longer
rely on isCryptoMail to determine if we are reading or writing
a mail.

4 months agoDo not store modified drafts if decrypt failed
Andre Heinecke [Thu, 11 Apr 2019 12:36:12 +0000 (14:36 +0200)]
Do not store modified drafts if decrypt failed

* src/mailitem-events.cpp (BeforeAutoSave, Write): Do
not allow writes if decryption failed.
* src/mail.cpp (decryptedSuccessfully): New helper.

Otherwise we would re-encrypt our error message ;-)

4 months agoAllow property changes for encrypted drafts
Andre Heinecke [Thu, 11 Apr 2019 12:35:04 +0000 (14:35 +0200)]
Allow property changes for encrypted drafts

* src/mailitem-events.cpp (PropertyChange): Pass changes
for drafts.

Drafts can be edited even though they are encrypted.

4 months agoInitial handling for edits on encrypted drafts
Andre Heinecke [Wed, 10 Apr 2019 13:44:46 +0000 (15:44 +0200)]
Initial handling for edits on encrypted drafts

* src/mail.cpp (Mail::updateOOMData_o): Cache body for
drafts, too.
* src/mailitem-events.cpp (Write): Encrypt drafts again on write.
(Close): Let Outlook ask for "want to save changes" for drafts.

This is still extremly buggy. Somehow after the write
in which we prepare the encrypt MAPI is not updated.
So we have to take our information from OOM. That's never

4 months agoFix deadlock on synchronous encrypt
Andre Heinecke [Wed, 10 Apr 2019 13:43:40 +0000 (15:43 +0200)]
Fix deadlock on synchronous encrypt

* src/mail.cpp (do_crypt): Release lock in case sync
encrypt for drafts finished.

4 months agoEnsure draft encrypt state is reset on error
Andre Heinecke [Wed, 10 Apr 2019 13:42:54 +0000 (15:42 +0200)]
Ensure draft encrypt state is reset on error

* src/mail.cpp (do_crypt): On error remove draft encrypt

4 months agoAdd helper function "is_draft_mail"
Andre Heinecke [Wed, 10 Apr 2019 12:42:21 +0000 (14:42 +0200)]
Add helper function "is_draft_mail"

* src/oomhelp.cpp (is_draft_mail): New.
(is_mail_in_folder): New. factored out from is_junk_mail.

4 months agopo: Fix a mislabling in german l10n
Andre Heinecke [Wed, 10 Apr 2019 12:35:51 +0000 (14:35 +0200)]
po: Fix a mislabling in german l10n


4 months agoDo not reset draft info for drafts
Andre Heinecke [Wed, 10 Apr 2019 10:41:26 +0000 (12:41 +0200)]
Do not reset draft info for drafts

* src/cryptcontroller.cpp (CryptController::update_mail_mapi):
Pass isDraftEncrypt to finalize message.
* src/mimemaker.cpp (finalize_message): Do not remove draft info
for drafts.

This commit is a bit confusing because we use "draft info" as
our tracking property for the encrypt/sign actions. Now that
we also work with real drafts this is a bit confusing.

4 months agominor: Add a missing return to improve dbg output
Andre Heinecke [Wed, 10 Apr 2019 07:40:55 +0000 (09:40 +0200)]
minor: Add a missing return to improve dbg output


4 months agoAdd SentOnBehalfOfName to ignored prop changes
Andre Heinecke [Wed, 10 Apr 2019 07:39:59 +0000 (09:39 +0200)]
Add SentOnBehalfOfName to ignored prop changes

* src/mailitem-events.cpp (prop_blacklist): Add SentOnBehalfOfName.

This can change for drafts when they are decrypted.

4 months agoAdd initial draft encryption support
Andre Heinecke [Wed, 10 Apr 2019 07:30:24 +0000 (09:30 +0200)]
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
(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

4 months agoSilence a too verbose trace
Andre Heinecke [Wed, 10 Apr 2019 06:40:50 +0000 (08:40 +0200)]
Silence a too verbose trace

* src/cryptcontroller.cpp (sink_data_write): Do not trace each call.

4 months agoPrint maip error on OpenProperty error
Andre Heinecke [Tue, 9 Apr 2019 12:42:20 +0000 (14:42 +0200)]
Print maip error on OpenProperty error

* src/oomhelp.cpp (gpgol_openProperty): Print out mapi error.

This saves time looking up the error codes manually.

4 months agoAdd MAPI error codes and helpers
Andre Heinecke [Mon, 8 Apr 2019 09:43:12 +0000 (11:43 +0200)]
Add MAPI error codes and helpers

* src/mapierr.cpp, src/mapierr.h: New.
* src/mymapi.h: Include it.
* src/ Add it to sources.

4 months agoFix crash when looking at messages without attachs
Andre Heinecke [Wed, 27 Mar 2019 11:53:10 +0000 (12:53 +0100)]
Fix crash when looking at messages without attachs

* src/mapihelp.cpp (mapi_get_first_attach_data): Do not crash
if message has no attachments.

4 months agoFix content-type detection for headerless mails
Andre Heinecke [Wed, 27 Mar 2019 09:53:42 +0000 (10:53 +0100)]
Fix content-type detection for headerless mails

* src/mapihelp.cpp (mapi_get_message_content_type):
Check first attachment if mail has no headers.

Yep that happens. I could reproduce it by looking at
sent mails in a local data file. This is very likely
the cause for:

GnuPG-Bug-Id: T3935

4 months agoReplace fancy attribute by comment
Andre Heinecke [Tue, 26 Mar 2019 18:46:57 +0000 (19:46 +0100)]
Replace fancy attribute by comment

* src/mailitem-events.cpp: Change attribute fallthrough to magic

This fixed build with older gcc versions....

4 months agoPost release version bump
Andre Heinecke [Tue, 26 Mar 2019 13:00:53 +0000 (14:00 +0100)]
Post release version bump


4 months agoFix distcheck gpgol-2.3.3
Andre Heinecke [Tue, 26 Mar 2019 12:56:58 +0000 (13:56 +0100)]
Fix distcheck

* tests/ Check for TESTS should have been inverted.

4 months agoAuto update po files
Andre Heinecke [Tue, 26 Mar 2019 12:13:57 +0000 (13:13 +0100)]
Auto update po files


4 months agoUpdate NEWS for todays release
Andre Heinecke [Tue, 26 Mar 2019 12:12:31 +0000 (13:12 +0100)]
Update NEWS for todays release


4 months agoFix / improve decrypting sent exchange mails again
Andre Heinecke [Tue, 26 Mar 2019 08:48:23 +0000 (09:48 +0100)]
Fix / improve decrypting sent exchange mails again

* src/mail.cpp (Mail::preProcessMessage_m): Also pass the
* src/mapihelp.cpp (hide_attachment_mapipos): New helper.
(mapi_mark_or_create_moss_attach): Take parsed msg as
additional parameter. Improve MOSSTMPL handling.

If we have a mosstempl. This means that we created
this message. Sometimes we get the situation in
sent mails that we have a mosstempl but the
pgp version header and octet streams also
attached in the parsed_message. We can't
trigger a reread from the base message so
in that case we want to hide everything
as we rebuild the message from our MOSS.

We don't delete here to avoid bugs where data loss
might occur.

GnuPG-Bug-Id: T4241

4 months agoEnsure that decrypt again uses preprocessing
Andre Heinecke [Tue, 26 Mar 2019 08:18:23 +0000 (09:18 +0100)]
Ensure that decrypt again uses preprocessing

* src/windowmessages.cpp (EXT_API_DECRYPT): call
pre process message.

This ensures that our usual preprocessing is done
when decrypting again.

GnuPG-Bug-Id: T4241