X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fread.pl;h=e21a77e6eaf5d891791aa725ab081d2de665d73d;hb=cce345b95c555a0b45218c5b452bc0f5f4f13bab;hp=9df5edad1e68910760ff155d0f61da12bd0b88d2;hpb=624a291612bd3adf9dc02ec813a213109331b4c9;p=spider.git diff --git a/cmd/read.pl b/cmd/read.pl index 9df5edad..e21a77e6 100644 --- a/cmd/read.pl +++ b/cmd/read.pl @@ -13,14 +13,27 @@ my @out; my @body; my $ref; +# if there are no specified message numbers, try and find a private one +# that I haven't read yet +if (@f == 0) { + foreach $ref (DXMsg::get_all()) { + if ($ref->to eq $self->call && $ref->private && !$ref->read) { + push @f, $ref->msgno; + last; + } + } +} + +return (1, $self->msg('read1')) if @f == 0; + for $msgno (@f) { $ref = DXMsg::get($msgno); if (!$ref) { - push @out, "Msg $msgno not found"; + push @out, $self->msg('read2', $msgno); next; } - if ($ref->private && $self->priv < 9 && $ref->to ne $ref->call) { - push @out, "Msg $msgno not available"; + if ($self->priv < 5 && $ref->private && $ref->to ne $self->call && $ref->from ne $self->call ) { + push @out, $self->msg('read3', $msgno); next; } push @out, sprintf "Msg: %d From: %s Date: %6.6s %5.5s Subj: %-30.30s", $msgno, @@ -33,6 +46,9 @@ for $msgno (@f) { $ref->read(1); $ref->store(\@body); # note call by reference! } + + # remember this one as the last one read + $self->lastread($msgno); } return (1, @out);