RealRaven2000 / quickFilters

Thunderbird Add-on: quickFilters
http://quickfilters.quickfolders.org/
Other
49 stars 11 forks source link

Example subject manipulation filter not working #73

Closed sandybrownlee closed 2 years ago

sandybrownlee commented 2 years ago

This is on Thunderbird 78.13.0 64 bit (Linux Mint) - FiltaQuilla 3.2

I use a variation of the example javascript action filter to amend the subject on some emails (my mailserver adds the prefix {SPAM?} quite often: rarely is this correct, but it has the ironic effect that when I reply to such emails, the replies end up in junk folders). The filter simply replaced the SPAM tag with a couple of underscores so I could see where it happened:

for (let index = 0; index < msgHdrs.length; index++)
{
  let hdr = msgHdrs.queryElementAt(index, Ci.nsIMsgDBHdr);
  hdr.subject = hdr.subject.replace("{SPAM?}", "__");
}

This has recently started failing with this error in Thunderbird's console:

msgHdrs queryElementAt is not a function

I don't know the cause as I'm not all that familiar with Thunderbird's update cyctem. Maybe it's an API change somewhere. Anyway, I fixed it by doing this:

for (let index = 0; index < msgHdrs.length; index++)
{
    msgHdrs[index].subject = msgHdrs[index].subject.replace("{SPAM?}", "__");
}

This now works fine. Assuming there is nothing else wrong with the above, it might be worth updating the example in the documentation for javascript actions to reflect that. (I was also not clear on what nsIMsgDBHdr objects - the type of the msgHdrs array - actually contain - is it possible to have a link to docs on that somewhere?)

Thanks!

RealRaven2000 commented 2 years ago

Please, if you still have this issue - add it to the FiltaQuilla github. THis one is for quickFilters.

sandybrownlee commented 2 years ago

I do apologise, I'm not sure how I managed to stumble into the wrong project repo.

AlexFinch commented 2 years ago

Thanks for this example. Saved me a lot of time. Could this example be put in the documentation for filtaquila as it works.

RealRaven2000 commented 2 years ago

it already is. Before I tell you where - where did you look up yours?

is there a link to the old site from Kent James somewhere?

On Thu 20 Jan 2022, 09:54 Alex Finch, @.***> wrote:

Thanks for this example. Saved me a lot of time. Could this example be put in the documentation for filtaquila as it works.

— Reply to this email directly, view it on GitHub https://github.com/RealRaven2000/quickFilters/issues/73#issuecomment-1017299042, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQFVMT2IXNKWOL4LLSL2NTUW7LTTANCNFSM5DWV2CNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.***>