fixed compilation probs
[spider.git] / cmd / catchup.pl
index 4cda1203fe85d8dc93ae41b0438897a0cb724c3b..41f2edd7e0a7bd358b5e0d98b2936693d603f5b7 100644 (file)
 #
 
 my ($self, $line) = @_;
+return (1, $self->msg('e5')) if $self->priv < 9;
+
 my @f = split /\s+/, $line;
+return (1, "usage: catchup <node call> all|[<msgno ...]") unless @f >= 2;
+
 my $call = uc shift @f;
+my $user = DXUser->get_current($call);
+return (1, "$call not a node") unless $user && $user->sort ne 'U';
+
 my @out;
+my $ref;
+my @ref;
+
+# get a more or less valid set of messages
+foreach my $msgno (@f) {
+       if ($msgno =~ /^al/oi) {
+               @ref = DXMsg::get_all();
+               last;
+       }
+       $ref = DXMsg::get($msgno);
+       unless ($ref) {
+               push @out, $self->msg('m13', $msgno);
+               next;
+       }
+       push @ref, $ref;
+}
 
+foreach $ref (@ref) {
+       next if $ref->{private};
+       unless (grep {$_ eq $call} @{$ref->{gotit}}) {
+               push @{$ref->{gotit}}, $call; # mark this up as being received
+               $ref->store( [ $ref->read_msg_body() ] );       # re- store the file
+               push @out, $self->msg('m14', $ref->{msgno}, $call);
+       }
+}
 
 return (1, @out);