Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: Florin Andrei on August 01, 2013, 01:22:59 PM

Title: managesieve: filter names, and default list of headers
Post by: Florin Andrei on August 01, 2013, 01:22:59 PM
I'm successfully using the managesieve plugin with RC 0.9.2 and Dovecot 2.0.9. For a while, I've maintained manually a list of Sieve filters, originally (long, long time ago) created by Squirrelmail. The vast majority of my filters are filtering either by the From header (messages from people I know or from various subscriptions), or by List-Id (messages from mailing lists). A typical fragment of the list would look like this:

if address :contains "from" "@coursera.org"
{
        fileinto "corp.coursera";
        stop;
}
if header :contains "List-Id" "<tochnog-users.lists.sourceforge.net>"
{
        fileinto "lists.tochnog-users";
        stop;
}


A few issues:

1. Filter names

managesieve won't save any changes to the filter list unless the filter I just edited is given a name. When I first opened the list in managesieve/RC, I made a small change to a filter (it was using the custom header "from" and I changed it to "From" which is on the default list), it would not save the changes.

Only after I gave that filter a name did managesieve save the changes. It's not a big deal, but it was confusing at first. I thought something was wrong with the Sieve component of Dovecot.

I also noticed it tends to replace

if address :contains "from" "@whatever"

with

if address :all :contains "From" "@whatever"

which is probably fine; I'm no big expert in Sieve, so I can't tell what the difference really is.

2. Default list of headers

When creating / editing a filter, managesieve presents you with a short list of headers you could choose from. These headers are: Subject, From, To, Body, Size. And then there's an option to use arbitrary headers.

Of the nearly 70 filters in my list, about half use the List-Id header. It would be great to have that header as an option in the default list. In fact, it would be great if the list itself was a configurable item somewhere. This way, people could customize the list according to their most often-used headers.

I tried to look through the code to find where the list is specified, but I could not find anything. Does anyone know where the list of headers is defined?
Title: Re: managesieve: filter names, and default list of headers
Post by: alec on August 02, 2013, 03:23:56 AM
The list is in plugins/managesieve/managesieve.php line 45. http://trac.roundcube.net/ticket/1489271 and https://github.com/roundcube/roundcubemail/commit/b2c5869fe24eff81a92bc233bfef374bdb7afc31
Title: Re: managesieve: filter names, and default list of headers
Post by: Florin Andrei on August 02, 2013, 04:36:21 PM
Quote from: alec on August 02, 2013, 03:23:56 AM
The list is in plugins/managesieve/managesieve.php line 45. http://trac.roundcube.net/ticket/1489271 and https://github.com/roundcube/roundcubemail/commit/b2c5869fe24eff81a92bc233bfef374bdb7afc31

Ok, found it, but I've a question. The list in managesieve.php only contains Subject, From and To. The actual drop-down menu in Settings also contains Body, Size, and the final entry for arbitrary folders. I assume all of those get pulled from somewhere else?