]> git.donarmstrong.com Git - debbugs.git/blobdiff - scripts/receive.in
* Properly handle \n line terminated emails
[debbugs.git] / scripts / receive.in
index fdede3da5ace37b086bee24ea6e45debf90febc0..eb101a4029fe5cf681c1c5f2b6fe60ceb8c62c61 100755 (executable)
@@ -1,15 +1,13 @@
 #!/usr/bin/perl
-# $Id: receive.in,v 1.15 2003/01/28 23:52:08 cjwatson Exp $
+# $Id: receive.in,v 1.17 2005/07/24 18:42:41 don Exp $
 # usage: mail is piped directly into program
 
 #set umask in order to have group-writable incoming/*
 #umask(002);
 
-#load configuration file
-$config_path = '/etc/debbugs';
-#$lib_path = '/usr/lib/debbugs';
+use Debbugs::Config qw(:globals :text);
+my $lib_path = $gLibPath;
 
-require "$config_path/config";
 $ENV{'PATH'} = '/usr/lib/debbugs:'.$ENV{'PATH'};
 
 #set source of mail delivery
@@ -28,7 +26,6 @@ if ( $gMailer eq 'exim' )
        s/\>//;
        s/\<//;
 }
-require("/etc/debbugs/text");
 
 #remove everything from @ to end of line
 s/\@.*$//;
@@ -45,7 +42,10 @@ y/A-Z/a-z/;
                    '-done',       'D',
                    '-close',      'D',
                   '-request',    'R',
-                   '-submitter',  'U');
+                   '-submitter',  'U',
+                  # Used for bug subscription
+                  #'-list-nothing-will-match-this', 'L',
+                   );
 
 %withpkgaddressmap= ('-request',     'R');
 
@@ -63,7 +63,16 @@ y/A-Z/a-z/;
 #determine command
 if (s/^(\d{1,9})\b//) {
     $bugnumber= $1;
-    $map= $withbugaddressmap{$_};
+    if (not exists $withbugaddressmap{$_} and
+/-(?:(?:un)?subscribe|subhelp|help|ignore|(?:sub(?:yes|approve|reject)
+ |unsubyes|bounce|probe|approve|reject|
+ setlistyes|setlistsilentyes).*)/x
+       ) {
+        $map = 'L';
+    }
+    else {
+        $map= $withbugaddressmap{$_};
+    }
     $addrrec= "$bugnumber$_";
 } elsif (s/^(\w+)-//) {
     $bugnumber= $1;
@@ -121,7 +130,13 @@ printf(FILE "Received: (at %s) by $gEmailDomain; %d %s %d %02d:%02d:%02d +0000\n
 while(<STDIN>) { print(FILE) || &failure("write temporary file: $!"); }
 close(FILE) || &failure("close temporary file: $!");
 
-rename("T.$id","I$queue.$id") || &failure("rename spool message: $!");
+my $prefix;
+if ($gSpamScan) {
+    $prefix = 'S';
+} else {
+    $prefix = 'I';
+}
+rename("T.$id","$prefix$queue.$id") || &failure("rename spool message: $!");
 
 exit(0);