From be9c24d186b1b994557bb18af7d66dd7809c5958 Mon Sep 17 00:00:00 2001 From: "bryce-mozilla%nextbus.com" Date: Wed, 12 May 1999 05:22:36 +0000 Subject: [PATCH] "nospam" feature. BugZilla will no longer email the person submitting the change (after all, they are right there viewing things interactively). To make this clear to everyone, print out the exact email list as each bug is processed. git-svn-id: svn://10.0.0.236/trunk@31246 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/backdoor.cgi | 2 +- .../webtools/bugzilla/createattachment.cgi | 13 +-- mozilla/webtools/bugzilla/post_bug.cgi | 10 +-- mozilla/webtools/bugzilla/process_bug.cgi | 19 ++-- mozilla/webtools/bugzilla/processmail | 89 +++++++++++-------- 5 files changed, 71 insertions(+), 62 deletions(-) diff --git a/mozilla/webtools/bugzilla/backdoor.cgi b/mozilla/webtools/bugzilla/backdoor.cgi index 0c4a013be92..dd96b631649 100755 --- a/mozilla/webtools/bugzilla/backdoor.cgi +++ b/mozilla/webtools/bugzilla/backdoor.cgi @@ -160,4 +160,4 @@ foreach my $cc (split(/,/, $::FORM{'cc'})) { } print "Created bugzilla bug $zillaid\n"; -system("./processmail $zillaid < /dev/null > /dev/null 2> /dev/null &"); +system("./processmail $zillaid"); diff --git a/mozilla/webtools/bugzilla/createattachment.cgi b/mozilla/webtools/bugzilla/createattachment.cgi index 80dff3520b8..225efc02fc5 100755 --- a/mozilla/webtools/bugzilla/createattachment.cgi +++ b/mozilla/webtools/bugzilla/createattachment.cgi @@ -97,16 +97,11 @@ What kind of file is this? my $attachid = FetchOneColumn(); AppendComment($id, $::COOKIE{"Bugzilla_login"}, "Created an attachment (id=$attachid)\n$desc\n"); - print "Your attachment has been created."; - system("./processmail $id < /dev/null > /dev/null 2> /dev/null &"); - + print "

Attachment to bug $id created

\n"; + system("./processmail $id $::COOKIE{'Bugzilla_login'}"); + print "
Go Back to BUG# $id
\n"; } +navigation_header(); - -print qq{ -

-Go back to bug $id
-Go back to the query page
-}; diff --git a/mozilla/webtools/bugzilla/post_bug.cgi b/mozilla/webtools/bugzilla/post_bug.cgi index 6ad8aff8233..e98767b1b59 100755 --- a/mozilla/webtools/bugzilla/post_bug.cgi +++ b/mozilla/webtools/bugzilla/post_bug.cgi @@ -136,12 +136,12 @@ foreach my $person (keys %ccids) { SendSQL("insert into cc (bug_id, who) values ($id, $person)"); } -print "

Changes Submitted

\n"; -print "Show BUG# $id\n"; +print "

Bug $id posted

\n"; +system("./processmail $id $::COOKIE{'Bugzilla_login'}"); +print "
Back To BUG# $id
\n"; + print "
Attach a file to this bug\n"; -print "
Back To Query Page\n"; - -system("./processmail $id < /dev/null > /dev/null 2> /dev/null &"); +navigation_header(); exit; diff --git a/mozilla/webtools/bugzilla/process_bug.cgi b/mozilla/webtools/bugzilla/process_bug.cgi index fc425a199f6..c671a90c2fe 100755 --- a/mozilla/webtools/bugzilla/process_bug.cgi +++ b/mozilla/webtools/bugzilla/process_bug.cgi @@ -226,13 +226,17 @@ SWITCH: for ($::FORM{'knob'}) { exit; } if ($::FORM{'dup_id'} == $::FORM{'id'}) { - print "Nice try. But it doesn't really make sense to mark a\n"; + print "Nice try, $::FORM{'who'}. But it doesn't really make sense to mark a\n"; print "bug as a duplicate of itself, does it?\n"; exit; } AppendComment($::FORM{'dup_id'}, $::FORM{'who'}, "*** Bug $::FORM{'id'} has been marked as a duplicate of this bug. ***"); $::FORM{'comment'} .= "\n\n*** This bug has been marked as a duplicate of $::FORM{'dup_id'} ***"; - system("./processmail $::FORM{'dup_id'} < /dev/null > /dev/null 2> /dev/null &"); + + print "

Notation added to bug $::FORM{'dup_id'}

\n"; + system("./processmail $::FORM{'dup_id'} $::FORM{'who'}"); + print "
Go To BUG# $::FORM{'dup_id'}
\n"; + last SWITCH; }; # default @@ -327,20 +331,19 @@ foreach my $id (@idlist) { } } - print "

