From: David Bremner Date: Thu, 31 Jul 2008 02:23:53 +0000 (-0300) Subject: open a mailbox X-Git-Tag: 0.4~31 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=567db04c83a6dea6f6885716e159d9f9dc4c9798;p=ikiwiki.git open a mailbox --- diff --git a/IkiWiki/Plugin/mailbox.pm b/IkiWiki/Plugin/mailbox.pm index 70c2eddfd..838a6378e 100644 --- a/IkiWiki/Plugin/mailbox.pm +++ b/IkiWiki/Plugin/mailbox.pm @@ -55,24 +55,25 @@ sub preprocess (@) { #{{{ my $page=$params{page}; my $type=$params{type} || 'maildir'; + print STDERR join("\n",%params); + error("path is mandatory") if (!defined($params{path})); # note, mbox is not a directory my $dir=bestdir($page,$params{path}) || error("could not find ".$params{path}); - my $folder=Email::Folder->new($dir); + $dir = $config{srcdir} ."/" . $dir; + + return format_mailbox(path=>$dir); - - - return "mailbox plugin result"; } # }}} sub filter (@) { #{{{ my %params=@_; - - debug("mailbox plugin: path=".$params{path}); + +# debug("mailbox plugin: path=".$params{path}); return $params{content}; } # }}} @@ -200,6 +201,17 @@ sub savestate () { #{{{ debug("mailbox plugin running in savestate"); } #}}} +### The guts of the plugin +### parameters +sub format_mailbox(@){ + my %params=@_; + my $path=$params{path} || error("path parameter mandatory"); + my $header_list=$params{headers} || "subject,from"; + + my $folder=Email::Folder->new($path) || error("mailbox could not be opened"); + return join "\n", map { format(message=>$_) } $folder->messages; + +} ### Utilities diff --git a/test/out/.keep b/test/out/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/test.setup b/test/test.setup index b8f579016..5ec06b45d 100644 --- a/test/test.setup +++ b/test/test.setup @@ -115,7 +115,7 @@ use IkiWiki::Setup::Standard { # Only send cookies over SSL connections. #sslcookie => 1, # Logging settings: - #verbose => 1, + verbose => 1, syslog => 0, # To link to user pages in a subdirectory of the wiki. #userdir => "users",