my $self = $class->new($dbh, ID => $bugid);
my $msg = Bugs::Message->lookup_msgid($dbh, $msgid, Insert => 1);
- print "Self is ".$msg->{id}."\n";
$self->add_subthread($msg);
return $self;
my $add = shift;
my $m = shift;
- print "addremove $add $m\n";
my $sth = $self->{dbh}->prepare(q{
INSERT INTO bug2message (include,bugid,messageid) VALUES (?,?,?)
});
# <MSGID> is replaced by the real message id.
$c{AltArchive} = "http://marc.info/?i=<MSGID>";
+
+$c{ControlAddress} = "control@foobugs.example.com";
use Bugs::Bug;
use Bugs::Message;
-use Bugs::Common qw(readconfig opendb);
+use Bugs::Common;
our $head = Mail::Header->new( \*STDIN );
sub parse_msgid {
my $r = shift;
- print "Resolving msgid \"$r\"\n";
if ( $r eq "^" ) {
if ( defined $head->get('in-reply-to') ) {
chomp(my $m = $head->get('in-reply-to'));
if (defined $head->get('references')) {
my $refs = $head->get('references');
my @refs = split /,\s*/, $refs;
- print "Refs:\n";
- print foreach (@refs);
die "refs";
}
die "Cannot resolve message-id `^'\n";
stop => \&cmd_quit,
);
+push @reply, "Processing commands for ".$c{ControlAddress}.":";
+push @reply, "";
+
while (<STDIN>) {
chomp();
push @reply, "> $_";
s/#.*//g;
next if (m/^$/);
+ my $done = 0;
eval {
m/(\S+)\s*(.*)/ or die "Failed to parse input.";
$cmds{$1} or die "Unknown command `$1'.";
- $cmds{$1}($2) or last;
+ $cmds{$1}($2) or $done = 1;
};
if ($@) {
chomp($@);
push @reply, "Command failed: $@";
push @reply, "Stop processing here.";
- last;
+ $done = 1;
}
+ last if $done;
}
+### XXX send a reply.
+
print "$_\n" foreach ( @reply );
print "\nDONE\n\n";