From 15354cb8c8aa57100f398acf6503b3bfdbb0650e Mon Sep 17 00:00:00 2001 From: minima Date: Thu, 7 Nov 2002 17:51:35 +0000 Subject: [PATCH] fix keep so it a) works and b) is persistant fix mystery deletions? --- Changes | 5 +++++ cmd/kill.pl | 10 +++++++--- perl/DXMsg.pm | 21 ++++++++++++++------- perl/Messages | 1 + 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Changes b/Changes index ed309c2c..bdda084d 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ 07Nov02======================================================================= 1. allow three digit longitudes +2. make a small change to see if messages now stay in place. +3. make keep actually stick over a reboot and take it fully into account for +deletions. +4. try not to delete new messages (even if this is an update that reads 'old' +messages with missing fields). 29Oct02======================================================================= 1. make sh/log et al a bit more efficient. 2. fix dupe message in dx. diff --git a/cmd/kill.pl b/cmd/kill.pl index 0dcc0d4d..dce2c22f 100644 --- a/cmd/kill.pl +++ b/cmd/kill.pl @@ -66,14 +66,18 @@ while (@f) { } foreach $ref ( @refs) { - Log('msg', "Message $ref->{msgno} from $ref->{from} to $ref->{to} deleted by $call"); - if ($full) { - DXChannel::broadcast_nodes(DXProt::pc49($ref->{from}, $ref->{subject}), $main::me); + if ($ref->keep) { + push @out, $self->msg('m18', $ref->msgno); + next; } my $tonode = $ref->tonode; $ref->stop_msg($tonode) if $tonode; $ref->mark_delete($expunge ? 0 : undef); push @out, $self->msg('m12', $ref->msgno); + Log('msg', "Message $ref->{msgno} from $ref->{from} to $ref->{to} deleted by $call"); + if ($full) { + DXChannel::broadcast_nodes(DXProt::pc49($ref->{from}, $ref->{subject}), $main::me); + } } return (1, @out); diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index e8598085..43a1207b 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -125,7 +125,8 @@ sub alloc $self->{'read'} = shift; $self->{rrreq} = shift; $self->{delete} = shift; - $self->{deletetime} = shift || $self->{delete} ? 0 : ($self->{t} + $maxage); + $self->{deletetime} = shift || ($self->{t} + $maxage); + $self->{keep} = shift; $self->{gotit} = []; # $self->{lastt} = $main::systime; $self->{lines} = []; @@ -159,7 +160,7 @@ sub process # actual remove all the 'deleted' messages in one hit. # this has to be delayed until here otherwise it only does one at # a time because @msg is rewritten everytime del_msg is called. - my @del = grep {!$_->{tonode} && $_->{delete} && $_->{deletetime} < $main::systime} @msg; + my @del = grep {!$_->{tonode} && $_->{delete} && !$_->{keep} && $_->{deletetime} < $main::systime} @msg; for (@del) { $_->del_msg; } @@ -521,8 +522,9 @@ sub store my $rr = $ref->{rrreq} ? '1' : '0'; my $priv = $ref->{private} ? '1': '0'; my $del = $ref->{delete} ? '1' : '0'; - my $delt = $ref->{deletetime} || $ref->{t} + $maxage; - print $fh "=== $ref->{msgno}^$ref->{to}^$ref->{from}^$ref->{t}^$priv^$ref->{subject}^$ref->{origin}^$ref->{'read'}^$rr^$del^$delt\n"; + my $delt = $ref->{deletetime} || '0'; + my $keep = $ref->{keep} || '0'; + print $fh "=== $ref->{msgno}^$ref->{to}^$ref->{from}^$ref->{t}^$priv^$ref->{subject}^$ref->{origin}^$ref->{'read'}^$rr^$del^$delt^$keep\n"; print $fh "=== ", join('^', @{$ref->{gotit}}), "\n"; my $line; $ref->{size} = 0; @@ -569,6 +571,9 @@ sub mark_delete { my $ref = shift; my $t = shift; + + return if $ref->{keep}; + $t = $main::systime + $residencetime unless defined $t; $ref->{delete}++; @@ -580,8 +585,8 @@ sub unmark_delete { my $ref = shift; my $t = shift; - delete $ref->{delete}; - delete $ref->{deletetime}; + $ref->{delete} = 0; + $ref->{deletetime} = 0; } # clean out old messages from the message queue @@ -1142,7 +1147,9 @@ sub dir { my $ref = shift; my $flag = $ref->{private} && $ref->{read} ? '-' : ' '; - if ($ref->{delete}) { + if ($ref->{keep}) { + $flag = '!'; + } elsif ($ref->{delete}) { $flag = $ref->{deletetime} > $main::systime ? 'D' : 'E'; } return sprintf("%6d%s%s%5d %8.8s %8.8s %-6.6s %5.5s %-30.30s", diff --git a/perl/Messages b/perl/Messages index 4cc4a74b..02e44020 100644 --- a/perl/Messages +++ b/perl/Messages @@ -162,6 +162,7 @@ package DXM; m15 => 'Message no $_[0] unmarked as sent to $_[1]', m16 => 'Need a Message number', m17 => 'Sorry, cannot send messages in $_[0] mode', + m18 => 'Sorry, message $_[0] is currently set to KEEP', msg1 => 'Bulletin Messages Queued', msg2 => 'Private Messages Queued', msg3 => 'Msg $_[0]: $_[1] changed from $_[2] to $_[3]', -- 2.43.0