chiark / gitweb /
no-cache
[nj-awaymsg.git] / AwayMsg.pm
index e20d6b6acc39f5b825a8fce78657bc45c79c4494..da9eaee94acc6b259f42856388366aac5ac2bd4e 100644 (file)
@@ -5,19 +5,26 @@ use strict;
 use warnings;
 
 use DBI;
+use Data::Dumper;
 
 BEGIN {
     use Exporter ();
     our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
     $VERSION     = 1.00;
     @ISA         = qw(Exporter);
-    @EXPORT      = qw(&db_connect &db_commit $dbh);
+    @EXPORT      = qw(db_connect db_commit www_begin
+                      $dbh);
     %EXPORT_TAGS = ( );
     @EXPORT_OK   = qw();
 }
 
 our ($dbh);
 
+sub www_begin ($$) {
+    my ($r,$m) = @_;
+    $r->header_out("Cache-Control: no-cache");
+}
+
 sub db_connect () {
     my $dbf;
     foreach my $d (@INC) {
@@ -45,10 +52,11 @@ sub nooutput ($) {
     }
 }
 
-
 sub db_commit () {
-    nooutput("SELECT * FROM addresses LEFT JOIN config USING (emailaddr)");
-    nooutput("SELECT * FROM addresses LEFT JOIN texts USING (textid)");
+    nooutput("SELECT * FROM addresses LEFT JOIN config".
+            " USING (emailaddr) WHERE forwardfile IS NULL");
+    nooutput("SELECT * FROM addresses LEFT JOIN texts".
+            " USING (textid) WHERE desc IS NULL");
     $dbh->do("COMMIT");
 }