RealRaven2000 / FiltaQuilla

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

isRead/isUnread/flagsSet/flagsUnset and optimizations - suggestions for testing #127

Open pfolk opened 3 years ago

pfolk commented 3 years ago

I'm working on some contributions to the codebase that implement searches for Read/Unread, and Deleted (but more generally, testing bits of nsIMsgHdr.flags which I am hoping conform to the X-Mozilla-Status header documented at http://forums.mozillazine.org/viewtopic.php?f=39&t=2956877), and do some optimization (caching regexps and generally making the filters do as little as possible given the interface). My motivation is that I have 162k messages in my inbox and I have saved searches to help me deal with the ton of messages I get, and want to make them as efficient as possible.

I have my draft code implemented, but am looking for some suggestions on how to test it. Is there a good way to do a syntax chec of the edited files? If I screwed something up in my (limited) edits to the existing code, am I correct in assuming that I could simply disable the addon--that my profile would likely not be corrupted? It would be painful if I had to rebuild my profile and download all my messages (Inbox isn't even my largest folder!) =)

Untested draft code attached (change extension to .js and put in content/ subfolder of the add-on to test it) for context.

filtaquilla-util.txt filtaquilla.txt

pfolk commented 3 years ago

(I know you can search for Status IS/ISN'T Read, but I don't know how that is implemented--my code just checks the header.isRead field, so might be faster--or might not!)

pfolk commented 3 years ago

1) The info above on the X-Mozilla-Status header is not useful. The real info on flag values is in https://searchfox.org/comm-central/source/mailnews/base/public/nsMsgMessageFlags.idl (probably also a nsMsgMessageFlags.h file); that info allowed me to implement isDeleted in addition to the other items

2) I note that there are a variety of bugzilla issues related to being able to search for isDeleted: https://bugzilla.mozilla.org/show_bug.cgi?id=98097 https://bugzilla.mozilla.org/show_bug.cgi?id=243075 https://bugzilla.mozilla.org/show_bug.cgi?id=190974 among probably others.

None of those quite implement this, but the latter does implement a way to show or not show Deleted messages: 1) Right click in the Toolbar and choose Customize 2) Add the Mail Views widget somewhere The Mail Views widget provides a way to show or hide deleted messages, and adds a menu with that feature at View>Messages

3) I've also subsequently updated and tested most of my code, and put it here in case others want to use it or upstream wants to incorporate the changes. My optimized Subject Regex 2 code is NOT yet tested, and there are only English localizations of the new features, but otherwise it seems to work.

filtaquilla-3.2b-pf.zip

RealRaven2000 commented 3 years ago

I did a quick diff with your sources - they don't appear like they are based on the latest changes in the master branch?

Also, how exactly are the new search methods different from the "Status" field:

image

I also not that some of your referred bugs are quite old, I think it would be a good idea to flag them to Wayne Merry for cleanup / check for duplication.

RealRaven2000 commented 3 years ago

PS: if you upload new versions, can you make sure to remove any files ending with .ext~ or .orig as they make it harder to create diffs.

pfolk commented 2 years ago

Sorry, you're right I didn't do my changes on a git-based version. I can probably do that, I just don't have it set up under windows. I will pull and upload new versions based on the current master, and without the extra cruft, at some point =)

My IsRead, IsUnread, IsDeleted, FlagsSet, FlagsUnset use bitwise comparisons with the aMsgHdr field. Without digging through the source code to Thunderbird I'm not able to see whether the Status Is/Isnt filter is implemented that way or using a slower header-based comparison. Regardless of performance details, my FlagsSet/FlagsUnset/IsDeleted give new functionality. FlagsSet and FlagsUnset let you test multiple flags in combination in a novel way by.