sieve date support?

Kenneth Marshall ktm at rice.edu
Wed Dec 8 10:45:21 EST 2010


On Wed, Dec 08, 2010 at 10:34:00AM -0500, Adam Tauno Williams wrote:
> On Wed, 2010-12-08 at 09:05 -0600, Kenneth Marshall wrote:
> > I know the date extension to the sieve language was discussed
> > a while back. Is their any plan to add it to the Cyrus sieve
> > implementation? That would allow it to handle the largest
> > issue that our users face -- enabling/disabling vacation
> > on a predetermined schedule. Currently, they must remember to
> > turn it on when they leave and then remember to disable when
> > they return.
> 
> This can be accomplished via regexp; and can automatically be setup via
> the Ingo (Horde) SIEVE interface. <http://www.horde.org/ingo/>
> 
> The script snippet will look something like -
> 
> # Vacation
>  if allof ( not exists ["list-help", "list-unsubscribe",
> "list-subscribe", "list-owner", "list-post", "list-archive", "list-id",
> "Mailing-List"], not header :comparator "i;ascii-casemap" :is
> "Precedence" ["list", "bulk", "junk"], not header :comparator
> "i;ascii-casemap" :matches "To" "Multiple recipients of*" ) { 
>       if header :regex "Received" "^.*(2010) (\\(.*\\) )?..:..:.. (\\(.*
> \\) )?(\\+|\\-)....( \\(.*\\))?$" {
>       if header :regex "Received" "^.*(Dec) (\\(.*\\) )?.... (\\(.*\
> \) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" {
>       if header :regex "Received" "^.*(10|11|12) (\\(.*\\) )?... (\\(.*\
> \) )?.... (\\(.*\\) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" {
>       vacation :days 3 :addresses ["adam at cisco-inc.com",
> "adam at mor-value.com", "adam at morrison-ind.com",
> "adam at morrison.iserv.net"] :subject "Out Of The Office" "I will be out
> of the office 2010-12-10....";
>   }
>   }
>   }
> 

Right. You have just made my point about the need for the date
extension:

require ["date", "relational", "vacation"];
     if allof(currentdate :value "ge" "date" "2007-06-30",
              currentdate :value "le" "date" "2007-07-07")
     { vacation :days 7  "I'm away during the first week in July."; }

The regular expression is not user friendly. If the tool does not
do it for you and hide what it has done from you, you get a screen
or more of alphabet soup.

Cheers,
Ken


More information about the Cyrus-devel mailing list