17 hours agoAccept keys out of WKD as usable for encryption master
Andre Heinecke [Thu, 19 Apr 2018 12:48:28 +0000 (14:48 +0200)]
Accept keys out of WKD as usable for encryption

* src/keycache.cpp (KeyCache::getEncryptionKeys): Accept
keys with Original WKD.

We are trying to determine here if "automatic" certificate
selection is Ok. When we have a key from WKD we find
that Ok.

17 hours agoFix launch cert details on signature error
Andre Heinecke [Thu, 19 Apr 2018 12:47:17 +0000 (14:47 +0200)]
Fix launch cert details on signature error

* src/mail.cpp, src/mail.h (get_verification_result_dump): New.
* src/ribbon-callbacks.cpp (launch_cert_details): Handle the
case that we don't have a sig fingerprint.

17 hours agoAdd quick print context menu entry
Andre Heinecke [Thu, 19 Apr 2018 12:36:39 +0000 (14:36 +0200)]
Add quick print context menu entry

* src/gpgoladdin.cpp: Extend ribbon UI and callbacks.
* src/ribbon-callbacks.cpp (print_decrypted, get_is_crypto_mail):

As the Quick Print and File -> Print do not work if mails
are only viewed in the Explorer this is a shortcut to
avoid that users have to explicitly open the mail before

GnuPG-Bug-Id: T3762

19 hours agoDon't write OpenPGP Encrypted Message for sig only
Andre Heinecke [Thu, 19 Apr 2018 11:19:38 +0000 (13:19 +0200)]
Don't write OpenPGP Encrypted Message for sig only

* src/mail.cpp (Mail::decrypt_verify): Write only
that it is an OpenPGP or S/MIME message and not that
its encrypted even if its only signed.

7 days agoPost release version bump
Andre Heinecke [Thu, 12 Apr 2018 11:15:12 +0000 (13:15 +0200)]
Post release version bump

7 days agoUpdate NEWS for todays release gpgol-2.1.0
Andre Heinecke [Thu, 12 Apr 2018 11:00:52 +0000 (13:00 +0200)]
Update NEWS for todays release


7 days agoUpdate german l10n
Andre Heinecke [Thu, 12 Apr 2018 11:00:17 +0000 (13:00 +0200)]
Update german l10n

* po/de.po: Translate.

7 days agoAuto update po files
Andre Heinecke [Thu, 12 Apr 2018 10:58:10 +0000 (12:58 +0200)]
Auto update po files


7 days agoHide attachment removal warning on revert
Andre Heinecke [Thu, 12 Apr 2018 10:49:35 +0000 (12:49 +0200)]
Hide attachment removal warning on revert

* src/mail.cpp (attachment_remove_warning_disabled): New.
(Mail::revert): Disable attachment warning.
* src/mailitem-events.cpp: Check if warnings are disabled.

On revert this would otherwise show the newly introduced

7 days agoIgnore InternetCodepage changes
Andre Heinecke [Thu, 12 Apr 2018 10:49:08 +0000 (12:49 +0200)]
Ignore InternetCodepage changes

* src/mailitem-events.cpp: Ignore internetcodepage changes.

8 days agoShow warning if attachment of crypt mail removed
Andre Heinecke [Wed, 11 Apr 2018 14:14:44 +0000 (16:14 +0200)]
Show warning if attachment of crypt mail removed

* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Handle
AttachmentRemove event and show warning if an attachment
is removed from a crypto mail.

GnuPG-Bug-Id: T3886

8 days agoIgnore received time propchange
Andre Heinecke [Wed, 11 Apr 2018 14:14:16 +0000 (16:14 +0200)]
Ignore received time propchange

* src/mailitem-events.cpp (prop_blacklist): Add
ReceivedTime to blacklist.

8 days agoFix early deletion of temporary attachments
Andre Heinecke [Wed, 11 Apr 2018 14:12:49 +0000 (16:12 +0200)]
Fix early deletion of temporary attachments

* src/mail.cpp (add_attachments): Close handle before

This fixes the problem that as long as Outlook is open
the temporary files stick around and are not removed.
Which in turn leads to numbers added to the attachments.

GnuPG-Bug-Id: T3886

8 days agoFix spelling in german propchange warning
Andre Heinecke [Wed, 11 Apr 2018 14:11:31 +0000 (16:11 +0200)]
Fix spelling in german propchange warning

* po/de.po: Fix german propchange warning.

GnuPG-Bug-Id: T3884

8 days agoImplement send again for crypto mails
Andre Heinecke [Wed, 11 Apr 2018 13:22:05 +0000 (15:22 +0200)]
Implement send again for crypto mails

* src/mail.cpp (Mail::set_is_send_again): New.
(Mail::parsing_done): Add handling for send again.
* src/mailitem-events.cpp: Detect a send again.

This detects the send again by the propchange of SendUsingAccount
and a "sent" value of false. Usually crypto mails have a sent
value of true.

