X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Funcatchup.pl;h=8a6f02a680eda9bfa1aa3d488528e1e3c001ccd8;hb=ab811a0c902225075a9bd69749f65594079433a9;hp=15edb1a48f5141ea4e300e865f4f8504f8b5a40a;hpb=f0ac8322367c66080b6dbb74da4de72dae126dc3;p=spider.git diff --git a/cmd/uncatchup.pl b/cmd/uncatchup.pl index 15edb1a4..8a6f02a6 100644 --- a/cmd/uncatchup.pl +++ b/cmd/uncatchup.pl @@ -1,18 +1,56 @@ # -# uncatchup some or all of the non-private messages for a node. +# catchup some or all of the non-private messages for a node. # -# in other words mark messages as NOT being already received +# in other words mark all messages as being already received # by this node. # -# $Id$ +# # # Copyright (c) 1999 Dirk Koopman G1TLH # my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->priv < 5; + my @f = split /\s+/, $line; +return (1, "usage: catchup all|[= 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; + } elsif (my ($f, $t) = $msgno =~ /(\d+)-(\d+)/) { + while ($f <= $t) { + $ref = DXMsg::get($f++); + push @ref, $ref if $ref; + } + } else { + $ref = DXMsg::get($msgno); + unless ($ref) { + push @out, $self->msg('m13', $msgno); + next; + } + push @ref, $ref; + } +} +foreach $ref (@ref) { + next if $ref->{private}; + if (grep {$_ eq $call} @{$ref->{gotit}}) { + $ref->{gotit} = [ grep {$_ ne $call} @{$ref->{gotit}} ]; # mark this up as NOT being received + $ref->store( [ $ref->read_msg_body() ] ); # re- store the file + push @out, $self->msg('m15', $ref->{msgno}, $call); + } +} return (1, @out); +