]> git.donarmstrong.com Git - debbugs.git/blobdiff - scripts/receive.in
[project @ 2005-02-01 07:54:59 by blarson]
[debbugs.git] / scripts / receive.in
index 3d24a3fc904ddb3f233b304c29f46b3e32f20a20..899ccd2e422939a26a430c27de467d5627311895 100755 (executable)
@@ -1,12 +1,16 @@
-#!/usr/bin/perl -w
-# $Id: receive.in,v 1.8 2000/10/10 23:39:12 joy Exp $
+#!/usr/bin/perl
+# $Id: receive.in,v 1.16 2004/01/13 18:55:53 cjwatson Exp $
 # usage: mail is piped directly into program
 
 #set umask in order to have group-writable incoming/*
-#umask 002;
+#umask(002);
 
 #load configuration file
-require( '/etc/debbugs/config' );
+$config_path = '/etc/debbugs';
+#$lib_path = '/usr/lib/debbugs';
+
+require "$config_path/config";
+$ENV{'PATH'} = '/usr/lib/debbugs:'.$ENV{'PATH'};
 
 #set source of mail delivery
 #sets any prefix needed to get mailer to add it to error mail
@@ -33,17 +37,19 @@ s/\@.*$//;
 y/A-Z/a-z/;
 
 #set up to determine command
-%withnaddressmap= ('-submit',     'B',
+%withbugaddressmap= ('-submit',     'B',
                    '',            'B',
                    '-maintonly',  'M',
                    '-quiet',      'Q',
                    '-forwarded',  'F',
-                  '-fixed',      'X',
                    '-done',       'D',
                    '-close',      'D',
+                  '-request',    'R',
                    '-submitter',  'U');
 
-%withoutnaddressmap= ('submit',     'B',
+%withpkgaddressmap= ('-request',     'R');
+
+%withoutaddressmap= ('submit',     'B',
                       'bugs',       'B',
                       'maintonly',  'M',
                       'quiet',      'Q',
@@ -57,11 +63,15 @@ y/A-Z/a-z/;
 #determine command
 if (s/^(\d{1,9})\b//) {
     $bugnumber= $1;
-    $map= $withnaddressmap{$_};
+    $map= $withbugaddressmap{$_};
     $addrrec= "$bugnumber$_";
+} elsif (s/^(\w+)-//) {
+    $bugnumber= $1;
+    $map= $withpkgaddressmap{"-$_"};
+    $addrrec= "$bugnumber-$_";
 } else {
     $bugnumber= '';
-    $map= $withoutnaddressmap{$_};
+    $map= $withoutaddressmap{$_};
     $addrrec= "$_";
 }
 
@@ -85,9 +95,9 @@ $gBadEmailPrefix (all \@$gEmailDomain.)
 $gBadEmailPrefix
 $gBadEmailPrefix For instructions via the WWW see:
 $gBadEmailPrefix   http://$gWebDomain/
-$gBadEmailPrefix   http://$gWebDomain/Reporting.html
-$gBadEmailPrefix   http://$gWebDomain/Developer.html
-$gBadEmailPrefix   http://$gWebDomain/Access.html
+$gBadEmailPrefix   http://$gWebDomain/Reporting$gHTMLSuffix
+$gBadEmailPrefix   http://$gWebDomain/Developer$gHTMLSuffix
+$gBadEmailPrefix   http://$gWebDomain/Access$gHTMLSuffix
 $gTextInstructions
 $gBadEmailPrefix For details of how to access $gBug report logs by email:
 $gBadEmailPrefix   send \`request\@$gEmailDomain' the word \`help'
@@ -111,7 +121,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);