In this case we remove our attachments (so that they are not
included in the sent again), set the draft info so that the
crypto state is nicely preselected and finally change the
type so that is_crypo_mail returns false for decrypted
send again mails.

GnuPG-Bug-Id: T3885

8 days agoChange S/MIME behavior depending on Exchange ver.
Andre Heinecke [Wed, 11 Apr 2018 11:15:09 +0000 (13:15 +0200)]
Change S/MIME behavior depending on Exchange ver.

* src/oomhelp.cpp, src/oomhelp.h (get_ex_major_version_for_addr): New.
* src/cryptcontroller.cpp (create_encrypt_attach): Accept
exchange version as parameter. Change behavior accordingly.
(CryptController::update_mail_mapi): Add handling for exchange ver.
* src/mimemaker.cpp (create_top_encryption_header): Accept
exchange ver.
* src/mimemaker.h: Update accordingly.

This fixes 7cb3feaf which broke S/MIME encrypted send for
older exchange versions and SMTP / IMAP. Because it unconditionally
used different code to construct the encrypted message in the
expectation that this would also work as an alternative.

GnuPG-Bug-Id: T3884

8 days agoHandle weirdly constructed PGP/MIME mails
Andre Heinecke [Wed, 11 Apr 2018 08:13:33 +0000 (10:13 +0200)]
Handle weirdly constructed PGP/MIME mails

* src/mapihelp.cpp (get_msgcls_from_pgp_lines): Add return
value for empty body.
(get_msgcls_from_first_attachment): New. factored out.
(change_message_class_ipm_note): Use get_msgcls_from_first_attachment.

This fixes the handling of mails that are:


They also don't have a body. To avoid overhead in a
normal unencrypted multipart mixed mail we only check
for this structure if we don't have a body.

GnuPG-Bug-Id: T3882

9 days agoMake S/MIME compatible with Exchange 2016 patched
Andre Heinecke [Tue, 10 Apr 2018 13:49:21 +0000 (15:49 +0200)]
Make S/MIME compatible with Exchange 2016 patched

* src/oomhelp.h (PR_PIDNameContentType_DASL): New.
* src/mimemaker.cpp (create_top_encryption_header): We no longer
create the header ourself.
* src/mail.cpp (Mail::update_crypt_oom): Here we set the header
values now.
* src/cryptcontroller.h (CryptController::get_protocol)
(CryptController::is_encrypter): New accessors.
* src/cryptcontroller.cpp (create_encrypt_attach): Write binary
data for S/MIME. Outlook will do the base64 conversion.

This fixes a lot of interop issues. Otherwise we would
either have weirdly structured mails or mails without smime-type
header or mails where the pkcs7-mime part was doubly base64
encoded with the inner encoding containing the headers.

Hope this works with older Exchanges and Outlooks.

GnuPG-Bug-Id: T3884

9 days agoImprove acceptance of the parser
Andre Heinecke [Tue, 10 Apr 2018 13:48:08 +0000 (15:48 +0200)]
Improve acceptance of the parser

* src/mimedataprovider.cpp (MimeDataProvider::collect_data): Relax.
If a message starts with Content-Type it's probably a mime structure.

9 days agoHandle error in mapi update
Andre Heinecke [Tue, 10 Apr 2018 11:14:42 +0000 (13:14 +0200)]
Handle error in mapi update

* src/mail.cpp (do_crypt): Handle error in mapi update.

9 days agoSleep a bit before bringing window to front
Andre Heinecke [Tue, 10 Apr 2018 11:12:35 +0000 (13:12 +0200)]
Sleep a bit before bringing window to front

* src/common.c (bring_to_front): log when done.
* src/windowmessages.cpp (gpgol_window_proc): Sleep a bit
before bring to front.

This might resolve an observed deadlock where setforegroundwindow
would block the UI thread as it tried to bring the disabled
mail window to front. Might also help with:

GnuPG-Bug-Id: T3889

2 weeks agoFix encrypt to self if keycache is used
Andre Heinecke [Thu, 5 Apr 2018 12:05:13 +0000 (14:05 +0200)]
Fix encrypt to self if keycache is used

* src/cryptcontroller.cpp (CryptController::resolve_keys_cached):
Add sender to recipients if encrypt is selected.
* src/keycache.cpp, src/keycache.h (KeyCache::getEncryptionKeys):
Use a vector of strings instead of carray.


2 weeks agoAdd helper to convert carray to vector
Andre Heinecke [Thu, 5 Apr 2018 12:04:38 +0000 (14:04 +0200)]
Add helper to convert carray to vector

* src/cpphelp.cpp, src/cpphelp.h (cArray_to_vector): New.

2 weeks agoRevert "Jump the event queue"
Andre Heinecke [Thu, 5 Apr 2018 10:01:18 +0000 (12:01 +0200)]
Revert "Jump the event queue"

This reverts commit a6bf8ef284d98f87a9e64ce326e2a0a55633213c.

Did not work as intended

2 weeks agoMore saveguards and logging in get_ultimate_keys
Andre Heinecke [Thu, 5 Apr 2018 09:29:02 +0000 (11:29 +0200)]
More saveguards and logging in get_ultimate_keys

