RealRaven2000 / FiltaQuilla

Adds many new mail filter actions to Thunderbird
http://quickfilters.quickfolders.org/filtaquilla.html
GNU General Public License v3.0
88 stars 17 forks source link

Patches for adding variables for use in javascript filters #101

Open bsgcic opened 3 years ago

bsgcic commented 3 years ago

I added some lines to filtaquilla.js and to jsEditor.xhtml. I attached the files that I made those additions to in version 3.0.9 which is the one that I am currently using with Thunderbird 78. You can find the additions by searching on "BSGCIC". They are inside "self.javascriptAction =" and "self.javascriptActionBody =". However, I use self.javascriptAction but presently not self.javascriptActionBody as there were some issues with it years ago and I haven't retried it since.

Please see the attached patched filtaquilla.js and jsEditor.xhtml files.

filtaquillaJs_and_jsEditorXhtml_customized_by_Jeff_Wexler_in_v3_0_9.zip

And Screenshots: 20210411_131025 20210411_130947

As of this moment, I have 1,663 javascript matching rules. I would be happy to contribute if it is something that you think would be of value to others. It might not as it is an addition of the following variables for ease in my javascript matches for me and they are probably redundant with what you already have available:

subjectDecoded authorDecoded (i.e., Header's From) allRecipientsListDecoded (i.e., Header's To, CC, and BCC joined by commas) toListDerivedDecoded (i.e., Header's To) ccList bccList allAddressesListDecoded (i.e., Header's From, To, CC, and BCC joined by commas)

I almost exclusively only use the variables allAddressesListDecoded, allRecipientsListDecoded, subjectDecoded and authorDecoded.

The following is an example of how I use the variables. This one is a javascript rule for filtering notices and other emails received from National Grid (my electricity provider) that I do not need to look at and just moves them to a folder. I chose National Grid to send because it is one of the companies that sends emails through other companies' web address and thus I match for words in the from address as well as the domain, or just on the domain if from National Grid itself, etc. This is the content of the javascript filter. I attached a couple pictures so you can see how I have the rule set up:

//CTM20140302 Created

( ( ( ( /[@.]mailca.custhelp.com/i.test(authorDecoded) ) || ( /NationalGridOnlineServices@nationalgrid.com/i.test(authorDecoded) ) || ( /news@newsletter.qlmailer.com/i.test(authorDecoded) ) ) &&

    (
        ( /Paperless Billing/i.test(subjectDecoded) ) ||
        ( /easier way/i.test(subjectDecoded) ) ||
        ( /your billing preference/i.test(subjectDecoded) ) ||
        ( /National Grid/i.test(subjectDecoded) )
    )
) ||

(
    ( /NationalGridMAEnergyReports@email\.opower\.com/i.test(authorDecoded) ) ||
    ( /[@\.]solutions\.nationalgridus\.com/i.test(authorDecoded) ) ||
    ( /[@\.]energycustomercouncil\.com/i.test(authorDecoded) ) ||
    ( /nationalgrid@us\.confirmit\.com/i.test(authorDecoded) ) ||
    ( /nationalgrid@email\.nationalgridus\.com/i.test(authorDecoded) ) ||
    ( /NationalGridOnlineServices@nationalgrid\.com/i.test(authorDecoded) ) ||
    ( /nationalgrid@emails\.nationalgridus\.com/i.test(authorDecoded) ) ||
    ( /nationalgrid@email\.engagemsg\.com/i.test(authorDecoded) )
)

);