]> git.donarmstrong.com Git - debbugs.git/blob - scripts/service.in
[project @ 2005-07-18 02:04:44 by cjwatson]
[debbugs.git] / scripts / service.in
1 #!/usr/bin/perl
2 # $Id: service.in,v 1.102 2005/07/18 02:04:44 cjwatson Exp $
3 #
4 # Usage: service <code>.nn
5 # Temps:  incoming/P<code>.nn
6
7 use File::Copy;
8 use MIME::Parser;
9 use Debbugs::MIME qw(decode_rfc1522);
10
11 $config_path = '/etc/debbugs';
12 $lib_path = '/usr/lib/debbugs';
13
14 require "$config_path/config";
15 require "$lib_path/errorlib";
16 $ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'};
17
18 chdir("$gSpoolDir") || die "chdir spool: $!\n";
19
20 # open(DEBUG,">&4");
21 open DEBUG, ">/dev/null";
22 $debug = 0;
23 umask(002);
24
25 $_=shift;
26 m/^[RC]\.\d+$/ || &quit("bad argument");
27 $control= m/C/;
28 $nn= $_;
29 if (!rename("incoming/G$nn","incoming/P$nn")) {
30     $_=$!.'';  m/no such file or directory/i && exit 0;
31     &quit("renaming to lock: $!");
32 }    
33
34 open(M,"incoming/P$nn");
35 @log=<M>;
36 @msg=@log;
37 close(M);
38
39 chomp @msg;
40
41 print "###\n",join("##\n",@msg),"\n###\n" if $debug;
42
43 my $parser = new MIME::Parser;
44 mkdir "$gSpoolDir/mime.tmp", 0777;
45 $parser->output_under("$gSpoolDir/mime.tmp");
46 my $entity = eval { $parser->parse_data(join('',@log)) };
47
48 # header and decoded body respectively
49 my (@headerlines, @bodylines);
50
51 if ($entity and $entity->head->tags) {
52     @headerlines = @{$entity->head->header};
53     chomp @headerlines;
54
55     my $entity_body = getmailbody($entity);
56     @bodylines = $entity_body ? $entity_body->as_lines() : ();
57     chomp @bodylines;
58 } else {
59     # Legacy pre-MIME code, kept around in case MIME::Parser fails.
60     my $i;
61     for ($i = 0; $i <= $#msg; $i++) {
62         $_ = $msg[$i];
63         last unless length($_);
64         while ($msg[$i+1] =~ m/^\s/) {
65             $i++;
66             $_ .= "\n".$msg[$i];
67         }
68         push @headerlines, $_;
69     }
70
71     @bodylines = @msg[$i..$#msg];
72 }
73
74 for (@headerlines) {
75     s/\n\s/ /g;
76     print ">$_<\n" if $debug;
77     if (s/^(\S+):\s*//) {
78         my $v = lc $1;
79         print ">$v=$_<\n" if $debug;
80         $header{$v} = decode_rfc1522($_);
81     } else {
82         print "!>$_<\n" if $debug;
83     }
84 }
85
86 # Strip off RFC2440-style PGP clearsigning.
87 if (@bodylines and $bodylines[0] =~ /^-----BEGIN PGP SIGNED/) {
88     shift @bodylines while @bodylines and length $bodylines[0];
89     shift @bodylines while @bodylines and $bodylines[0] !~ /\S/;
90     for my $findsig (0 .. $#bodylines) {
91         if ($bodylines[$findsig] =~ /^-----BEGIN PGP SIGNATURE/) {
92             $#bodylines = $findsig - 1;
93             last;
94         }
95     }
96     map { s/^- // } @bodylines;
97 }
98
99 grep(s/\s+$//,@bodylines);
100
101 print "***\n",join("\n",@bodylines),"\n***\n" if $debug;
102
103 if (defined $header{'resent-from'} && !defined $header{'from'}) {
104     $header{'from'} = $header{'resent-from'};
105 }
106
107 defined($header{'from'}) || &quit("no From header");
108
109 delete $header{'reply-to'} 
110         if ( defined($header{'reply-to'}) && $header{'reply-to'} =~ m/^\s*$/ );
111
112 if ( defined($header{'reply-to'}) && $header{'reply-to'} ne "" ) {
113     $replyto = $header{'reply-to'};
114 } else {
115     $replyto = $header{'from'};
116 }
117
118 $controlrequestaddr= $control ? "control\@$gEmailDomain" : "request\@$gEmailDomain";
119 $transcript='';
120 &transcript("Processing commands for $controlrequestaddr:\n\n");
121
122 $dl= 0;
123 $state= 'idle';
124 $lowstate= 'idle';
125 $mergelowstate= 'idle';
126 $midix=0;    
127 $extras="";
128
129 my $quickabort = 0;
130
131 my $fuckheads = "(" . join("|", @gFuckheads) . ")";
132 if (@gFuckheads and $replyto =~ m/$fuckheads/) {
133         &transcript("This service is unavailable.\n\n");
134         $quickabort = 1;
135 }
136
137 my %limit_pkgs = ();
138 my %clonebugs = ();
139 my @bcc = ();
140
141 sub addbcc {
142     push @bcc, $_[0] unless grep { $_ eq $_[0] } @bcc;
143 }
144
145 for ($procline=0; $procline<=$#bodylines; $procline++) {
146     $state eq 'idle' || print "$state ?\n";
147     $lowstate eq 'idle' || print "$lowstate ?\n";
148     $mergelowstate eq 'idle' || print "$mergelowstate ?\n";
149     if ($quickabort) {
150          &transcript("Stopping processing here.\n\n");
151          last;
152     }
153     $_= $bodylines[$procline]; s/\s+$//;
154     next unless m/\S/;
155     &transcript("> $_\n");
156     next if m/^\s*\#/;
157     $action= '';
158     if (m/^stop/i || m/^quit/i || m/^--/ || m/^thank/i) {
159         &transcript("Stopping processing here.\n\n");
160         last;
161     } elsif (m/^debug\s+(\d+)$/i && $1 >= 0 && $1 <= 1000) {
162         $dl= $1+0;
163         &transcript("Debug level $dl.\n\n");
164     } elsif (m/^(send|get)\s+\#?(\d{2,})$/i) {
165         $ref= $2+0;
166         &sendlynxdoc("bugreport.cgi?bug=$ref","logs for $gBug#$ref");
167     } elsif (m/^send-detail\s+\#?(\d{2,})$/i) {
168         $ref= $1+0;
169         &sendlynxdoc("bugreport.cgi?bug=$ref&boring=yes",
170                      "detailed logs for $gBug#$ref");
171     } elsif (m/^index(\s+full)?$/i) {
172         &transcript("This BTS function is currently disabled, sorry.\n\n");
173         $ok++; # well, it's not really ok, but it fixes #81224 :)
174     } elsif (m/^index-summary\s+by-package$/i) {
175         &transcript("This BTS function is currently disabled, sorry.\n\n");
176         $ok++; # well, it's not really ok, but it fixes #81224 :)
177     } elsif (m/^index-summary(\s+by-number)?$/i) {
178         &transcript("This BTS function is currently disabled, sorry.\n\n");
179         $ok++; # well, it's not really ok, but it fixes #81224 :)
180     } elsif (m/^index(\s+|-)pack(age)?s?$/i) {
181         &sendlynxdoc("pkgindex.cgi?indexon=pkg",'index of packages');
182     } elsif (m/^index(\s+|-)maints?$/i) {
183         &sendlynxdoc("pkgindex.cgi?indexon=maint",'index of maintainers');
184     } elsif (m/^index(\s+|-)maint\s+(\S+)$/i) {
185         $maint = $2;
186         &sendlynxdoc("pkgreport.cgi?maint=" . urlsanit($maint),
187                      "$gBug list for maintainer \`$maint'");
188         $ok++;
189     } elsif (m/^index(\s+|-)pack(age)?s?\s+(\S.*\S)$/i) {
190         $package = $+;
191         &sendlynxdoc("pkgreport.cgi?pkg=" . urlsanit($package),
192                      "$gBug list for package $package");
193         $ok++;
194     } elsif (m/^send-unmatched(\s+this|\s+-?0)?$/i) {
195         &transcript("This BTS function is currently disabled, sorry.\n\n");
196         $ok++; # well, it's not really ok, but it fixes #81224 :)
197     } elsif (m/^send-unmatched\s+(last|-1)$/i) {
198         &transcript("This BTS function is currently disabled, sorry.\n\n");
199         $ok++; # well, it's not really ok, but it fixes #81224 :)
200     } elsif (m/^send-unmatched\s+(old|-2)$/i) {
201         &transcript("This BTS function is currently disabled, sorry.\n\n");
202         $ok++; # well, it's not really ok, but it fixes #81224 :)
203     } elsif (m/^getinfo\s+([\w-.]+)$/i) {
204         # the following is basically a Debian-specific kludge, but who cares
205         $req = $1;
206         if ($req =~ /^maintainers$/i && -f "$gConfigDir/Maintainers") {
207             &sendinfo("local", "$gConfigDir/Maintainers", "Maintainers file");
208         } elsif ($req =~ /^override\.(\w+)\.([\w-.]+)$/i) {
209             $req =~ s/.gz$//;
210             &sendinfo("ftp.d.o", "$req", "override file for $2 part of $1 distribution");
211         } elsif ($req =~ /^pseudo-packages\.(description|maintainers)$/i && -f "$gConfigDir/$req") {
212             &sendinfo("local", "$gConfigDir/$req", "$req file");
213         } else {
214             &transcript("Info file $req does not exist.\n\n");
215         }
216     } elsif (m/^help/i) {
217         &sendhelp;
218         &transcript("\n");
219         $ok++;
220     } elsif (m/^refcard/i) {
221         &sendtxthelp("bug-mailserver-refcard.txt","mail servers' reference card");
222     } elsif (m/^subscribe/i) {
223         &transcript(<<END);
224 There is no $gProject $gBug mailing list.  If you wish to review bug reports
225 please do so via http://$gWebDomain/ or ask this mail server
226 to send them to you.
227 soon: MAILINGLISTS_TEXT
228 END
229     } elsif (m/^unsubscribe/i) {
230         &transcript(<<END);
231 soon: UNSUBSCRIBE_TEXT
232 soon: MAILINGLISTS_TEXT
233 END
234     } elsif (!$control) {
235         &transcript(<<END);
236 Unknown command or malformed arguments to command.
237 (Use control\@$gEmailDomain to manipulate reports.)
238
239 END
240         if (++$unknowns >= 3) {
241             &transcript("Too many unknown commands, stopping here.\n\n");
242             last;
243         }
244 #### interesting ones start here
245     } elsif (m/^close\s+\#?(-?\d+)(?:\s+(\d.*))?$/i) {
246         $ok++;
247         $ref= $1;
248         $version= $2;
249         if (&setbug) {
250             &transcript("'close' is deprecated; see http://$gWebDomain/Developer$gHTMLSuffix#closing.\n");
251             if (length($data->{done}) and not defined($version)) {
252                 &transcript("$gBug is already closed, cannot re-close.\n\n");
253                 &nochangebug;
254             } else {
255                 $action= "$gBug " .
256                     (defined($version) ?
257                         "marked as fixed in version $version" :
258                         "closed") .
259                     ", send any further explanations to $data->{originator}";
260                 do {
261                     &addmaintainers($data);
262                                         if ( length( $gDoneList ) > 0 && length( $gListDomain ) >
263                                         0 ) { &addccaddress("$gDoneList\@$gListDomain"); }
264                     $data->{done}= $replyto;
265                     my @keywords= split ' ', $data->{keywords};
266                     if (grep $_ eq 'pending', @keywords) {
267                         $extramessage= "Removed pending tag.\n";
268                         $data->{keywords}= join ' ', grep $_ ne 'pending',
269                                                 @keywords;
270                     }
271                     addfixedversions($data, undef, $version);
272
273                     $message= <<END;
274 From: $gMaintainerEmail ($gProject $gBug Tracking System)
275 To: $data->{originator}
276 Subject: $gBug#$ref acknowledged by developer
277          ($header{'subject'})
278 References: $header{'message-id'} $data->{msgid}
279 In-Reply-To: $data->{msgid}
280 Message-ID: <handler.$ref.$nn.notifdonectrl.$midix\@$gEmailDomain>
281 Reply-To: $ref\@$gEmailDomain
282 X-$gProject-PR-Message: they-closed-control $ref
283
284 This is an automatic notification regarding your $gBug report
285 #$ref: $data->{subject},
286 which was filed against the $data->{package} package.
287
288 It has been marked as closed by one of the developers, namely
289 $replyto.
290
291 You should be hearing from them with a substantive response shortly,
292 in case you haven't already. If not, please contact them directly.
293
294 $gMaintainer
295 (administrator, $gProject $gBugs database)
296
297 END
298                     &sendmailmessage($message,$data->{originator});
299                 } while (&getnextbug);
300             }
301         }
302     } elsif (m/^reassign\s+\#?(-?\d+)\s+(\S+)(?:\s+(\d.*))?$/i) {
303         $ok++;
304         $ref= $1; $newpackage= $2;
305         $version= $3;
306         $newpackage =~ y/A-Z/a-z/;
307         if (&setbug) {
308             if (length($data->{package})) {
309                 $action= "$gBug reassigned from package \`$data->{package}'".
310                          " to \`$newpackage'.";
311             } else {
312                 $action= "$gBug assigned to package \`$newpackage'.";
313             }
314             do {
315                 &addmaintainers($data);
316                 $data->{package}= $newpackage;
317                 $data->{found_versions}= [];
318                 $data->{fixed_versions}= [];
319                 # TODO: what if $newpackage is a source package?
320                 addfoundversions($data, undef, $version) if defined $version;
321                 &addmaintainers($data);
322             } while (&getnextbug);
323         }
324     } elsif (m/^reopen\s+\#?(-?\d+)$/i ? ($noriginator='', 1) :
325              m/^reopen\s+\#?(-?\d+)\s+\=$/i ? ($noriginator='', 1) :
326              m/^reopen\s+\#?(-?\d+)\s+\!$/i ? ($noriginator=$replyto, 1) :
327              m/^reopen\s+\#?(-?\d+)\s+(\S.*\S)$/i ? ($noriginator=$2, 1) : 0) {
328         $ok++;
329         $ref= $1;
330         if (&setbug) {
331             if (@{$data->{fixed_versions}}) {
332                 &transcript("'reopen' is deprecated when a bug has been closed with a version;\nuse 'found' or 'submitter' as appropriate instead.\n");
333             }
334             if (!length($data->{done})) {
335                 &transcript("$gBug is already open, cannot reopen.\n\n");
336                 &nochangebug;
337             } else {
338                 $action=
339                     $noriginator eq '' ? "$gBug reopened, originator not changed." :
340                         "$gBug reopened, originator set to $noriginator.";
341                 do {
342                     &addmaintainers($data);
343                     $data->{originator}= $noriginator eq '' ?  $data->{originator} : $noriginator;
344                     $data->{fixed_versions}= [];
345                     $data->{done}= '';
346                 } while (&getnextbug);
347             }
348         }
349     } elsif (m/^found\s+\#?(-?\d+)(?:\s+(\d.*))?$/i) {
350         $ok++;
351         $ref= $1;
352         $version= $2;
353         if (&setbug) {
354             if (!length($data->{done})) {
355                 &transcript("$gBug is already open, cannot reopen.\n\n");
356                 &nochangebug;
357             } else {
358                 $action=
359                     defined($version) ?
360                         "$gBug marked as found in version $version." :
361                         "$gBug reopened.";
362                 do {
363                     &addmaintainers($data);
364                     # The 'done' field gets a bit weird with version
365                     # tracking, because a bug may be closed by multiple
366                     # people in different branches. Until we have something
367                     # more flexible, we set it every time a bug is fixed,
368                     # and clear it precisely when a found command is
369                     # received for the rightmost fixed-in version, which
370                     # equates to the most recent fixing of the bug, or when
371                     # a versionless found command is received.
372                     if (defined $version) {
373                         my $lastfixed =
374                             (reverse @{$data->{fixed_versions}})[0];
375                         # TODO: what if $data->{package} is a source package?
376                         addfoundversions($data, undef, $version);
377                         if (defined $lastfixed and $version eq $lastfixed) {
378                             $data->{done} = '';
379                         }
380                     } else {
381                         # Versionless found; assume old-style "not fixed at
382                         # all".
383                         $data->{fixed_versions} = [];
384                         $data->{done} = '';
385                     }
386                 } while (&getnextbug);
387             }
388         }
389     } elsif (m/^submitter\s+\#?(-?\d+)\s+\!$/i ? ($newsubmitter=$replyto, 1) :
390              m/^submitter\s+\#?(-?\d+)\s+(\S.*\S)$/i ? ($newsubmitter=$2, 1) : 0) {
391         $ok++;
392         $ref= $1;
393         if ($ref =~ m/^-\d+$/ && defined $clonebugs{$ref}) {
394             $ref = $clonebugs{$ref};
395         }
396         if (&getbug) {
397             if (&checkpkglimit) {
398                 &foundbug;
399                 &addmaintainers($data);
400                 $oldsubmitter= $data->{originator};
401                 $data->{originator}= $newsubmitter;
402                 $action= "Changed $gBug submitter from $oldsubmitter to $newsubmitter.";
403                 &savebug;
404                 &transcript("$action\n");
405                 if (length($data->{done})) {
406                     &transcript("(By the way, that $gBug is currently marked as done.)\n");
407                 }
408                 &transcript("\n");
409                 $message= <<END;
410 From: $gMaintainerEmail ($gProject $gBug Tracking System)
411 To: $oldsubmitter
412 Subject: $gBug#$ref submitter address changed
413          ($header{'subject'})
414 References: $header{'message-id'} $data->{msgid}
415 In-Reply-To: $data->{msgid}
416 Message-ID: <handler.$ref.$nn.newsubmitter.$midix\@$gEmailDomain>
417 Reply-To: $ref\@$gEmailDomain
418 X-$gProject-PR-Message: submitter-changed $ref
419
420 The submitter address recorded for your $gBug report
421 #$ref: $data->{subject}
422 has been changed.
423
424 The new submitter address for this report is
425 $newsubmitter.
426
427 This change was made by
428 $replyto.
429 If it was incorrect, please contact them directly.
430
431 $gMaintainer
432 (administrator, $gProject $gBugs database)
433
434 END
435                 &sendmailmessage($message,$oldsubmitter);
436             } else {
437                 &cancelbug;
438             }
439         } else {
440             &notfoundbug;
441         }
442     } elsif (m/^forwarded\s+\#?(-?\d+)\s+(\S.*\S)$/i) {
443         $ok++;
444         $ref= $1; $whereto= $2;
445         if (&setbug) {
446             if (length($data->{forwarded})) {
447     $action= "Forwarded-to-address changed from $data->{forwarded} to $whereto.";
448             } else {
449     $action= "Noted your statement that $gBug has been forwarded to $whereto.";
450             }
451             if (length($data->{done})) {
452                 $extramessage= "(By the way, this $gBug is currently marked as done.)\n";
453             }
454             do {
455                 &addmaintainers($data);
456                 if (length($gForwardList)>0 && length($gListDomain)>0 ) {
457                      &addccaddress("$gForwardList\@$gListDomain"); 
458                 }
459                 $data->{forwarded}= $whereto;
460             } while (&getnextbug);
461         }
462     } elsif (m/^notforwarded\s+\#?(-?\d+)$/i) {
463         $ok++;
464         $ref= $1;
465         if (&setbug) {
466             if (!length($data->{forwarded})) {
467                 &transcript("$gBug is not marked as having been forwarded.\n\n");
468                 &nochangebug;
469             } else {
470     $action= "Removed annotation that $gBug had been forwarded to $data->{forwarded}.";
471                 do {
472                     &addmaintainers($data);
473                     $data->{forwarded}= '';
474                 } while (&getnextbug);
475             }
476         }
477     } elsif (m/^severity\s+\#?(-?\d+)\s+([-0-9a-z]+)$/i ||
478         m/^priority\s+\#?(-?\d+)\s+([-0-9a-z]+)$/i) {
479         $ok++;
480         $ref= $1;
481         $newseverity= $2;
482         if (!grep($_ eq $newseverity, @gSeverityList, "$gDefaultSeverity")) {
483             &transcript("Severity level \`$newseverity' is not known.\n".
484                         "Recognized are: $gShowSeverities.\n\n");
485         } elsif (exists $gObsoleteSeverities{$newseverity}) {
486             &transcript("Severity level \`$newseverity' is obsolete. " .
487                         "$gObsoleteSeverities{$newseverity}\n\n");
488         } elsif (&setbug) {
489             $printseverity= $data->{severity};
490             $printseverity= "$gDefaultSeverity" if $printseverity eq '';
491             $action= "Severity set to \`$newseverity'.";
492             do {
493                 &addmaintainers($data);
494                 if (defined $gStrongList and isstrongseverity($newseverity)) {
495                     addbcc("$gStrongList\@$gListDomain");
496                 }
497                 $data->{severity}= $newseverity;
498             } while (&getnextbug);
499         }
500     } elsif (m/^tags?\s+\#?(-?\d+)\s+(([=+-])\s*)?(\S.*)?$/i) {
501         $ok++;
502         $ref = $1; $addsubcode = $3; $tags = $4;
503         $addsub = "add";
504         if (defined $addsubcode) {
505             $addsub = "sub" if ($addsubcode eq "-");
506             $addsub = "add" if ($addsubcode eq "+");
507             $addsub = "set" if ($addsubcode eq "=");
508         }
509         my @okaytags = ();
510         my @badtags = ();
511         foreach my $t (split /[\s,]+/, $tags) {
512             if (!grep($_ eq $t, @gTags)) {
513                 push @badtags, $t;
514             } else {
515                 push @okaytags, $t;
516             }
517         }
518         if (@badtags) {
519             &transcript("Unknown tag/s: ".join(', ', @badtags).".\n".
520                         "Recognized are: ".join(' ', @gTags).".\n\n");
521         }
522         if (&setbug) {
523             if ($data->{keywords} eq '') {
524                 &transcript("There were no tags set.\n");
525             } else {
526                 &transcript("Tags were: $data->{keywords}\n");
527             }
528             if ($addsub eq "set") {
529                 $action= "Tags set to: " . join(", ", @okaytags);
530             } elsif ($addsub eq "add") {
531                 $action= "Tags added: " . join(", ", @okaytags);
532             } elsif ($addsub eq "sub") {
533                 $action= "Tags removed: " . join(", ", @okaytags);
534             }
535             do {
536                 &addmaintainers($data);
537                 $data->{keywords} = '' if ($addsub eq "set");
538                 # Allow removing obsolete tags.
539                 if ($addsub eq "sub") {
540                     foreach my $t (@badtags) {
541                         $data->{keywords} = join ' ', grep $_ ne $t, 
542                             split ' ', $data->{keywords};
543                     }
544                 }
545                 # Now process all other additions and subtractions.
546                 foreach my $t (@okaytags) {
547                     $data->{keywords} = join ' ', grep $_ ne $t, 
548                         split ' ', $data->{keywords};
549                     $data->{keywords} = "$t $data->{keywords}" unless($addsub eq "sub");
550                 }
551                 $data->{keywords} =~ s/\s*$//;
552             } while (&getnextbug);
553         }
554     } elsif (m/^retitle\s+\#?(-?\d+)\s+(\S.*\S)\s*$/i) {
555         $ok++;
556         $ref= $1; $newtitle= $2;
557         if ($ref =~ m/^-\d+$/ && defined $clonebugs{$ref}) {
558             $ref = $clonebugs{$ref};
559         }
560         if (&getbug) {
561             if (&checkpkglimit) {
562                 &foundbug;
563                 &addmaintainers($data);
564                 $data->{subject}= $newtitle;
565                 $action= "Changed $gBug title.";
566                 &savebug;
567                 &transcript("$action\n");
568                 if (length($data->{done})) {
569                     &transcript("(By the way, that $gBug is currently marked as done.)\n");
570                 }
571                 &transcript("\n");
572             } else {
573                 &cancelbug;
574             }
575         } else {
576             &notfoundbug;
577         }
578     } elsif (m/^unmerge\s+\#?(-?\d+)$/i) {
579         $ok++;
580         $ref= $1;
581         if (&setbug) {
582             if (!length($data->{mergedwith})) {
583                 &transcript("$gBug is not marked as being merged with any others.\n\n");
584                 &nochangebug;
585             } else {
586                 $mergelowstate eq 'locked' || die "$mergelowstate ?";
587                 $action= "Disconnected #$ref from all other report(s).";
588                 @newmergelist= split(/ /,$data->{mergedwith});
589                 $discref= $ref;
590                 do {
591                     &addmaintainers($data);
592                     $data->{mergedwith}= ($ref == $discref) ? ''
593                         : join(' ',grep($_ ne $ref,@newmergelist));
594                 } while (&getnextbug);
595             }
596         }
597     } elsif (m/^merge\s+#?(-?\d+(\s+#?-?\d+)+)\s*$/i) {
598         $ok++;
599         @tomerge= sort { $a <=> $b } split(/\s+#?/,$1);
600         @newmergelist= ();
601         my %tags = ();
602         &getmerge;
603         while (defined($ref= shift(@tomerge))) {
604             &transcript("D| checking merge $ref\n") if $dl;
605             $ref+= 0;
606             if ($ref =~ m/^-\d+$/ && defined $clonebugs{$ref}) {
607                 $ref = $clonebugs{$ref};
608             }
609             next if grep($_ eq $ref,@newmergelist);
610             if (!&getbug) { &notfoundbug; @newmergelist=(); last }
611             if (!&checkpkglimit) { &cancelbug; @newmergelist=(); last; }
612             &foundbug;
613             &transcript("D| adding $ref ($data->{mergedwith})\n") if $dl;
614             $mismatch= '';
615             &checkmatch('package','m_package',$data->{package});
616             &checkmatch('forwarded addr','m_forwarded',$data->{forwarded});
617             $data->{severity} = '$gDefaultSeverity' if $data->{severity} eq '';
618             &checkmatch('severity','m_severity',$data->{severity});
619             &checkmatch('done mark','m_done',length($data->{done}) ? 'done' : 'open');
620             &checkmatch('owner','m_owner',$data->{owner});
621             foreach my $t (split /\s+/, $data->{keywords}) { $tags{$t} = 1; }
622             if (length($mismatch)) {
623                 &transcript("Mismatch - only $gBugs in same state can be merged:\n".
624                             $mismatch."\n");
625                 &cancelbug; @newmergelist=(); last;
626             }
627             push(@newmergelist,$ref);
628             push(@tomerge,split(/ /,$data->{mergedwith}));
629             &cancelbug;
630         }
631         if (@newmergelist) {
632             @newmergelist= sort { $a <=> $b } @newmergelist;
633             $action= "Merged @newmergelist.";
634             for $ref (@newmergelist) {
635                 &getbug || die "huh ?  $gBug $ref disappeared during merge";
636                 &addmaintainers($data);
637                 $data->{mergedwith}= join(' ',grep($_ ne $ref,@newmergelist));
638                 $data->{keywords}= join(' ', keys %tags);
639                 &savebug;
640             }
641             &transcript("$action\n\n");
642         }
643         &endmerge;
644     } elsif (m/^clone\s+#?(\d+)\s+((-\d+\s+)*-\d+)\s*$/i) {
645         $ok++;
646
647         $origref = $1;
648         @newclonedids = split /\s+/, $2;
649         $newbugsneeded = scalar(@newclonedids);
650
651         $ref = $origref;
652         if (&setbug) {
653             if (length($data->{mergedwith})) {
654                 &transcript("$gBug is marked as being merged with others.\n\n");
655                 &nochangebug;
656             } else {
657                 &filelock("nextnumber.lock");
658                 open(N,"nextnumber") || &quit("nextnumber: read: $!");
659                 $v=<N>; $v =~ s/\n$// || &quit("nextnumber bad format");
660                 $firstref= $v+0;  $v += $newbugsneeded;
661                 open(NN,">nextnumber"); print NN "$v\n"; close(NN);
662                 &unfilelock;
663
664                 $lastref = $firstref + $newbugsneeded - 1;
665
666                 if ($newbugsneeded == 1) {
667                     $action= "$gBug $origref cloned as bug $firstref.";
668                 } else {
669                     $action= "$gBug $origref cloned as bugs $firstref-$lastref.";
670                 }
671                 &getnextbug;
672                 my $ohash = get_hashname($origref);
673                 $ref = $firstref;
674                 for $newclonedid (@newclonedids) {
675                     $clonebugs{$newclonedid} = $ref;
676             
677                     my $hash = get_hashname($ref);
678                     copy("db-h/$ohash/$origref.log", "db-h/$hash/$ref.log");
679                     copy("db-h/$ohash/$origref.status", "db-h/$hash/$ref.status");
680                     copy("db-h/$ohash/$origref.summary", "db-h/$hash/$ref.summary");
681                     copy("db-h/$ohash/$origref.report", "db-h/$hash/$ref.report");
682                     &bughook('new', $ref, $data);
683
684                     $ref++;
685                 }
686             }
687         }
688     } elsif (m/^package\s+(\S.*\S)?\s*$/i) {
689         $ok++;
690         my @pkgs = split /\s+/, $1;
691         if (scalar(@pkgs) > 0) {
692                 %limit_pkgs = map { ($_, 1) } @pkgs;
693                 &transcript("Ignoring bugs not assigned to: " . 
694                         join(" ", keys(%limit_pkgs)) . "\n\n");
695         } else {
696                 %limit_pkgs = ();
697                 &transcript("Not ignoring any bugs.\n\n");
698         }
699     } elsif (m/^owner\s+\#?(-?\d+)\s+!$/i ? ($newowner = $replyto, 1) :
700              m/^owner\s+\#?(-?\d+)\s+(\S.*\S)$/i ? ($newowner = $2, 1) : 0) {
701         $ok++;
702         $ref = $1;
703         if (&setbug) {
704             if (length $data->{owner}) {
705                 $action = "Owner changed from $data->{owner} to $newowner.";
706             } else {
707                 $action = "Owner recorded as $newowner.";
708             }
709             if (length $data->{done}) {
710                 $extramessage = "(By the way, this $gBug is currently " .
711                                 "marked as done.)\n";
712             }
713             do {
714                 &addmaintainers($data);
715                 $data->{owner} = $newowner;
716             } while (&getnextbug);
717         }
718     } elsif (m/^noowner\s+\#?(-?\d+)$/i) {
719         $ok++;
720         $ref = $1;
721         if (&setbug) {
722             if (length $data->{owner}) {
723                 $action = "Removed annotation that $gBug was owned by " .
724                           "$data->{owner}.";
725                 do {
726                     &addmaintainers($data);
727                     $data->{owner} = '';
728                 } while (&getnextbug);
729             } else {
730                 &transcript("$gBug is not marked as having an owner.\n\n");
731                 &nochangebug;
732             }
733         }
734     } else {
735         &transcript("Unknown command or malformed arguments to command.\n\n");
736         if (++$unknowns >= 5) {
737             &transcript("Too many unknown commands, stopping here.\n\n");
738             last;
739         }
740     }
741 }
742 if ($procline>$#bodylines) {
743     &transcript(">\nEnd of message, stopping processing here.\n\n");
744 }
745 if (!$ok && !quickabort) {
746     &transcript("No commands successfully parsed; sending the help text(s).\n");
747     &sendhelp;
748     &transcript("\n");
749 }
750
751 &transcript("MC\n") if $dl>1;
752 @maintccs= ();
753 for $maint (keys %maintccreasons) {
754 &transcript("MM|$maint|\n") if $dl>1;
755     next if $maint eq $replyto;
756     $reasonstring= '';
757     $reasonsref= $maintccreasons{$maint};
758 &transcript("MY|$maint|\n") if $dl>2;
759     for $p (sort keys %$reasonsref) {
760 &transcript("MP|$p|\n") if $dl>2;
761         $reasonstring.= ', ' if length($reasonstring);
762         $reasonstring.= $p.' ' if length($p);
763         $reasonstring.= join(' ',map("#$_",sort keys %{$$reasonsref{$p}}));
764     }
765     if (length($reasonstring) > 40) {
766         (substr $reasonstring, 37) = "...";
767     }
768     $reasonstring = "" if (!defined($reasonstring));
769     push(@maintccs,"$maint ($reasonstring)");
770     push(@maintccaddrs,"$maint");
771 }
772
773 $maintccs = ""; 
774 if (@maintccs) {
775     &transcript("MC|@maintccs|\n") if $dl>2;
776     $maintccs .= "Cc: " . join(",\n    ",@maintccs) . "\n";
777 }
778
779 if (!defined $header{'subject'} || $header{'subject'} eq "") {
780   $header{'subject'} = "your mail";
781 }
782
783 $reply= <<END;
784 From: $gMaintainerEmail ($gProject $gBug Tracking System)
785 To: $replyto
786 ${maintccs}Subject: Processed: $header{'subject'}
787 In-Reply-To: $header{'message-id'}
788 References: $header{'message-id'}
789 Message-ID: <handler.s.$nn.transcript\@$gEmailDomain>
790 Precedence: bulk
791 X-$gProject-PR-Message: transcript
792
793 ${transcript}Please contact me if you need assistance.
794
795 $gMaintainer
796 (administrator, $gProject $gBugs database)
797 $extras
798 END
799
800 $repliedshow= join(', ',$replyto,@maintccaddrs);
801 &filelock("lock/-1");
802 open(AP,">>db-h/-1.log") || &quit("open db-h/-1.log: $!");
803 print(AP
804       "\2\n$repliedshow\n\5\n$reply\n\3\n".
805       "\6\n".
806       "<strong>Request received</strong> from <code>".
807       &sani($header{'from'})."</code>\n".
808       "to <code>".&sani($controlrequestaddr)."</code>\n".
809       "\3\n".
810       "\7\n",@{escapelog(@log)},"\n\3\n") || &quit("writing db-h/-1.log: $!");
811 close(AP) || &quit("open db-h/-1.log: $!");
812 &unfilelock;
813 utime(time,time,"db-h");
814
815 &sendmailmessage($reply,$replyto,@maintccaddrs,@bcc);
816
817 unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!");
818
819 sub sendmailmessage {
820     local ($message,@recips) = @_;
821     $message = "X-Loop: $gMaintainerEmail\n" . $message;
822     print "mailing to >@recips<\n" if $debug;
823     $c= open(D,"|-");
824     defined($c) || &quit("mailing forking for sendmail: $!");
825     if (!$c) { # ie, we are the child process
826         exec '/usr/lib/sendmail','-f'."$gMaintainerEmail",'-odb','-oem','-oi',get_addresses(@recips);
827         die $!;
828     }
829     print(D $message) || &quit("writing to sendmail process: $!");
830     $!=0; close(D); $? && &quit("sendmail gave exit status $? ($!)");
831     $midix++;
832 }
833
834 sub sendhelp {
835         &sendtxthelpraw("bug-log-mailserver.txt","instructions for request\@$gEmailDomain");
836         &sendtxthelpraw("bug-maint-mailcontrol.txt","instructions for control\@$gEmailDomain")
837             if $control;
838 }
839
840 #sub unimplemented {
841 #    &transcript("Sorry, command $_[0] not yet implemented.\n\n");
842 #}
843
844 sub checkmatch {
845     local ($string,$mvarname,$svarvalue) = @_;
846     local ($mvarvalue);
847     if (@newmergelist) {
848         eval "\$mvarvalue= \$$mvarname";
849         &transcript("D| checkmatch \`$string' /$mvarname/$mvarvalue/$svarvalue/\n")
850             if $dl;
851         $mismatch .=
852             "Values for \`$string' don't match:\n".
853             " #$newmergelist[0] has \`$mvarvalue';\n".
854             " #$ref has \`$svarvalue'\n"
855             if $mvarvalue ne $svarvalue;
856     } else {
857         &transcript("D| setupmatch \`$string' /$mvarname/$svarvalue/\n")
858             if $dl;
859         eval "\$$mvarname= \$svarvalue";
860     }
861 }
862
863 sub checkpkglimit {
864     if (keys %limit_pkgs and not defined $limit_pkgs{$data->{package}}) {
865         &transcript("$gBug number $ref belongs to package $data->{package}, skipping.\n\n");
866         return 0;
867     }
868     return 1;
869 }
870
871 # High-level bug manipulation calls
872 # Do announcements themselves
873 #
874 # Possible calling sequences:
875 #    setbug (returns 0)
876 #    
877 #    setbug (returns 1)
878 #    &transcript(something)
879 #    nochangebug
880 #
881 #    setbug (returns 1)
882 #    $action= (something)
883 #    do {
884 #      (modify s_* variables)
885 #    } while (getnextbug);
886
887 sub nochangebug {
888     &dlen("nochangebug");
889     $state eq 'single' || $state eq 'multiple' || die "$state ?";
890     &cancelbug;
891     &endmerge if $manybugs;
892     $state= 'idle';
893     &dlex("nochangebug");
894 }
895
896 sub setbug {
897     &dlen("setbug $ref");
898     if ($ref =~ m/^-\d+/) {
899         if (!defined $clonebugs{$ref}) {
900             &notfoundbug;
901             &dlex("setbug => noclone");
902             return 0;
903         }
904         $ref = $clonebugs{$ref};
905     }
906     $state eq 'idle' || die "$state ?";
907     if (!&getbug) {
908         &notfoundbug;
909         &dlex("setbug => 0s");
910         return 0;
911     }
912
913     if (!&checkpkglimit) {
914         &cancelbug;
915         return 0;
916     }
917
918     @thisbugmergelist= split(/ /,$data->{mergedwith});
919     if (!@thisbugmergelist) {
920         &foundbug;
921         $manybugs= 0;
922         $state= 'single';
923         $sref=$ref;
924         &dlex("setbug => 1s");
925         return 1;
926     }
927     &cancelbug;
928     &getmerge;
929     $manybugs= 1;
930     if (!&getbug) {
931         &notfoundbug;
932         &endmerge;
933         &dlex("setbug => 0mc");
934         return 0;
935     }
936     &foundbug;
937     $state= 'multiple'; $sref=$ref;
938     &dlex("setbug => 1m");
939     return 1;
940 }
941
942 sub getnextbug {
943     &dlen("getnextbug");
944     $state eq 'single' || $state eq 'multiple' || die "$state ?";
945     &savebug;
946     if (!$manybugs || !@thisbugmergelist) {
947         length($action) || die;
948         &transcript("$action\n$extramessage\n");
949         &endmerge if $manybugs;
950         $state= 'idle';
951         &dlex("getnextbug => 0");
952         return 0;
953     }
954     $ref= shift(@thisbugmergelist);
955     &getbug || die "bug $ref disappeared";
956     &foundbug;
957     &dlex("getnextbug => 1");
958     return 1;
959 }
960
961 # Low-level bug-manipulation calls
962 # Do no announcements
963 #
964 #    getbug (returns 0)
965 #
966 #    getbug (returns 1)
967 #    cancelbug
968 #
969 #    getmerge
970 #    $action= (something)
971 #    getbug (returns 1)
972 #    savebug/cancelbug
973 #    getbug (returns 1)
974 #    savebug/cancelbug
975 #    [getbug (returns 0)]
976 #    &transcript("$action\n\n")
977 #    endmerge
978
979 sub notfoundbug { &transcript("$gBug number $ref not found.\n\n"); }
980 sub foundbug { &transcript("$gBug#$ref: $data->{subject}\n"); }
981
982 sub getmerge {
983     &dlen("getmerge");
984     $mergelowstate eq 'idle' || die "$mergelowstate ?";
985     &filelock('lock/merge');
986     $mergelowstate='locked';
987     &dlex("getmerge");
988 }
989
990 sub endmerge {
991     &dlen("endmerge");
992     $mergelowstate eq 'locked' || die "$mergelowstate ?";
993     &unfilelock;
994     $mergelowstate='idle';
995     &dlex("endmerge");
996 }
997
998 sub getbug {
999     &dlen("getbug $ref");
1000     $lowstate eq 'idle' || die "$state ?";
1001     if (($data = &lockreadbug($ref))) {
1002         $sref= $ref;
1003         $lowstate= "open";
1004         &dlex("getbug => 1");
1005         $extramessage='';
1006         return 1;
1007     }
1008     $lowstate= 'idle';
1009     &dlex("getbug => 0");
1010     return 0;
1011 }
1012
1013 sub cancelbug {
1014     &dlen("cancelbug");
1015     $lowstate eq 'open' || die "$state ?";
1016     &unfilelock;
1017     $lowstate= 'idle';
1018     &dlex("cancelbug");
1019 }
1020
1021 sub savebug {
1022     &dlen("savebug $ref");
1023     $lowstate eq 'open' || die "$lowstate ?";
1024     length($action) || die;
1025     $ref == $sref || die "read $sref but saving $ref ?";
1026     my $hash = get_hashname($ref);
1027     open(L,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log: $!");
1028     print(L
1029           "\6\n".
1030           "<strong>".&sani($action)."</strong>\n".
1031           "Request was from <code>".&sani($header{'from'})."</code>\n".
1032           "to <code>".&sani($controlrequestaddr)."</code>. \n".
1033           "\3\n".
1034           "\7\n",@{escapelog(@log)},"\n\3\n") || &quit("writing db-h/$hash/$ref.log: $!");
1035     close(L) || &quit("closing db-h/$hash/$ref.log: $!");
1036     unlockwritebug($ref, $data);
1037     $lowstate= "idle";
1038     &dlex("savebug");
1039 }
1040
1041 sub dlen {
1042     return if !$dl;
1043     &transcript("C> @_ ($state $lowstate $mergelowstate)\n");
1044 }
1045
1046 sub dlex {
1047     return if !$dl;
1048     &transcript("R> @_ ($state $lowstate $mergelowstate)\n");
1049 }
1050
1051 sub transcript {
1052     print $_[0] if $debug;
1053     $transcript.= $_[0];
1054 }
1055
1056 sub urlsanit {
1057     my $url = shift;
1058     $url =~ s/%/%25/g;
1059     $url =~ s/\+/%2b/g;
1060     my %saniarray = ('<','lt', '>','gt', '&','amp', '"','quot');
1061     $url =~ s/([<>&"])/\&$saniarray{$1};/g;
1062     return $url;
1063 }
1064
1065 sub sendlynxdoc {
1066     &sendlynxdocraw;
1067     &transcript("\n");
1068     $ok++;
1069 }
1070
1071 sub sendtxthelp {
1072     &sendtxthelpraw;
1073     &transcript("\n");
1074     $ok++;
1075 }
1076
1077 sub sendtxthelpraw {
1078     local ($relpath,$description) = @_;
1079     $doc='';
1080     open(D,"$gDocDir/$relpath") || &quit("open doc file $relpath: $!");
1081     while(<D>) { $doc.=$_; }
1082     close(D);
1083     &transcript("Sending $description in separate message.\n");
1084     &sendmailmessage(<<END.$doc,$replyto);
1085 From: $gMaintainerEmail ($gProject $gBug Tracking System)
1086 To: $replyto
1087 Subject: $gProject $gBug help: $description
1088 References: $header{'message-id'}
1089 In-Reply-To: $header{'message-id'}
1090 Message-ID: <handler.s.$nn.help.$midix\@$gEmailDomain>
1091 Precedence: bulk
1092 X-$gProject-PR-Message: doc-text $relpath
1093
1094 END
1095     $ok++;
1096 }
1097
1098 sub sendlynxdocraw {
1099     local ($relpath,$description) = @_;
1100     $doc='';
1101     open(L,"lynx -nolist -dump http://$gCGIDomain/\Q$relpath\E 2>&1 |") || &quit("fork for lynx: $!");
1102     while(<L>) { $doc.=$_; }
1103     $!=0; close(L);
1104     if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
1105         &transcript("Information ($description) is not available -\n".
1106                     "perhaps the $gBug does not exist or is not on the WWW yet.\n");
1107          $ok++;
1108     } elsif ($?) {
1109         &transcript("Error getting $description (code $? $!):\n$doc\n");
1110     } else {
1111         &transcript("Sending $description.\n");
1112         &sendmailmessage(<<END.$doc,$replyto);
1113 From: $gMaintainerEmail ($gProject $gBug Tracking System)
1114 To: $replyto
1115 Subject: $gProject $gBugs information: $description
1116 References: $header{'message-id'}
1117 In-Reply-To: $header{'message-id'}
1118 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
1119 Precedence: bulk
1120 X-$gProject-PR-Message: doc-html $relpath
1121
1122 END
1123          $ok++;
1124     }
1125 }
1126
1127 sub addccaddress {
1128     my ($cca) = @_;
1129     $maintccreasons{$cca}{''}{$ref}= 1;
1130 }
1131
1132 sub addmaintainers {
1133     # Data structure is:
1134     #   maintainer email address &c -> assoc of packages -> assoc of bug#'s
1135     my $data = shift;
1136     my ($p, $addmaint);
1137     &ensuremaintainersloaded;
1138     $anymaintfound=0; $anymaintnotfound=0;
1139     for $p (split(m/[ \t?,():]+/, $data->{package})) {
1140         $p =~ y/A-Z/a-z/;
1141         $p =~ /([a-z0-9.+-]+)/;
1142         $p = $1;
1143         next unless defined $p;
1144         if (defined $gSubscriptionDomain) {
1145             if (defined($pkgsrc{$p})) {
1146                 addbcc("$pkgsrc{$p}\@$gSubscriptionDomain");
1147             } else {
1148                 addbcc("$p\@$gSubscriptionDomain");
1149             }
1150         }
1151         if (defined $data->{severity} and defined $gStrongList and
1152                 isstrongseverity($data->{severity})) {
1153             addbcc("$gStrongList\@$gListDomain");
1154         }
1155         if (defined($maintainerof{$p})) {
1156             $addmaint= $maintainerof{$p};
1157             &transcript("MR|$addmaint|$p|$ref|\n") if $dl>2;
1158             $maintccreasons{$addmaint}{$p}{$ref}= 1;
1159             print "maintainer add >$p|$addmaint<\n" if $debug;
1160         } else { 
1161             print "maintainer none >$p<\n" if $debug; 
1162             &transcript("Warning: Unknown package '$p'\n");
1163             &transcript("MR|unknown-package|$p|$ref|\n") if $dl>2;
1164             $maintccreasons{$gUnknownMaintainerEmail}{$p}{$ref}= 1;
1165         }
1166     }
1167
1168     if (length $data->{owner}) {
1169         $addmaint = $data->{owner};
1170         &transcript("MO|$addmaint|$data->{package}|$ref|\n") if $dl>2;
1171         $maintccreasons{$addmaint}{$data->{package}}{$ref} = 1;
1172         print "owner add >$data->{package}|$addmaint<\n" if $debug;
1173     }
1174 }
1175
1176 sub ensuremaintainersloaded {
1177     my ($a,$b);
1178     return if $maintainersloaded++;
1179     open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!");
1180     while (<MAINT>) {
1181         m/^\n$/ && next;
1182         m/^\s*$/ && next;
1183         m/^(\S+)\s+(\S.*\S)\s*\n$/ || &quit("maintainers bogus \`$_'");
1184         $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
1185         $maintainerof{$1}= $2;
1186     }
1187     close(MAINT);
1188     open(MAINT,"$gMaintainerFileOverride") || die &quit("maintainers.override open: $!");
1189     while (<MAINT>) {
1190         m/^\n$/ && next;
1191         m/^\s*$/ && next;
1192         m/^(\S+)\s+(\S.*\S)\s*\n$/ || &quit("maintainers.override bogus \`$_'");
1193         $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
1194         $maintainerof{$1}= $2;
1195     }
1196
1197     open(SOURCES, "$gPackageSource") || &quit("pkgsrc open: $!");
1198     while (<SOURCES>) {
1199         next unless m/^(\S+)\s+\S+\s+(\S.*\S)\s*$/;
1200         my ($a, $b) = ($1, $2);
1201         $pkgsrc{lc($a)} = $b;
1202     }
1203     close(SOURCES);
1204 }
1205
1206 sub sendinfo {
1207     local ($wherefrom,$path,$description) = @_;
1208     if ($wherefrom eq "ftp.d.o") {
1209       $doc = `lynx -nolist -dump http://ftp.debian.org/debian/indices/$path.gz 2>&1 | gunzip -cf` or &quit("fork for lynx/gunzip: $!");
1210       $! = 0;
1211       if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
1212           &transcript("$description is not available.\n");
1213           $ok++; return;
1214       } elsif ($?) {
1215           &transcript("Error getting $description (code $? $!):\n$doc\n");
1216           return;
1217       }
1218     } elsif ($wherefrom eq "local") {
1219       open P, "$path";
1220       $doc = do { local $/; <P> };
1221       close P;
1222     } else {
1223       &transcript("internal errror: info files location unknown.\n");
1224       $ok++; return;
1225     }
1226     &transcript("Sending $description.\n");
1227     &sendmailmessage(<<END.$doc,$replyto);
1228 From: $gMaintainerEmail ($gProject $gBug Tracking System)
1229 To: $replyto
1230 Subject: $gProject $gBugs information: $description
1231 References: $header{'message-id'}
1232 In-Reply-To: $header{'message-id'}
1233 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
1234 Precedence: bulk
1235 X-$gProject-PR-Message: getinfo
1236
1237 $description follows:
1238
1239 END
1240     $ok++;
1241     &transcript("\n");
1242 }