* src/parsecontroller.cpp (ParseController::get_ultimate_keys):
Add more debug output and saveguards.

From the logs in a bugreport it looks very much like we
crash somewhere in between starting the keylisting and
finishing it.

Checking for invalid key or if a uid has an id makes
sense, but might not be the crash.

GnuPG-Bug-Id: T3857

2 weeks agoDisable oom body check for MIME mails
Andre Heinecke [Thu, 5 Apr 2018 08:57:39 +0000 (10:57 +0200)]
Disable oom body check for MIME mails

* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Disable
safety checks.

The safety check added for T3863 triggered too often.
Even if a Body is found in OOM when we send MIME that
should not be a problem as the MIME conversion will
wkill the body.

GnuPG-Bug-Id: T3863
GnuPG-Bug-Id: T3875

2 weeks agoLog body if body was found after crypto
Andre Heinecke [Thu, 5 Apr 2018 08:56:29 +0000 (10:56 +0200)]
Log body if body was found after crypto

* src/mail.cpp (has_crypt_or_empty_body_oom): Log body in
very verbose logging mode.

Might help to figure out what goes wrong in:
GnuPG-Bug-Id: T3875

2 weeks agoAlso clear plain body in wipe
Andre Heinecke [Thu, 5 Apr 2018 08:55:43 +0000 (10:55 +0200)]
Also clear plain body in wipe

* src/mail.cpp (Mail::wipe): Clear body even if clearing
the HTML Body succeeds.

Might help with:
GnuPG-Bug-Id: T3875

2 weeks agoProperly handle crypt cancel for inline mails
Andre Heinecke [Thu, 5 Apr 2018 06:44:44 +0000 (08:44 +0200)]
Properly handle crypt cancel for inline mails

* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Handle error
or canceled crypt for inline mails.

Canceling recipients would otherwise show a bug message.

GnuPG-Bug-Id: T3864

2 weeks agoDon't access listed key on error
Andre Heinecke [Thu, 5 Apr 2018 06:39:40 +0000 (08:39 +0200)]
Don't access listed key on error

* src/parsecontroller.cpp (ParseController::get_ultimate_keys):
Don't access key data member on error.

A bit cleaner in case key is somehow invalid.

3 weeks agoFix S/MIME encryption with latest Exchange 2016
Andre Heinecke [Wed, 28 Mar 2018 09:12:10 +0000 (11:12 +0200)]
Fix S/MIME encryption with latest Exchange 2016

* src/cryptcontroller.cpp (CryptController::update_mail_mapi):
Set overrideMimeTag to application/pkcs7-mime for smime enc.
* src/mimemaker.cpp (create_mapi_attachmend): Add overrideMimeTag
(create_top_encryption_header): Rearrange header for S/MIME enc.

Comparing outlooks own S/MIME mails with GpgOL mails lead to this.
Tests show that this way the mails do pass the exchange
server. With only slight variations we get errors.

GnuPG-Bug-Id: T3853

3 weeks agos/is_inline_response/async_crypt_disabled/
Andre Heinecke [Mon, 26 Mar 2018 15:41:39 +0000 (17:41 +0200)]

This should make it more clear and avoid a PGP/Inline <> Inline
Editor misunderstanding.

3 weeks agos/should_inline_crypt/do_pgp_inline/
Andre Heinecke [Mon, 26 Mar 2018 15:39:51 +0000 (17:39 +0200)]

Make it more clear.

3 weeks agoFix sending PGP/Inline synchronously
Andre Heinecke [Mon, 26 Mar 2018 15:35:16 +0000 (17:35 +0200)]
Fix sending PGP/Inline synchronously

* src/common.h: Add error code.
* src/mail.cpp (Mail::update_crypt_mapi): Don't reset crypter
if in sync mode.
(Mail::update_crypt_oom): Reset crypter in sync mode.
* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Check that
states for inline mail are as expected or bug out.

For synchonous inline encrypted the cryptcontroller was
deleted too early. This caused body_to_body to fail and
ultimately lead to an unencrypted mail.

This fixes:
GnuPG-Bug-Id: T3863

3 weeks agoAdd bug error if body_to_body failed
Andre Heinecke [Mon, 26 Mar 2018 15:16:40 +0000 (17:16 +0200)]
Add bug error if body_to_body failed

* src/mail.cpp (Mail::update_crypt_oom): Check for and
handle error in inline_body_to_body.

GnuPG-Bug-Id: T3863

3 weeks agoAdd safety check to prevent unencrypted send
Andre Heinecke [Mon, 26 Mar 2018 14:57:20 +0000 (16:57 +0200)]
Add safety check to prevent unencrypted send

* src/mail.cpp (Mail::has_crypted_or_empty_body): New.
(Mail::update_crypt_oom): Use it.
(has_crypt_or_empty_body_oom): New helper.
* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Check if
body is empty or a crypt message before passing send on
a crypto mail.

