X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fread.pl;h=0056530a26e40a99b7d1872f992f6907f26974c8;hb=42846321acd959aa93c2c2afd2b1f0a67f8accaf;hp=fbd243cf3513a326653f8dfe9d0588c5941fb558;hpb=57dbfe8cfdaacb84832c1a485b737b6c670b6ac4;p=spider.git diff --git a/cmd/read.pl b/cmd/read.pl index fbd243cf..0056530a 100644 --- a/cmd/read.pl +++ b/cmd/read.pl @@ -17,7 +17,7 @@ my $ref; # that I haven't read yet if (@f == 0) { foreach $ref (DXMsg::get_all()) { - if ($ref->to eq $self->call && $ref->private && !$ref->read) { + if ($ref->to eq $self->call && $ref->private && !$ref->read && !$ref->delete) { push @f, $ref->msgno; last; } @@ -41,33 +41,31 @@ for $msgno (@f) { @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! + # mark it as read + $ref->read($ref->read() + 1); + $ref->store(\@body); # note call by reference! - # if it had a read receipt on it generate a new message to send back to - # the sender. - if ($ref->rrreq) { - my $sub = $ref->subject; - $sub = "Re: $sub" unless $sub =~ /^\s*re:/i; - my $to = $ref->to; - my $from = $ref->from; - my $rref = DXMsg->alloc(1, $from, $main::mycall, time, - 1, $sub, $main::mycall, 0, 0 ); - my $msgno = DXMsg::next_transno("Msgno"); - $rref->msgno($msgno); - $rref->gotit( [ "$main::mycall" ] ); - $rref->store( [ "Return receipt from delivering node. Message read by $to." ] ); - DXMsg::add_dir($rref); - DXMsg::queue_msg(0); - } + # if it had a read receipt on it generate a new message to send back to + # the sender. + if ($ref->rrreq) { + my $sub = $ref->subject; + $sub = "Re: $sub" unless $sub =~ /^\s*re:/i; + my $to = $ref->to; + my $from = $ref->from; + my $rref = DXMsg->alloc(1, $from, $main::mycall, time, + 1, $sub, $main::mycall, 0, 0 ); + my $msgno = DXMsg::next_transno("Msgno"); + $rref->msgno($msgno); + $rref->gotit( [ "$main::mycall" ] ); + $rref->store( [ "Return receipt from delivering node. Message read by $to." ] ); + DXMsg::add_dir($rref); + DXMsg::queue_msg(0); } # remember this one as the last one read $self->lastread($msgno); - - } return (1, @out); + +