fix bull age deletion both periodically and on new entry
authorminima <minima>
Sat, 5 Feb 2005 18:10:37 +0000 (18:10 +0000)
committerminima <minima>
Sat, 5 Feb 2005 18:10:37 +0000 (18:10 +0000)
Changes
perl/DXMsg.pm

diff --git a/Changes b/Changes
index 331ae540f377382972e135af21bbcaeb4c202699..eabf6097ab939d4d6a45b345e8059e71459126b7 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+05Feb05=======================================================================
+1. Fix a long standing (ie since the first bulletin was sent) bug with old
+mail not being deleted until a restart was done.
+2. As well as a duplicate check on existing bulletins, I have added a check 
+the message is not (already) too old. 
 03Feb05=======================================================================
 1. Added latest Spanish translations courtesy of Angel EA7WA.
 2. Force all languages to use pr in en in Messages, as the prompt is
index 04ef99cb8ecffccfb21d7215b590a886497d2a8d..67165ef455a03df1fcae0368bd1ba21504f5c325 100644 (file)
@@ -151,7 +151,10 @@ sub process
        }
 
        # clean the message queue
-       clean_old() if $main::systime - $last_clean > 3600 ;
+       if ($main::systime >= $last_clean+3600) {
+               clean_old();
+               $last_clean = $main::systime;
+       }
        
        # actual remove all the 'deleted' messages in one hit.
        # this has to be delayed until here otherwise it only does one at 
@@ -161,7 +164,6 @@ sub process
                $_->del_msg;
        }
        
-       $last_clean = $main::systime;
 }
 
 # incoming message
@@ -312,6 +314,14 @@ sub handle_32
                                $ref->store($ref->{lines});
                        } else {
 
+                               # is it too old
+                               if ($ref->{t}+$maxage < $main::systime ) {
+                                       $ref->stop_msg($fromnode);
+                                       dbg("old message from $ref->{from} -> $ref->{to} " . atime($ref->{t}) . " ignored") if isdbg('msg');
+                                       Log('msg', "old message from $ref->{from} -> $ref->{to} " . cldatetime($ref->{t}) . " ignored");
+                                       return;
+                               }
+
                                # does an identical message already exist?
                                my $m;
                                for $m (@msg) {