GnuPG-Bug-Id: T3863

The idea is to check as a last ditch if before sending
a mail that "should" be encrypted if it has either
an empty body or a PGP/Inline body.
This won't help of course for empty mails with attachments
but should work in most cases.

The codepath is never hit intentional so the error
message points to a bug. It's just an additional

3 weeks agoCheck for error on encrypt_sign_start
Andre Heinecke [Mon, 26 Mar 2018 14:56:28 +0000 (16:56 +0200)]
Check for error on encrypt_sign_start

* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Check error
of encrypt_sign_start.

3 weeks agoHandle encrypt / sign on empty message
Andre Heinecke [Mon, 26 Mar 2018 14:55:35 +0000 (16:55 +0200)]
Handle encrypt / sign on empty message

* src/cryptcontroller.cpp (CryptController::collect_data):
Handle empty message.

3 weeks agoAbort if mail has no body and no attachments
Andre Heinecke [Mon, 26 Mar 2018 14:41:00 +0000 (16:41 +0200)]
Abort if mail has no body and no attachments

* src/cryptcontroller.cpp (CryptController::collect_data):
Abort if no body and no attachments.

3 weeks agoAdd gpgol_bug helper function
Andre Heinecke [Mon, 26 Mar 2018 14:13:36 +0000 (16:13 +0200)]
Add gpgol_bug helper function

* src/common.c, src/common.h (gpgol_bug): New.
* src/mail.cpp (do_crypt): Use it.

This is a little helper to reuse the same message if we
think a user visible error / bug should be done.

3 weeks agoDocument how encryption is done in do_crypt
Andre Heinecke [Mon, 26 Mar 2018 14:12:40 +0000 (16:12 +0200)]
Document how encryption is done in do_crypt

* src/mail.cpp (do_crypt): Add explaining comment about the

3 weeks agoDon't carry around inline crypt state twice
Andre Heinecke [Mon, 26 Mar 2018 06:47:57 +0000 (08:47 +0200)]
Don't carry around inline crypt state twice

* src/cryptcontroller.cpp, src/cryptcontroller.h: Replace
m_inline member variable with access to Mail::should_inline_crypt.
* src/mail.h: Add set_should_inline_crypt.
* src/mail.cpp: Update callers.

Having two inline states adds complexity and might lead to
wrong results. E.g. Mail::should_inline_crypt would not change
when the cryptcontroller detected attachments.

GnuPG-Bug-Id: T3863

3 weeks agoSpellcheck german localisation
Andre Heinecke [Fri, 23 Mar 2018 13:37:22 +0000 (14:37 +0100)]
Spellcheck german localisation

* po/de.po: Spellcheck.

GnuPG-Bug-Id: T3859

4 weeks agoFix w64 build
Andre Heinecke [Wed, 21 Mar 2018 12:55:13 +0000 (13:55 +0100)]
Fix w64 build

* src/ribbon-callbacks.cpp (launch_cert_details): Cast HWND w64

4 weeks agoAuto update translations
Andre Heinecke [Wed, 21 Mar 2018 12:03:02 +0000 (13:03 +0100)]
Auto update translations

