From: minima Date: Thu, 4 Oct 2001 11:32:14 +0000 (+0000) Subject: store deleted status across restarts! X-Git-Tag: R_1_49~71 X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=881637ac550fc824c3f8784f7fa8253b47ef5a64;p=spider.git store deleted status across restarts! --- diff --git a/Changes b/Changes index 1c0df002..df398943 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,7 @@ 2. reduce the number R: lines on a bull from a bbs to 2 (the origin and the last port of call). 3. ignore deleted messages for queuing purposes +4. store deleted status across restarts! 03Oct01======================================================================= 1. don't allow @WWW to become a 'TO' field... 2. handle @gb7tlh.#35.eu type addresses as well diff --git a/cmd/kill.pl b/cmd/kill.pl index 9c7675fa..fb90a954 100644 --- a/cmd/kill.pl +++ b/cmd/kill.pl @@ -68,8 +68,7 @@ foreach $ref ( @refs) { } my $tonode = $ref->tonode; $ref->stop_msg($tonode) if $tonode; - $ref->delete(1); - $ref->deletetime($main::systime + $DXMsg::residencetime); + $ref->mark_delete; push @out, $self->msg('m12', $ref->msgno); } diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index 118d9910..7cab1d02 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -110,6 +110,8 @@ sub alloc $self->{origin} = shift; $self->{'read'} = shift; $self->{rrreq} = shift; + $self->{delete} = shift; + $self->{deletetime} = shift; $self->{gotit} = []; # $self->{lastt} = $main::systime; $self->{lines} = []; @@ -340,8 +342,7 @@ sub process if ($ref) { if ($ref->{private}) { # remove it if it private and gone off site# Log('msg', "Message $ref->{msgno} from $ref->{from} sent to $fromnode and deleted"); - $ref->{delete}++; - $ref->{deletetime} = $main::systime + $residencetime; + $ref->mark_delete; } else { Log('msg', "Message $ref->{msgno} from $ref->{from} sent to $fromnode"); push @{$ref->{gotit}}, $fromnode; # mark this up as being received @@ -407,8 +408,7 @@ sub process if ($pcno == 49) { # global delete on subject for (@msg) { if ($_->{from} eq $f[1] && $_->{subject} eq $f[2]) { - $_->{delete}++; - $_->{deletetime} = $main::systime + $residencetime; + $_->mark_delete; Log('msg', "Message $_->{msgno} from $_->{from} ($_->{subject}) fully deleted"); DXChannel::broadcast_nodes($line, $self); } @@ -453,7 +453,9 @@ sub store if (defined $fh) { my $rr = $ref->{rrreq} ? '1' : '0'; my $priv = $ref->{private} ? '1': '0'; - print $fh "=== $ref->{msgno}^$ref->{to}^$ref->{from}^$ref->{t}^$priv^$ref->{subject}^$ref->{origin}^$ref->{'read'}^$rr\n"; + my $del = $ref->{delete} ? '1' : '0'; + my $delt = $ref->{deletetime} || '0'; + print $fh "=== $ref->{msgno}^$ref->{to}^$ref->{from}^$ref->{t}^$priv^$ref->{subject}^$ref->{origin}^$ref->{'read'}^$rr^$del^$delt\n"; print $fh "=== ", join('^', @{$ref->{gotit}}), "\n"; my $line; $ref->{size} = 0; @@ -495,6 +497,17 @@ sub del_msg } } +sub mark_delete +{ + my $ref = shift; + my $t = shift; + $t = $main::systime + $residencetime unless defined $t; + + $ref->{delete}++; + $ref->{deletetime} = $t; + $ref->store( [$ref->read_msg_body] ); +} + # clean out old messages from the message queue sub clean_old { @@ -503,7 +516,9 @@ sub clean_old # mark old messages for deletion foreach $ref (@msg) { if (ref($ref) && !$ref->{keep} && $ref->{t} < $main::systime - $maxage) { - $ref->{delete} = 1; + + # this is for IMMEDIATE destruction + $ref->{delete}++; $ref->{deletetime} = 0; } }