Created attachment 1756 [details] preliminary patch for separate S/MIME account preferences When an account mail address has multiple S/MIME keys, one is possibly forced to configure the key to use in the account preferences. But if PGP is also in use, the single setting in Claws makes it impossible to have an independent choice for the key to use for that. I am attaching a proof-of-concept for this feature. I just duplicated the GPG prefs into S/MIME prefs and introduced separate storage. It seems to work nicely for me. I do not suggest to just apply this patch with it's cargo cult approach, but it shows the functionality. What I am not sure about is the key generation function. I presume one would need to change things there, too, to work with S/MIME. No idea, since my S/MIME keys come out of the web browser because of the web-based process with the CA.
Created attachment 1757 [details] preliminary patch for separate S/MIME account preferences (without noise from distclean leftovers)
The content of attachment 1756 [details] has been deleted by Paul <paul@claws-mail.org> without providing any reason. The token used to delete this attachment was generated at 2017-06-15 08:41:52 CEST.
Created attachment 1758 [details] preliminary patch for separate S/MIME account preferences (fixed PGP case and some style) PGP was broken for accounts where S/MIME is configured because I did not see that sgpgme_setup_signers() is used by both paths. Now there is an S/MIME switch in there. Also, I tried to adapt style to what Claws prefers.
Created attachment 1759 [details] preliminary patch for separate S/MIME account preferences (more style) Some style fixes. Currently I seem to have trouble with getting the correct key for decryption. Not sure yet if it's the patch or some issue with my setup after a migration.
Ah, I was confused by normal behaviour: When I simulate communication with two accounts in the same claws-mail instance, I get confused by having both the sender's and the receiver's keys available for decryption. Claws/gpg just chooses the first suitable key and that doesn't have to match the one I expect (mentally switching role from sender to receiver). This behaviour has nothing to do with the patch.
Looks good so far. However, I'm not sure if using the same page widget creation func is the right way to go. It is sufficient for now, but in the future, we may add additonal preferences for PGP and/or for SMIME privacy system, which will not be applicable to the other one. We would have to get the SMIME plugin its own function then - or we can do it now. We could either do less work now, or in the future. :)
I think the best solution would be to clearly separate the pref pages. The pgpcore plugin should provide a Plugins->OpenPGP page (renamed from current "GPG" to make it less ambiguous), and the smime plugin a Plugins->S/MIME page. Another thing that should be improved - I don't like the extra argument to sgpgme_setup_signers(). The used signing protocol is available in the first function argument, the context struct, so the function can simply query it via gpgme_get_protocol(), and decide which config values to work with from that.
So the desired changes center around the GUI, not the choice of parameter storage … which is fine by me, as I know I just stitched things together to work somehow. Regarding the differing dialogues: I'd hate to have identical code duplicated now just for being conceptionally pure. But I do not especially care if someone else does this duplication to feel better while applying the patch;-) Regarding setup_signers(): If there is a function to get the protocol, all the better. I just don't know much about the claws codebase and took what I found at a glance. Do you expect another revision of the patch or are you just asking for opinions? The cosmetic points noted so far seem to be more efficinently done by someone who is used to working on the codebase anyway.
Anything? The patch works nicely so far for me …
I think I got stuck on thinking how to transparently handle the switch from shared preference string to the smime-specific string, for users who use smime, and then I got distracted by other stuff and never got back to this. Sorry. :) I will try to finish this in next few days.
Changes related to this bug have been committed. Please check latest Git and update the bug accordingly. You can also get the patch from: http://git.claws-mail.org/ ++ ChangeLog 2017-09-23 20:44:03.032126305 +0200 http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=31dee1bff0ec008c1e6353149912ef008ccd253a Merge: 287b2f1 3bce048 Author: Colin Leroy <colin@colino.net> Date: Sat Sep 23 20:44:02 2017 +0200 Merge branch 'master' of file:///home/git/claws http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=3bce04815148589855c401da99bcabe6d2ead575 Author: Andrej Kacian <ticho@claws-mail.org> Date: Sat Jul 1 12:23:33 2017 +0200 Use separate account configuration for OpenPGP and for S/MIME. This is useful for users who switch between privacy systems. Based on patch by Thomas Orgis. Closes bug Bug 3834 - [PATCH] separate account prefs for S/MIME to be able to specify keys for both PGP and S/MIME
Added to git, with minor changes. Thanks!