]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
open a mailbox
authorDavid Bremner <bremner@unb.ca>
Thu, 31 Jul 2008 02:23:53 +0000 (23:23 -0300)
committerDavid Bremner <bremner@unb.ca>
Thu, 31 Jul 2008 02:23:53 +0000 (23:23 -0300)
IkiWiki/Plugin/mailbox.pm
test/out/.keep [deleted file]
test/test.setup

index 70c2eddfd1302b659fa574bb00bf7cb72285e088..838a6378e43d4647abcf1b5edb6e8fcb5ee9ee6b 100644 (file)
@@ -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 (file)
index e69de29..0000000
index b8f5790167e6beba3df71a371164485aedc7ecde..5ec06b45da6e0c8f91e2ecb3cc31a88b9572b2f4 100644 (file)
@@ -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",