enhanced load/keps to accept a message no. This will create a new keps
[spider.git] / cmd / load / keps.pl
index 71229e1d8a8165e062d1dd2a2d479f64ddb2e1a1..83547dfa1ab7d436511fa76166d9e32ac9a60ba8 100644 (file)
@@ -1,8 +1,20 @@
 #
 # load the the keps file after changing it
 #
-my $self = shift;
-return (1, $self->msg('e5')) if $self->priv < 9;
+my ($self, $line) = @_;
+return (1, $self->msg('e5')) if $self->priv < 5;
+
+if ($line =~ /^(\d+)$/) {
+       my $msgno = $1;
+       my $mref = DXMsg::get($msgno);
+       return (1, $self->msg('m4', $msgno)) unless $mref;
+       return (1, $self->msg('sat5')) unless $mref->subject =~ /\b\d{3,6}\.AMSAT\b/i;
+       my $fn = DXMsg::filename($msgno);
+       my $fh = new IO::File "$main::root/perl/convkeps.pl $fn |";
+       my @in = <$fh>;
+       $fh->close;
+       return (1, @in) if @in;
+}
 my @out = Sun::load($self);
 @out = ($self->msg('ok')) if !@out;
 return (1, @out);