X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXMsg.pm;h=fe65cdb3b204667d1931113c4036f6583fcd56a8;hb=79c87e2cc1794b2a752dadb6af3ae489002d7c17;hp=04ef99cb8ecffccfb21d7215b590a886497d2a8d;hpb=e26fa9333c620e741da9398478c4ad0a656f1ae7;p=spider.git diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index 04ef99cb..fe65cdb3 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -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) { @@ -336,17 +346,21 @@ sub handle_32 } # check the message for bad words + my @bad; my @words; + @bad = BadWords::check($ref->{subject}); + push @words, [$ref->{subject}, @bad] if @bad; for (@{$ref->{lines}}) { - push @words, BadWords::check($_); + @bad = BadWords::check($_); + push @words, [$_, @bad] if @bad; } - push @words, BadWords::check($ref->{subject}); if (@words) { - dbg("$ref->{from} swore: '@words' -> $ref->{to} '$ref->{subject}' origin: $ref->{origin} via " . $dxchan->call) if isdbg('msg'); - Log('msg',"$ref->{from} swore: '@words' -> $ref->{to} origin: $ref->{origin} via " . $dxchan->call); - Log('msg',"subject: $ref->{subject}"); - for (@{$ref->{lines}}) { - Log('msg', "line: $_"); + LogDbg('msg',"$ref->{from} swore: $ref->{to} origin: $ref->{origin} via " . $dxchan->call); + LogDbg('msg',"subject: $ref->{subject}"); + for (@words) { + my $r = $_; + my $line = shift @$r; + LogDbg('msg', "line: $line (using words: ". join(',', @$r).")"); } $ref->stop_msg($fromnode); return; @@ -469,7 +483,7 @@ sub notify my $ref = shift; my $to = $ref->{to}; my $uref = DXUser->get_current($to); - my $dxchan = DXChannel->get($to); + my $dxchan = DXChannel::get($to); if (((*Net::SMTP && $email_server) || $email_prog) && $uref && $uref->wantemail) { my $email = $uref->email; if ($email) { @@ -1099,7 +1113,7 @@ sub do_send_stuff $ref->notify; } } else { - Log('msg', $self->call . " swore to @{$loc->{to}} subject: '$loc->{subject}' in msg, REJECTED"); + LogDbg('msg', $self->call . " swore to @{$loc->{to}} subject: '$loc->{subject}' in msg, REJECTED"); } delete $loc->{lines};