* po/*: update.

4 weeks agoAdd proper spawn flags to kleopatra initial start
Andre Heinecke [Tue, 20 Mar 2018 08:14:28 +0000 (09:14 +0100)]
Add proper spawn flags to kleopatra initial start

* src/ribbon-callbacks.cpp (launch_cert_details): Add spawn
flags to fix initial show.

This allows the initial start to show a window / foreground
window and fixes a bug that the initial cert details was
not shown.

GnuPG-Bug-Id: T3845

4 weeks agoProvide parent wid for certificate details
Andre Heinecke [Tue, 20 Mar 2018 07:43:45 +0000 (08:43 +0100)]
Provide parent wid for certificate details

* src/ribbon-callbacks.cpp (launch_cert_details): Add

This helps Kleopatra not to open the certificate details
in the background.

GnuPG-Bug-Id: T3845

5 weeks agoJump the event queue
Andre Heinecke [Thu, 15 Mar 2018 14:03:04 +0000 (15:03 +0100)]
Jump the event queue

* src/olflange.h (ProgID): We are now Z.GNU.GpgOL

According to hearsay events are handled in reverse
alphabetical order. Let's try this to see if it results
in fewer problems with other addins.

The ProgId is not user visible anywhere.

GnuPG-Bug-Id: T3769

5 weeks agoFix unencrypted forward of crypto mail
Andre Heinecke [Thu, 15 Mar 2018 08:27:24 +0000 (09:27 +0100)]
Fix unencrypted forward of crypto mail

* src/mail.cpp (Mail::Mail): Add new marker for forwarded
crypto mails.
(Mail::remove_our_attachments): New. Removes gpgol attachments.
(Mail::set_is_forwarded_crypto_mail, Mail::is_forwarded_crypto_mail):
New accessors to marker.
* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Set marker on
forward. Handle marker on write.

GnuPG-Bug-Id: T3836

5 weeks agoAvoid double gpgme_data_identify
Andre Heinecke [Thu, 15 Mar 2018 07:26:46 +0000 (08:26 +0100)]
Avoid double gpgme_data_identify

* src/parsecontroller.cpp (ParseController::parse): Store first
identify value and reuse it.

5 weeks agoDisable async crypto for now
Andre Heinecke [Wed, 14 Mar 2018 14:24:45 +0000 (15:24 +0100)]
Disable async crypto for now

* src/mail.cpp (Mail::is_inline_response): Treat every mail
as inline response exept when DO_ASYNC_CRYPTO is defined.

So sad :'-(
I really hope I find a way in the future to make it work.

GnuPG-Bug-Id: T3838

5 weeks agoRemove error handling for failure to resolve
Andre Heinecke [Wed, 14 Mar 2018 13:11:18 +0000 (14:11 +0100)]
Remove error handling for failure to resolve

* src/cryptcontroller.cpp (CryptController::do_crypto):
Remove an error handling.

This should never happen except when a bug occurs. And
handling it here would result in the overlay not beeing
properly destroyed.

5 weeks agoAdd small safety check in ribbon callback
Andre Heinecke [Wed, 14 Mar 2018 13:09:34 +0000 (14:09 +0100)]
Add small safety check in ribbon callback

* src/ribbon-callbacks.cpp (get_is_details_enabled): Add
safety check.

I doubt that it is necessary but I've seen logs where this
function is the last before a crash. So just be sure.

5 weeks agoFurther extend debugging around mail dtor
Andre Heinecke [Wed, 14 Mar 2018 10:16:03 +0000 (11:16 +0100)]
Further extend debugging around mail dtor

* src/mail.cpp (do_crypt): Note when ui thread is done.
* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Log when deletion
is done in unload.
* src/windowmessages.cpp (gpgol_window_proc): Log when crypto
done handler is complete.
(do_async): Log invocation.

5 weeks agoImplement forwarding crypto mails with attachments
Andre Heinecke [Tue, 13 Mar 2018 15:41:45 +0000 (16:41 +0100)]
Implement forwarding crypto mails with attachments

* src/application-events.cpp (EVENT_SINK_INVOKE): Invalidate last
mail in the next UI Loop.
* src/mail.cpp (Mail::update_body): Safety check for parser. Keep
parser around.
(Mail::invalidate_last_mail): New. Clear cached last mail ptr.
* src/mail.h: Update accordingly.
* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Extend write
event to detect forward of mails with attachments.
* src/oomhelp.cpp (get_inline_body): New.
* src/oomhelp.h: Update accordingly.
* src/windowmessages.cpp, src/windowmessages.h
* src/wks-helper.cpp (WKSHelper::send_mail): Check if last
mail was invalidated.

This is a first working draft of forwarding crypto mails
with attachments. As we don't see the forward event before
we get the write event (that we have to cancel usually) we
now have some extra magic to detect the forward based on
an ItemLoad of an empty mail in the same UI loop as the
write event. This is pretty magic but it works.

Once we detect the forward we save the mail and then immediately
revert it and save it again. This has the usual uglyness of
reverting (sync) but works and allows to forward mails.

GnuPG-Bug-Id: T3836

5 weeks agoImprove error handling on enc/sign errors
Andre Heinecke [Tue, 13 Mar 2018 15:38:54 +0000 (16:38 +0100)]
Improve error handling on enc/sign errors

* src/cryptcontroller.cpp (CryptController::do_crypto):
Improve error handling.
* src/mail.cpp (do_crypt): Use correct window and hide overlay /
destroy crypter before showing the error. Add better text for
general "Crypto failed" error.

5 weeks agoTurn up debugging at the end of crypto
Andre Heinecke [Mon, 12 Mar 2018 14:02:25 +0000 (15:02 +0100)]
Turn up debugging at the end of crypto

* src/mail.cpp (Mail::~Mail): Very verbose logging in oom_extra.
(Mail::~Mail): Use release_cArray. Explicitly null shared ptrs.
(do_crypt): Log when done.
(Mail::update_oom_data): Use release_cArray.

GnuPG-Bug-Id: T3617

5 weeks agoUpdate portuguese translation
Andre Heinecke [Mon, 12 Mar 2018 14:01:07 +0000 (15:01 +0100)]
Update portuguese translation

* po/pt.po: Update.

Translation provided by Marco A.G. Pinto. Thanks.

6 weeks agoBump Version to 2.1.0 and update NEWS
Andre Heinecke [Wed, 7 Mar 2018 12:36:07 +0000 (13:36 +0100)]
Bump Version to 2.1.0 and update NEWS


6 weeks agoFix protocol selection for autoresolve
Andre Heinecke [Wed, 7 Mar 2018 12:33:01 +0000 (13:33 +0100)]
Fix protocol selection for autoresolve

* src/cryptcontroller.cpp (CryptController::resolve_keys_cached):
Handle Protocol.

6 weeks agoImprove error handling and fix encoding
Andre Heinecke [Wed, 7 Mar 2018 12:31:54 +0000 (13:31 +0100)]
Improve error handling and fix encoding

* src/cryptcontroller.cpp: Take care that command line
args are not encoded to utf8.
* src/mail.cpp (do_crypt): Inform user when crypto failed.

6 weeks agoFix deadlock in Outlook 2010
Andre Heinecke [Wed, 7 Mar 2018 12:30:14 +0000 (13:30 +0100)]
Fix deadlock in Outlook 2010

* src/mail.cpp (do_crypt): In Outlook 2010 sending destroys
the Mail. So we may not hold the dtor lock for the send call.

6 weeks agoUpdate translations and fix some german strings
Andre Heinecke [Wed, 7 Mar 2018 09:01:38 +0000 (10:01 +0100)]
Update translations and fix some german strings

* po: Update.

6 weeks agoProvide protocol argument to resolver
Andre Heinecke [Wed, 7 Mar 2018 09:00:44 +0000 (10:00 +0100)]
Provide protocol argument to resolver

* src/cryptcontroller.cpp (CryptController::resolve_recipients):
Use Protocol parameter if S/MIME is disabled.

6 weeks agoAdd cryptcontroller to Potfiles
Andre Heinecke [Wed, 7 Mar 2018 07:59:23 +0000 (08:59 +0100)]
Add cryptcontroller to Potfiles

* po/ Add cryptcontroller.

6 weeks agoAuto update translations
Andre Heinecke [Wed, 7 Mar 2018 07:24:31 +0000 (08:24 +0100)]
Auto update translations

* po/: update.

6 weeks agoAllow Inline for signed & encrypted with GSuite
Andre Heinecke [Wed, 7 Mar 2018 07:21:36 +0000 (08:21 +0100)]
Allow Inline for signed & encrypted with GSuite

* src/mail.cpp (Mail::encrypt_sign_start): Relax GSuite checks.
We now support clearsigned and signed & encrypted inline mails
thanks to the new crypto architecture.

GnuPG-Bug-Id: T3545

6 weeks agoPrefer Sender over SendUsingAccount for crypt mail
Andre Heinecke [Tue, 6 Mar 2018 14:11:26 +0000 (15:11 +0100)]
Prefer Sender over SendUsingAccount for crypt mail

* src/mail.cpp (Mail::update_oom_data): Prefer the
Sender fallbacks before using sendUsingAccount for crypto mail

GnuPG-Bug-Id: T3802

6 weeks agoFactor sender fallbacks into seperate functs
Andre Heinecke [Tue, 6 Mar 2018 14:02:41 +0000 (15:02 +0100)]
Factor sender fallbacks into seperate functs

* src/mail.cpp (Mail::update_oom_data): Move out sender fallbacks.
* src/oomhelp.cpp, src/oomhelp.h (get_sender_CurrentUser),
(get_sender_Sender, get_sender_SenderEMailAddress)
(get_sender_SendUsingAccount): New.

This should not do a functional change.

6 weeks agoBring Outlook back into focus after enc/sign
Andre Heinecke [Tue, 6 Mar 2018 08:51:38 +0000 (09:51 +0100)]
Bring Outlook back into focus after enc/sign

* src/mail.cpp (do_crypt): Send BRING_TO_FRONT message
after encryption.
* src/windowmessages.cpp, src/windowmessages.h: New call
to bring the active outlook window to front.

As explained in the comment this is a workaround for strange
behavior with pinentry and foreground windows. After encrypt/sign
often times the wrong window has focus. So we better bring
Outlook to front.

GnuPG-Bug-Id: T3732

6 weeks agoAdd new Window Message helper
Andre Heinecke [Tue, 6 Mar 2018 08:50:52 +0000 (09:50 +0100)]
Add new Window Message helper

* src/windowmessages.cpp (do_async, do_in_ui_thread_async):
Add new fire and forget window messaging helper.
* src/windowmessages.h: Update accordingly.

6 weeks agoBe more lenient with broken PGP Inline messages
Andre Heinecke [Tue, 6 Mar 2018 08:02:20 +0000 (09:02 +0100)]
Be more lenient with broken PGP Inline messages

* src/mimedataprovider.cpp (MimeDataProvider::collect_data):
Fix up PGP Messages.

In the Outlook world sometimes messages are rewritten / converted
to HTML and then converted back to Plaintext etc.
This can lead to broken PGP Messages where there is extra
whitespace. We now fix up the whitespace and remove comments
in the Mimedataprovider in the spirit of trying to accept
as much input as possible.

GnuPG-Bug-Id: T3821

6 weeks agoAdd trim and ltrim to cpphelp
Andre Heinecke [Tue, 6 Mar 2018 08:01:33 +0000 (09:01 +0100)]
Add trim and ltrim to cpphelp

* src/cpphelp.cpp (ltrim, trim): New.
* src/cpphelp.h: Update accordingly.

6 weeks agoAuto update translation
Andre Heinecke [Tue, 6 Mar 2018 07:36:53 +0000 (08:36 +0100)]
Auto update translation

* po/de.po: Msgmerge moves the newline.

6 weeks agoFix w64 build
Andre Heinecke [Tue, 6 Mar 2018 06:41:05 +0000 (07:41 +0100)]
Fix w64 build

* src/cryptcontroller.cpp (CryptController::resolve_keys): Use
SIZE_T_FORMAT and hwnd conversion.
* src/overlay.cpp (Overlay::Overlay): HWND cast to int is ok.

6 weeks agoUpdate german translation
Andre Heinecke [Mon, 5 Mar 2018 13:43:10 +0000 (14:43 +0100)]
Update german translation

* po/de.po: Update german translation.

6 weeks agoAuto update po files
Andre Heinecke [Mon, 5 Mar 2018 13:36:19 +0000 (14:36 +0100)]
Auto update po files

* po: Update.

6 weeks agoAdd new files to
Andre Heinecke [Mon, 5 Mar 2018 13:35:55 +0000 (14:35 +0100)]
Add new files to

* po/ Add new files.

6 weeks agoUpdate german localisation
Andre Heinecke [Mon, 5 Mar 2018 13:33:46 +0000 (14:33 +0100)]
Update german localisation

* po/de.po: Update

6 weeks agoAuto update po files
Andre Heinecke [Mon, 5 Mar 2018 13:28:56 +0000 (14:28 +0100)]
Auto update po files

* po: Update.

6 weeks agoRelabel autoresolve option to reflect new functs async-enc
Andre Heinecke [Mon, 5 Mar 2018 13:26:46 +0000 (14:26 +0100)]
Relabel autoresolve option to reflect new functs

* src/addin-options.cpp (IDC_AUTORRESOLVE): Relabel autoresolve.
It's now also working for S/MIME and does more then just
locate keys.

6 weeks agoImplement Load / Save for WKS States
Andre Heinecke [Mon, 5 Mar 2018 10:46:11 +0000 (11:46 +0100)]
Implement Load / Save for WKS States

* src/wks-helper.cpp (WKSHelper::load, WKSHelper::save): Implement.
(WKSHelper::check_published): New.
(do_check): Also check for published.
(WKSHelper::update_last_checked): New.
(WKSHelper::start_check): Handle saved states.

6 weeks agoAdd helpers to store string map in registry
Andre Heinecke [Mon, 5 Mar 2018 10:45:51 +0000 (11:45 +0100)]
Add helpers to store string map in registry

* src/common.c (store_extension_subkey_value): New.
(GPGOL_REGPATH): Move into header.
* src/common.h: Expose store_extension_subkey_value.
* src/cpphelp.cpp (get_registry_subkeys): New.
(gpgol_split): New Helper.
* src/cpphelp.h: Update accordingly.

6 weeks agoMove registry helper code into common
Andre Heinecke [Fri, 2 Mar 2018 13:32:08 +0000 (14:32 +0100)]
Move registry helper code into common

* src/common.c (load_extension_value, store_extension_value),
(store_config_value, load_config_value, expand_path): Moved
from config-dialog.c
* src/config-dialog.c: Remove moved functions.

7 weeks agoUse keycache to autoresolve
Andre Heinecke [Thu, 1 Mar 2018 15:16:09 +0000 (16:16 +0100)]
Use keycache to autoresolve

* lots of changes.

The keycache is now used if opt.autoresolve is set to resolve
the signing / encryption keys without loading the resolver binary.

7 weeks agoBring mail to front after encryption
Andre Heinecke [Thu, 1 Mar 2018 15:10:22 +0000 (16:10 +0100)]
Bring mail to front after encryption

* src/overlay.cpp (Overlay::~Overlay): Bring old window to front.

Pinentry brings the wrong window to front. This mitigates that a

7 weeks agoMinor wait cleanup in overlay
Andre Heinecke [Thu, 1 Mar 2018 12:46:50 +0000 (13:46 +0100)]
Minor wait cleanup in overlay

* src/overlay.cpp (Overlay::~Overlay): Wait afteer writing
the quit.

7 weeks agoLocalize keyresolver
Andre Heinecke [Thu, 1 Mar 2018 12:46:13 +0000 (13:46 +0100)]
Localize keyresolver

* src/cryptcontroller.cpp (CryptController::resolve_keys):
Add --lang argument.

7 weeks agoAdd keycache for located keys
Andre Heinecke [Thu, 1 Mar 2018 12:39:06 +0000 (13:39 +0100)]
Add keycache for located keys

* src/keycache.cpp, src/keycache.h: New.
* src/ Add new files.
* src/mail.cpp (in_de_vs_mode): Move to cpphelp.
Rename global maps to s_ prefix to be more clear.
(Mail::locate_keys): Use keycache.
(do_locate): Removed.
(Mail::locate_all_crypto_recipents): New.
* src/cpphelp.cpp: Add in_de_vs_mode.
* src/ribbon-callbacks.cpp (mark_mime_action): Trigger
locate on crypto toggle.

Every serious MUA needs a Keycache ;-)

This is needed to store the keys returned by
gpg --locate-keys if we want to use them later to automatically
send to the keys located this way.

7 weeks agoFix surprising toggle behavior
Andre Heinecke [Thu, 1 Mar 2018 12:37:38 +0000 (13:37 +0100)]
Fix surprising toggle behavior

* src/ribbon-callbacks.cpp (mark_mime_action): If a sub action
was active click on secure activates both sign and encrypt.

7 weeks agoMerge branch 'master' into async-enc
Andre Heinecke [Tue, 27 Feb 2018 06:50:01 +0000 (07:50 +0100)]
Merge branch 'master' into async-enc

7 weeks agoCheck first for view before accessing selection
Andre Heinecke [Tue, 27 Feb 2018 06:06:32 +0000 (07:06 +0100)]
Check first for view before accessing selection

* src/ribbon-callbacks.cpp (get_mail_from_control): Only
access the item selection after we checked if we have a
preview pane / word editor.

The selection.Item(x) call can trigger a load / unload event
cycle. This is expensive and should be avoided if not
necessary. Also in the Outbox this somehow prevents
sending a mail.

GnuPG-Bug-Id: T3812

7 weeks agoFix multipart/signed detection if ms-tnef wrapped
Andre Heinecke [Mon, 26 Feb 2018 15:45:51 +0000 (16:45 +0100)]
Fix multipart/signed detection if ms-tnef wrapped

* src/mapihelp.cpp (change_message_class_ipm_note_smime),
(change_message_class_ipm_note_smime_multipartsigned): Handle tnef.

This fixes mutlipart/signed detection both when s/mime is enabled
and when it's disabled. For these kind of ms-tnef wrapped mails
there is actually a virtual attachment with a filename smime.p7m
that contains our mimestructure. Happlily all our other code
can handle this already.

GnuPG-Bug-Id: T3802

7 weeks agoAdd some more sender address lookups
Andre Heinecke [Mon, 26 Feb 2018 15:44:35 +0000 (16:44 +0100)]
Add some more sender address lookups

* src/mail.cpp (Mail::update_oom_data): Add more sender fallbacks.
* src/oomhelp.h: Define new DASL's

These properties were the only way I could find the SMTP
Address in an example mail from T3802.

8 weeks agoFix WKS-Confirm mail detection
Andre Heinecke [Thu, 22 Feb 2018 09:40:58 +0000 (10:40 +0100)]
Fix WKS-Confirm mail detection

* src/mapihelp.cpp (mapi_get_message_content_type): Comparing
an empty line would result in wks confirm detection.

8 weeks agoPrint error when decryptresult is null
Andre Heinecke [Thu, 22 Feb 2018 08:53:19 +0000 (09:53 +0100)]
Print error when decryptresult is null

* src/parsecontroller.cpp (format_error): Print an error
when decrypt is requested but the result is null. This means
that parsing failed.

8 weeks agoHandle MS-TNEF PGP/MIME Mails
Andre Heinecke [Thu, 22 Feb 2018 08:50:28 +0000 (09:50 +0100)]

* src/mapihelp.cpp (get_first_attach_mime_tag): Work with more
then one attachment.
(change_message_class_ipm_note): More ms-tnef handling.

Apparently Office365 converts mails from some to ms-tnef
attachments. We still won't work for S/MIME ms-tnef attachments
as I would need an example, but PGP/MIME should work now
additionally to PGP/Inline.

GnuPG-Bug-Id: T3802

8 weeks agoImplement handling of WKS-Confirmation mails
Andre Heinecke [Thu, 22 Feb 2018 08:45:46 +0000 (09:45 +0100)]
Implement handling of WKS-Confirmation mails

* src/common_indep.h (msgtype_t): New messagtype for WKS_Confirm
* src/mail.cpp (Mail::decrypt_verify): Handle new message type.
(Mail::is_smime): Clarify an error message.
* src/mapihelp.cpp
(string_to_type, mapi_change_message_class),
(mapi_get_message_content_type): Handle
wks confirmation mails.
* src/message.cpp: Default / ignore new message type in old code.
* src/wks-helper.cpp: Lots of changes.

8 weeks agoUse gpgol_message_box in wks-helper
Andre Heinecke [Tue, 20 Feb 2018 14:13:03 +0000 (15:13 +0100)]
Use gpgol_message_box in wks-helper

* src/wks-helper.cpp (WKSHelper::notify),
(WKSHelper::start_publish): Use gpgol_message_box.

You eat with your eyes ;-)

8 weeks agoAdd UTF8 and Icon Message Box helper
Andre Heinecke [Tue, 20 Feb 2018 14:07:24 +0000 (15:07 +0100)]
Add UTF8 and Icon Message Box helper

* src/common.c (gpgol_message_box): New.
* src/common.h (gpgol_message_box): Declare.
* src/dialogs.h, src/dialogs.rc: Add icon.
* src/icons/ (EXTRA_DIST): Add icon.
* src/icons/lock.ico: New.