First Last Prev Next    No search results available
Details
: Support Creation of Custom Templates
Bug#: 25989
: quickFilters
: General
Status: RESOLVED
Resolution: FIXED
: PC
: Windows NT
: unspecified
: P3
: enhancement
: ---

:
:
:
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Pat <patdohle@yahoo.de>
Assigned To: Axel Grude <axel.grude@gmail.com>

Attachments
Custom Template Rules - Example (30.10 KB, image/png)
2015-04-08 05:09, Axel Grude
no flags Details
How to define a filter (85.53 KB, image/png)
2015-04-09 06:07, Axel Grude
no flags Details
2.9 prerelease 80 (263.70 KB, application/x-xpinstall)
2015-04-09 06:17, Axel Grude
no flags Details
2.9 prerelease 82 (263.81 KB, application/x-xpinstall)
2015-04-09 09:16, Axel Grude
no flags Details
2.9 prerelease 108 (268.35 KB, application/x-xpinstall)
2015-04-10 04:11, Axel Grude
no flags Details
2.9 prerelease 116 (268.95 KB, application/x-xpinstall)
2015-04-10 09:55, Axel Grude
no flags Details
2.9 prerelease 130 (270.37 KB, application/x-xpinstall)
2015-04-11 14:28, Axel Grude
no flags Details
2.9 prerelease 180 (274.95 KB, application/x-xpinstall)
2015-05-16 05:37, Axel Grude
no flags Details


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2015-03-18 06:52
Make it possible to define custom filter templates that can be selected on the
first page of the filter assistant. The users should be able to define any
email header field and
1) whether it should be pre-filled from the currently selected  email (Subject
is a special case; should it do keyword recognition or simply use the whole
subject)
2) what operator to use (less than, is, contains, is not etc.)
3) whether to use a hard coded value (exanple: age is less than _2_ days)

Example:

from - ends with - domain of email's from field (fred@yahoo.com) => yahoo.com
status is read
status is Not Starred
age in days is Greater than 1

Thank you!
Greeting
Patrick
------- Comment #1 From Axel Grude 2015-04-08 04:48:23 -------
Setting to Assigned to move this forward. I am still agonizing over UI, and
where to store the templates, but I think it would be best to store them as
"extended" filters (maybe at the end of the normal filter list). 

For creating a new template I might just add a new button to the Filter
Assistant Selection screen. We will need some "special values" as place holders
for the prefill ones.

To start, we will basically need a place holder for each possible mail header,
and also an expansion rule for the ones that have lists such as cc, bcc and to.

For the moment I am tempted to use similar syntax like in my addon
SmartTemplate4,k so we could have

%subject% = entire subject
%to(mail)% = mail portion of "to" header. if multiple recipients are in the
"to" field break this up into multiple conditions
%to(name)% = name portion of "to" header.
%to(domain)% = domain is same as email address
%to% = complete "to" header broken up into multiple conditions if necessary
from, cc, bcc = same rules as to
%tag% = tag words broken up into multiple rules

these would be placed into the value fields for the condition and then expanded
from the selected email once this particular template has been chosen.

We might also need to store the name of the template somewhere; filter name
might not be the best place for this unless it adheres to a standard like

quickFiltersTemplate1: <user defined template name>

I intend to re-use Thunderbird's existing "edit filter" dialog for editing the
templates, so I might need to overlay some restrictions / logic around naming
conventions. We might also need additional controls for inserting the
appropriate keywords (see above) into the corresponding condition values.
------- Comment #2 From Axel Grude 2015-04-08 05:09:46 -------
Created an attachment (id=8031) [details]
Custom Template Rules - Example

Using the standard interface for defining a template as a starting point. I
noticed that there is a rule that forces me to check either Manual Running or
"when getting new mail", although effectively the template should never be run
as it is only going to be used to generate new templates. It can however be
deactivated in the filter list screen, so this should happen automatically. 

