From 53c43b8e92508f6ad3a38e650be39ce804c9034a Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sat, 19 Jul 2008 19:42:34 -0300 Subject: [PATCH] skeleton for postal-filer --- filters/postal-filer.pl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 filters/postal-filer.pl diff --git a/filters/postal-filer.pl b/filters/postal-filer.pl new file mode 100644 index 000000000..ac5a3a7c2 --- /dev/null +++ b/filters/postal-filer.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use Email::Filter; +use Convert::YText 'decode_ytext'; + +# we need at least version 2.54 of IkiWiki for the new config api +BEGIN { require IkiWiki; die unless ($IkiWiki::version >= 2.54) } + +use IkiWiki::Setup; +use Getopt::Long; + +my $config_file=undef; + +GetOptions('config=s'=>\$config_file); + +die "configuration file is mandatory" unless ($config_file); + +my %config=IkiWiki::Setup::load($config_file); + +my $maildir=$config{postal_maildir}; +my $prefix=$config{postal_prefix}; + +$mail=Email::Filter->new(emergency => $maildir); + +my $to=$mail->to; +if ($to =~ m/$prefix($Convert::YText::valid_rex)/){ + my $key=decode_ytext($1); + print $key; +}; + -- 2.26.2