Here are some architecture notes for the recent improvements to mail filters.
filter after the fact, or manual filtering
We now support filtering after the fact.
The way that it is implemented is by getting the desired filter (or filters) and doing a search on the selected folder.
We create the search (and it's terms) from the filter.
As the search returns hits, we keep track of the headers.
When the search is done, we apply the filter action to the headers.
You can perform filtering after the fact from the Filter List dialog (see the "Run Now" button) and the Tools menu (see "Run Filters on Selected Folder")
UI spec: http://www.mozilla.org/mailnews/specs/filters/#Manual
We now support news filtering.
News filtering is on a per newsgroup basis.
You can't set up any cross server filters. (there is a bug because the UI makes it look like you can.)
News filtering is done when we download the headers, when doing XOVER.
When doing XOVER, the only filter criteria we know is the subject, date and sender. (there is a bug to support more)
news filtering has two new actions: "ignore" and "watch"
the "delete" action for news means "don't add this header to the news database", which is different than "ignore".
news does not support filtering after the fact yet. (there is bug to implement this)
The filter logging code was ported over from 4.x.
The biggest difference between it and 4.x is that the filter log is now an html file.
This will allow us to (one day) linkify or colorize the log file, or use CSS to hide/show entries by type. this work has not been done yet.
There is a unique log file per mail server, and per newsgroup.
UI spec: http://www.mozilla.org/mailnews/specs/filters/#Log
move is the last action.
for more details, see http://bugzilla.mozilla.org/show_bug.cgi?id=174441
UI spec: http://www.mozilla.org/mailnews/specs/filters/#Filter%20Rules%20D
filter by addressbook
Part of the mail views feature is the ability to show only mail from people you know, or people in your addressbook.
You can now create filters where sender is (or isn't) in your addressbook.
You can also do searches based on addressbook.
for more details, see http://bugzilla.mozilla.org/show_bug.cgi?id=162789
filter file name changed
note, in previous versions the filter file was named rules.dat. It is now msgFilterRules.dat.
It was renamed because we had to fork the format. for more details see http://bugzilla.mozilla.org/show_bug.cgi?id=168553
note, if you use older versions of mozilla with new ones, new changes to msgFilterRules.dat will not be seen with previous versions.