Changes Submitted

\n"; - print "
Back To BUG# $id
\n"; - + print "

Changes to bug $id submitted

\n"; SendSQL("unlock tables"); - - system("./processmail $id < /dev/null > /dev/null 2> /dev/null &"); + system("./processmail $id $::FORM{'who'}"); + print "
Back To BUG# $id
\n"; } if (defined $::next_bug) { + print("

The next bug in your list is:\n"); $::FORM{'id'} = $::next_bug; print "


\n"; navigation_header(); do "bug_form.pl"; } else { - print "
Back To Query Page\n"; + navigation_header(); } diff --git a/mozilla/webtools/bugzilla/processmail b/mozilla/webtools/bugzilla/processmail index 3da6448e170..48eba91936e 100755 --- a/mozilla/webtools/bugzilla/processmail +++ b/mozilla/webtools/bugzilla/processmail @@ -17,8 +17,8 @@ # Corporation. Portions created by Netscape are Copyright (C) 1998 # Netscape Communications Corporation. All Rights Reserved. # -# Contributor(s): Terry Weissman - +# Contributor(s): Terry Weissman , +# Bryce Nesbitt # To recreate the shadow database, run "processmail regenerate" . @@ -32,6 +32,8 @@ $| = 1; umask(0); $::lockcount = 0; +my $regenerate = 0; +my $nametoexclude = ""; sub Lock { if ($::lockcount <= 0) { @@ -182,7 +184,7 @@ sub fixaddresses { my @result; my %seen; foreach my $i (@$list) { - if ($i ne "" && !defined $::nomail{$i} && !defined $seen{$i}) { + if ($i ne $nametoexclude && $i ne "" && !defined $::nomail{$i} && !defined $seen{$i}) { push @result, $i; $seen{$i} = 1; } @@ -200,40 +202,8 @@ sub Log { Unlock(); } - -ConnectToDatabase(); - - -Lock(); - -# foreach i [split [read_file -nonewline "okmail"] "\n"] { -# set okmail($i) 1 -# } - - - -if (open(FID, ") { - $::nomail{trim($_)} = 1; - } - close FID; -} - - -my $regenerate = 0; - -if ($ARGV[0] eq "regenerate") { - $regenerate = 1; - shift @ARGV; - SendSQL("select bug_id from bugs order by bug_id"); - my @row; - while (@row = FetchSQLData()) { - push @ARGV, $row[0]; - } - print "$#ARGV bugs to be regenerated.\n"; -} - -foreach my $i (@ARGV) { +sub ProcessOneBug { + my $i = $_[0]; my $old = "shadow/$i"; my $new = "shadow/$i.tmp.$$"; my $diffs = "shadow/$i.diffs.$$"; @@ -257,7 +227,7 @@ foreach my $i (@ARGV) { my $tolist = fixaddresses([$::bug{'assigned_to'}, $::bug{'reporter'}, $::bug{'qa_contact'}]); my $cclist = fixaddresses($::bug{'cclist'}); - my $logstr = "Bug $i changed"; + my $logstr = "Bug $i $verb"; if ($tolist ne "" || $cclist ne "") { my %substs; @@ -275,11 +245,13 @@ foreach my $i (@ARGV) { my $msg = PerformSubsts(Param("changedmail"), \%substs); if (!$regenerate) { + # Note: fixaddresses may result in a Cc: only. This seems harmless. open(SENDMAIL, "|/usr/lib/sendmail -t") || die "Can't open sendmail"; print SENDMAIL $msg; close SENDMAIL; - $logstr = "$logstr; mail sent to $tolist $cclist"; + $logstr = "$logstr; mail sent to $tolist, $cclist"; + print "Email sent to: $tolist $cclist Excluding: $nametoexclude\n"; } } unlink($diffs); @@ -292,4 +264,43 @@ foreach my $i (@ARGV) { } } +# Code starts here + +ConnectToDatabase(); +Lock(); + +if (open(FID, ") { + $::nomail{trim($_)} = 1; + } + close FID; +} + +if (($#ARGV < 0) || ($#ARGV > 1)) { + print "Usage error: processmail {bugid} {nametoexclude}\nOr: processmail regenerate\n"; + exit; +} + +# To recreate the shadow database, run "processmail regenerate" . +if ($ARGV[0] eq "regenerate") { + $regenerate = 1; + shift @ARGV; + SendSQL("select bug_id from bugs order by bug_id"); + my @regenerate_list; + while (my @row = FetchSQLData()) { + push @regenerate_list, $row[0]; + } + foreach my $i (@regenerate_list) { + ProcessOneBug($i); + } + print("\n"); + exit; +} + +if ($#ARGV == 1) { + $nametoexclude = $ARGV[1]; +} + +ProcessOneBug($ARGV[0]); + exit;