]> git.donarmstrong.com Git - debbugs.git/blobdiff - scripts/process
Merge branch 'master' into don/processcleanup
[debbugs.git] / scripts / process
index 4d4de47d886c285ff4cfacf747d6709d418307e8..8dfd5fb04f9bb673dc2759f6d147efe54d2c511c 100755 (executable)
@@ -28,6 +28,7 @@ use Debbugs::Text qw(:templates);
 use Debbugs::Config qw(:globals :config);
 
 use Debbugs::Control qw(append_action_to_log);
+use Encode qw(encode_utf8);
 
 chdir( "$gSpoolDir" ) || die "chdir spool: $!\n";
 
@@ -49,16 +50,24 @@ if (!rename("incoming/G$nn","incoming/P$nn"))
     die "renaming to lock: $!";
 }
 
-my $baddress= 'submit' if $codeletter eq 'B';
-$baddress= 'maintonly' if $codeletter eq 'M';
-$baddress= 'quiet' if $codeletter eq 'Q';
-$baddress= 'forwarded' if $codeletter eq 'F';
-$baddress= 'done' if $codeletter eq 'D';
-$baddress= 'submitter' if $codeletter eq 'U';
-bug_list_forward($nn) if $codeletter eq 'L';
-$baddress || die "bad codeletter $codeletter";
+my %baddress = (B => 'submit',
+               M => 'maintonly',
+               Q => 'quiet',
+               F => 'forwarded',
+               D => 'done',
+               S => 'submitter',
+               L => 'list',
+              );
+if (not exists $baddress{$codeletter}) {
+    die "bad codeletter $codeletter";
+}
+my $baddress = $baddress{$codeletter};
+if ($baddress eq 'list') {
+    bug_list_forward($nn) if $codeletter eq 'L';
+}
+
 my $baddressroot= $baddress;
-$baddress= "$tryref-$baddress" if $tryref>=0;
+$baddress= "$tryref-$baddress" if $tryref >= 0;
 
 open(M,"incoming/P$nn");
 my @log=<M>;
@@ -94,7 +103,7 @@ our $newref = 0;
 
 our $brokenness = '';
 
-my $parser = new MIME::Parser;
+my $parser = MIME::Parser->new();
 mkdir "$gSpoolDir/mime.tmp", 0777;
 $parser->output_under("$gSpoolDir/mime.tmp");
 my $entity = eval { $parser->parse_data(join('',@log)) };
@@ -725,7 +734,7 @@ my $common_headers='';
 }
 if ($codeletter eq 'U') { # sent to -submitter
     &htmllog("Message", "sent on", $data->{originator}, "$gBug#$ref.");
-    &sendmessage(<<END,[$data->{originator},@resentccs],[@bccs]);
+    my $enc_msg=<<END;
 Subject: $gBug#$ref: $newsubject
 Reply-To: $replyto, $ref-quiet\@$gEmailDomain
 ${orgsender}Resent-To: $data->{originator}
@@ -735,8 +744,11 @@ Resent-Sender: $gMaintainerEmail
 X-$gProject-PR-Message: report $ref
 X-$gProject-PR-Package: $data->{package}
 X-$gProject-PR-Keywords: $data->{keywords}
-${source_pr_header}$fwd
+${source_pr_header}
 END
+    chomp $enc_msg;
+    $enc_msg = encode_utf8($enc_msg).$fwd."\n";
+    &sendmessage($enc_msg,[$data->{originator},@resentccs],[@bccs]);
 } elsif ($codeletter eq 'B') { # Sent to submit
     my $report_followup = $newref ? 'report' : 'followup';
     &htmllog($newref ? "Report" : "Information", "forwarded",
@@ -744,7 +756,7 @@ END
              "<code>$gBug#$ref</code>".
              (length($data->{package})? "; Package <code>".html_escape($data->{package})."</code>" : '').
              ".");
-    &sendmessage(<<END,["$gSubmitList\@$gListDomain",@resentccs],[@bccs]);
+    my $enc_msg=<<END;
 Subject: $gBug#$ref: $newsubject
 Reply-To: $replyto, $ref\@$gEmailDomain
 Resent-From: $header{'from'}
@@ -755,8 +767,11 @@ Resent-Sender: $gMaintainerEmail
 X-$gProject-PR-Message: $report_followup $ref
 X-$gProject-PR-Package: $data->{package}
 X-$gProject-PR-Keywords: $data->{keywords}
-${source_pr_header}$fwd
+${source_pr_header}
 END
+    chomp $enc_msg;
+    $enc_msg = encode_utf8($enc_msg).$fwd."\n";
+    &sendmessage($enc_msg,["$gSubmitList\@$gListDomain",@resentccs],[@bccs]);
 } elsif (@resentccs or @bccs) { # Quiet or Maintainer
     # D and F done far earlier; B just done - so this must be M or Q
     # We preserve whichever it was in the Reply-To (possibly adding
@@ -775,7 +790,7 @@ END
                  (length($data->{package}) ? "; Package <code>".html_escape($data->{package})."</code>" : '').
                  ".");
     }
-    &sendmessage(<<END,[@resentccs],[@bccs]);
+    my $enc_msg=<<END;
 Subject: $gBug#$ref: $newsubject
 Reply-To: $replyto, $ref-$baddressroot\@$gEmailDomain
 Resent-From: $header{'from'}
@@ -786,8 +801,11 @@ Resent-Sender: $gMaintainerEmail
 ${common_headers}X-$gProject-PR-Message: $report_followup $ref
 X-$gProject-PR-Package: $data->{package}
 X-$gProject-PR-Keywords: $data->{keywords}
-${source_pr_header}$fwd
+${source_pr_header}
 END
+    chomp $enc_msg;
+    $enc_msg = encode_utf8($enc_msg).$fwd."\n";
+    &sendmessage($enc_msg,[@resentccs],[@bccs]);
 }
 
 my $htmlbreak= length($brokenness) ? "<p>\n".html_escape($brokenness)."\n<p>\n" : '';