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

* po/de.po: Translate.

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


12 months 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

12 months 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.

12 months 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

12 months 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.

12 months 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

12 months 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

12 months 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

12 months 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

12 months 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

12 months 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

12 months 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.

12 months 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.

12 months 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

12 months 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.


12 months 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.

12 months 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

12 months 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

12 months 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

12 months 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

12 months 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

12 months 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

12 months 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.

12 months 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

12 months 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.

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

Make it more clear.

12 months 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

12 months 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

12 months 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

12 months 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.

12 months 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.

12 months 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.

12 months 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.

12 months 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

12 months 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

12 months 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

12 months 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

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

* po/*: update.

13 months 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

13 months 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

13 months 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

13 months 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

13 months 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.

13 months 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

13 months 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.

13 months 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.

13 months 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.

13 months 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

13 months 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.

13 months 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

13 months 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.

13 months 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


13 months 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.

13 months 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.

13 months 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.

13 months 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.

13 months 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.

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

* po/ Add cryptcontroller.

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

* po/: update.

13 months 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

13 months 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

13 months 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.

13 months 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

13 months 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.

13 months 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

13 months 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.

13 months 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.

13 months 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.

13 months 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.

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

* po: Update.

13 months 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.

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

* po/de.po: Update

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

* po: Update.

13 months 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.

13 months 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.

13 months 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.

13 months 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.

13 months 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.

13 months 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

13 months 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.

13 months 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.

13 months 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.

13 months 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.

13 months 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

13 months 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

13 months 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

13 months 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.

13 months 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.

13 months 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.

13 months 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

13 months 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.

13 months 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 ;-)

13 months 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.

13 months agoFix setting the account for WKS Mails
Andre Heinecke [Tue, 20 Feb 2018 13:41:47 +0000 (14:41 +0100)]
Fix setting the account for WKS Mails

* src/oomhelp.cpp (put_oom_disp): For VT_DISPATCH it is
* src/wks-helper.cpp (WKSHelper::send_mail): Properly release

14 months agoImplement WKS-Client request sending
Andre Heinecke [Fri, 16 Feb 2018 15:30:25 +0000 (16:30 +0100)]
Implement WKS-Client request sending

* src/wks-helper.cpp (WKSHelper::send_mail): New.
* src/wks-helper.h: Update accordingly.

This basically works. But there is a big issue. Somehow
the SendUsingAccount setting does not work so it always
sends out the mails with the default account.

14 months agoAdd oom helper to create mail and handle accounts
Andre Heinecke [Fri, 16 Feb 2018 15:29:11 +0000 (16:29 +0100)]
Add oom helper to create mail and handle accounts

* src/oomhelp.cpp (create_mail): Create a new mail.
(get_account_for_mail): Get an account for a mail address.
(put_oom_disp): New.
* src/oomhelp.h: Update accordingly.

14 months agoMake it possible to get the last created mail
Andre Heinecke [Fri, 16 Feb 2018 15:27:38 +0000 (16:27 +0100)]
Make it possible to get the last created mail

* src/mail.cpp (Mail::get_last_mail): New.
* src/mail.h: Update accordingly.

This makes it easy to get a reference to our internal Mail
object for example if a mail was created programatically
as the returned DISPATCH pointer differ.

14 months agoAdd possibility to override mime struct for mail
Andre Heinecke [Fri, 16 Feb 2018 15:25:32 +0000 (16:25 +0100)]
Add possibility to override mime struct for mail

* src/cryptcontroller.cpp (update_mail_mapi): Prefer override mime.
* src/mail.cpp (Mail::set_override_mime, Mail::get_override_mime):
(Mail::update_crypt_mapi): Create dummy crypter for overidden mime.

14 months agoAdd notification handling to WKS Helper
Andre Heinecke [Fri, 16 Feb 2018 12:05:09 +0000 (13:05 +0100)]
Add notification handling to WKS Helper

* src/windowmessages.cpp,
src/windowmessages.h (WKS_NOTIFY): New.
* src/wks-helper.cpp, src/wks-helper.h: Add more code.

After an encrypt / sign we send a notification some time
later that a MessageBox for WKS Publishing can be opened
back in the UI thread.