From: David Bremner Date: Sat, 19 Jul 2008 23:29:51 +0000 (-0300) Subject: initial version saves to Maildir X-Git-Tag: 0.1~40 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=010357a08e9c94ca9ddea0855949986882a2a76a;p=ikiwiki.git initial version saves to Maildir --- diff --git a/filters/postal-filer.pl b/filters/postal-filer.pl index 043515141..60fdec6ee 100644 --- a/filters/postal-filer.pl +++ b/filters/postal-filer.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl use Email::Filter; -use Convert::YText 'decode_ytext'; +use Convert::YText qw(decode_ytext encode_ytext); # we need at least version 2.54 of IkiWiki for the new config api BEGIN { require IkiWiki; die unless ($IkiWiki::version >= 2.54) } @@ -27,12 +27,19 @@ my $to=$mail->to; if ($to =~ m/$prefix($Convert::YText::valid_rex)/){ my $key=decode_ytext($1); - print $key,"\n"; $mail->simple->header_set('X-IkiPostal-Key',$key); + # need to somehow escape the names. Here we use the fact that YText + # cannot have @ signs. my @path=split(qr{/},$key); + map { $_=encode_ytext($_); s/\./@/g } @path; + + my $mailbox=$maildir . "/.".join(".",@path)."/" ; + + $mail->accept($mailbox); + }; -$mail->accept("testbox"); +