Also the template will have to be automatically listed in the assistant, and if
we use the filter name to list it we have to enforce strict naming rules (e.g.
all templates start with quickFilterCustomTemplate followed by a unique number
and ':') they could then be listed while dropping this "prefix" and show the
user specific title in the templates list.
------- Comment #3 From Axel Grude 2015-04-08 05:16:39 -------
(In reply to comment #2)
> Created an attachment (id=8031) [details] [details]
> Custom Template Rules - Example
> 
> Using the standard interface for defining a template as a starting point. I
> noticed that there is a rule that forces me to check either Manual Running or
> "when getting new mail", although effectively the template should never be run
> as it is only going to be used to generate new templates. It can however be
> deactivated in the filter list screen, so this should happen automatically. 
> 

And here follows another important problem: should templates be stored "per
mail account" (like filters are currently) or should they be stored globally? I
would tend to prefer "globally" and have them visible from everywhere to avoid
complications.

Or alternatively, maybe we can _store_ them under Local Folders, so this would
also be a nice compartmentalization against all "real" filters. They would only
be listed there.

I was able to cut / paste my prototype filter from the previous screen shot
into the "Local Folders" account, so I guess this is what I need to enumerate
when populating the assistant in order to display these templates. I also
assume that the user defined ones should be at the top of the list.
------- Comment #4 From Axel Grude 2015-04-09 06:07:46 -------
Created an attachment (id=8032) [details]
How to define a filter

create a new filter in Local Folders named

quickFilterCustomTemplate: XXXXX

For string values, you can use the placeholder variables (representing the
following mail headers)
%from%
%to%
%cc%
%bcc%
%return-receipt-to%
%reply-to%
%resent-to%
%mail-followup-to%
%mail-reply-to%
%subject%
%list-id%

address parameters (from, to, cc, bcc) allow modifiers such as 
%to(name)%

name: full name or name portion before email
firstname: first name (following the pattern firstName.LastName@domain.com)
lastname: last name (following the pattern firstName.LastName@domain.com)
mail: mail portion of email address

---------
planned: domain  (for domain-name after email address)
------- Comment #5 From Axel Grude 2015-04-09 06:17:26 -------
Created an attachment (id=8033) [details]
2.9 prerelease 80

First Prototype

1 - added Advanced checkbox to activate feature 
2 - basic features for creating custom filter templates

I also successfully tested %from(firstname)%

not bad so far...
------- Comment #6 From Axel Grude 2015-04-09 09:16:07 -------
Created an attachment (id=8034) [details]
2.9 prerelease 82

# Added domain switch for matching sender's domain:
  %from(domain)%
# Added a function for calculating the current message URI [via
nsIMsgFolder.getUriForMsg()]

  therefore it should now also be more reliable when used with QuickFolders'
"quickMove" function. And possibly work with the tag listener.
------- Comment #7 From Axel Grude 2015-04-10 04:11:57 -------
Created an attachment (id=8036) [details]
2.9 prerelease 108

Added UI to get to existing custom templates quickly
Added UI that shows we are editing a custom template when we open an existing
one

To do: provide function to create a custom template automatically
(naming and UI) either from mail context menu or some other place (?)

If possible I do not want to overburden the existing context menu in the thread
pane... there is a lot going on in that already.
------- Comment #8 From Axel Grude 2015-04-10 09:55:35 -------
Created an attachment (id=8037) [details]
2.9 prerelease 116

Added a "Create New..." button in advanced options to make generation of Custom
Templates a little easier. I supposed you could also use an existing filter,
cut it from its normal accounts and paste into Local Folders, then rename to
"quickFilterCustomTemplate: <my filtername>" and then edit it, but I think this
is slightly less painful. Also, this way I will be able to inject some UI to
help with the special variables that are possible (as I now know that the
Editor was opened for editing a Custom filter)

As a default term I chose 
  Sender contains "%from(mail)%"
As default action I chose 
  Set Priority to Normal

When a new filter is created based on this, %from(mail)% would be expanded to
the email portion of the mail address. The target Folder will be added, as per
usual. Priority = Normal was chosen as an "unobstructive dummy" as we cannot
edit a filter without at least one action.
------- Comment #9 From Axel Grude 2015-04-11 14:28:01 -------
Created an attachment (id=8038) [details]
2.9 prerelease 130

Added a drop down with suggestions for common mail headers. This is currently
not localised (all labels are in English) and will copy the appropriate
variable to the clipboard so it can be pasted in the filter term.

Clipboard is the "quick-and-dirty" approach so this might be a little more
elegant in the final version, depending on how much more time I want to invest
into this feature. There are some newsgroup specific mail headers that might be
helpful, but all of them need to be tested.

So I will leave that with you from some practice testing. Note that creating
the filters will be more successful for smaller / local / POP3 mails, as the
whole mail needs to be streamed (at the moment this is done synchronously).
This method is known to be super slow in some cases on IMAP when big mails
(especially those with attachment or lots of inline images) are only kept on
the server. 
------- Comment #10 From Axel Grude 2015-05-16 05:37:25 -------
Created an attachment (id=8055) [details]
2.9 prerelease 180

Added / fixed code to add the new filter rule through the dropdown
automatically. One problem that is still unsolved is that custom headers such
as "list-id" have to be added to the left hand dropdown with the "customize..."
link first in order to be used, so that's a bit of a disadvantage unless you
create a lot of filters using this method.

First Last Prev Next    No search results available