jobisoft / quicktext

An extension for Thunderbird that lets you create templates that can be easily inserted into your own emails.
Mozilla Public License 2.0
187 stars 53 forks source link

[contribution] Script for toggling (GPG) signing a message #346

Closed araujorm closed 1 year ago

araujorm commented 1 year ago

Hello.

I made the following script for toggling signing (GPG) a message. Possible arguments: on/off (if empty will toggle current state, otherwise forces the message to be signed or not) . Tested successfully on Thunderbird 102.10.0 (Linux, but I don't see any reason for it not to work on every other platform).

Here's the script (I've called it ToggleSignMessage which seems appropriate to me but feel free to name otherwise):

let type = this.mVariables[0];

var win = this.mWindow;

if ( type == null ||
     (type == "on" && !win.gSendSigned) ||
     (type == "off" && win.gSendSigned) ) {
  win.toggleGlobalSignMessage();
}

Basic usage:

[[SCRIPT=ToggleSignMessage|off]]
[[SCRIPT=ToggleSignMessage|on]]
[[SCRIPT=ToggleSignMessage]]

An example follows that I find useful to report spam to a certain service. My identity (GPG) signs messages but default, but the signature attachment could be misinterpreted by that service since they want us to attach the message (forwarded as an attachment). So I made this quicktext template to quickly fill the From and To fields, while also disabling the GPG signing of that message when forwarding a spam message as an attachment. Hope it is useful to somebody else.

[[SCRIPT=Identity|setIdentity|id1]][[SCRIPT=ToggleSignMessage|off]][[SCRIPT=RemoveRecipients|all]][[SCRIPT=AddRecipients|to|spam-report@service-address.domain]]

Please feel free to add the above script to the contributed community scripts, and the same for the example on the wiki if you want.

Thanks for you work.

Edited: simplified the script

SamuelPlentz commented 1 year ago

Thanks for contributing.

Added a wiki entry. Can be closed.