]> xenbits.xensource.com Git - people/aperard/emesinae.git/commitdiff
Optionally Archive mails are receive time
authorIan Campbell <ijc@hellion.org.uk>
Sun, 13 Jan 2013 15:12:02 +0000 (15:12 +0000)
committerIan Campbell <ijc@hellion.org.uk>
Sun, 13 Jan 2013 15:12:57 +0000 (15:12 +0000)
QUEUES.txt
config.example
scripts/control.pl
scripts/insertmail.pl
scripts/receive.pl

index 848ffe5affac5e322a7cf8aa5ef251fe75fd4bd7..1d15e4705db8faca651ec6c0ef52d024f1940e3f 100644 (file)
@@ -26,4 +26,4 @@ initial temporary file.
 `<handler>` takes <SPOOL>/incoming/G<queue>.<id>:
    - Renames to <SPOOL>/incoming/P<queue>.<id>.
    - Processes incoming mail.
-   - Archives or deletes.
+   - Unlinks.
index 23d72c28e7ebdad0895a98a46d61d91b56889677..00576ab97294f7a121d3c5cc157ec87255ca10f3 100644 (file)
@@ -18,7 +18,9 @@ $c{ListDropAddress} = "smesinae-maildrop-address";    # Address subscribed to th
 $c{ListAddress} = "emesinae-test\@list.example.com";
 $c{ListAliases} = qw/emesinae-test\@list.example.org/;
 
-$c{SpoolDir} = "/var/local/emesinae/spool/";
+$c{SpoolDir}        = "/var/local/emesinae/spool/";
+$c{ArchiveIncoming} = 0;
+
 $c{LockDir}  = "/var/local/emesinae/locks/";
 
 $c{ReportingURL} = "http://bugs.example.com/Howto_Report_Bugs.html";
index ab6728b860587cf76690e5dd0ea1c470800caeff..df8a3cf887340adaadf1e9b3bad4aa30d74222e3 100755 (executable)
@@ -294,3 +294,5 @@ my $reply = genreply(@reply);
 
 # XXX send the mail
 $reply->print( \*STDOUT );
+
+unlink("incoming/P$m");
index 0a5b9ec855ebc6f3a03125785ac64cd20a02940c..856c97fe30418867e2040d1c7f8a87f859b0fe57 100755 (executable)
@@ -43,3 +43,5 @@ our $msg = Emesinae::Message->insert( $dbh, $head );
 $msg->writeraw( \@hdrs, \*M );
 
 close(M);
+
+unlink("incoming/P$m");
index 27457300c01e2dc50d538db44847cb506d5a78ac..27f423ab0bc3b1c78239714db8e8cccca1780cd0 100755 (executable)
@@ -73,6 +73,23 @@ close(FILE) || &failure("close temporary file: $!");
 my $prefix = 'I';
 rename( "T.$id", "$prefix$queue.$id" ) || &failure("rename spool message: $!");
 
+if ( $c{ArchiveIncoming} ) {
+    my $archive = sprintf( "$c{SpoolDir}/%04d-%02d/", $year + 1900, $mon + 1 );
+    eval {
+        if ( !-d $archive )
+        {
+            mkdir($archive) || die "Unable to make archive dir $archive: $!";
+        }
+        link( "$prefix$queue.$id", "$archive/$queue.$id" )
+          || die "Unable to create archive link: $!";
+    };
+    if ($@) {
+        chomp($@);
+        print STDERR "$@";
+        print STDERR "Continuing";
+    }
+}
+
 exit(0);
 
 sub failure {