X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fread.pl;h=9df5edad1e68910760ff155d0f61da12bd0b88d2;hb=624a291612bd3adf9dc02ec813a213109331b4c9;hp=c72be605ba37786b9f907de3869fe74495d0a5db;hpb=78ed3f6025103ec1c47c90725e37b417647d83c8;p=spider.git diff --git a/cmd/read.pl b/cmd/read.pl index c72be605..9df5edad 100644 --- a/cmd/read.pl +++ b/cmd/read.pl @@ -5,3 +5,34 @@ # # $Id$ # + +my ($self, $line) = @_; +my @f = split /\s+/, $line; +my $msgno; +my @out; +my @body; +my $ref; + +for $msgno (@f) { + $ref = DXMsg::get($msgno); + if (!$ref) { + push @out, "Msg $msgno not found"; + next; + } + if ($ref->private && $self->priv < 9 && $ref->to ne $ref->call) { + push @out, "Msg $msgno not available"; + next; + } + push @out, sprintf "Msg: %d From: %s Date: %6.6s %5.5s Subj: %-30.30s", $msgno, + $ref->from, cldate($ref->t), ztime($ref->t), $ref->subject; + @body = $ref->read_msg_body; + push @out, @body; + + # mark my privates as read + if ($ref->private && $self->call eq $ref->to && $ref->read == 0) { + $ref->read(1); + $ref->store(\@body); # note call by reference! + } +} + +return (1, @out);