X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=maps%2Fbin%2FMAPSDB.pm;h=5836e2a8dafbc1586810b3072c18332bf0317bc9;hb=9f51fc95d361092058a17611614f31318a3fad0c;hp=23911c7de86206555312170f2b8436c696ee1f92;hpb=32deb5f9dfef1be20b8ffd96898f06c5448d7604;p=clearscm.git diff --git a/maps/bin/MAPSDB.pm b/maps/bin/MAPSDB.pm index 23911c7..5836e2a 100644 --- a/maps/bin/MAPSDB.pm +++ b/maps/bin/MAPSDB.pm @@ -2,7 +2,7 @@ ################################################################################# # # File: $RCSfile: MAPSDB.pm,v $ -# Revision: $Revision: 1.1 $ +# Revision: $Revision: 1.1 $ # Description: MAPS Database routines # Author: Andrew@DeFaria.com # Created: Fri Nov 29 14:17:21 2002 @@ -206,13 +206,15 @@ sub RecordHit ($$$) { return; } # RecordHit -sub CheckOnList ($$) { +sub CheckOnList ($$;$) { # CheckOnList will check to see if the $sender is on the $listfile. # Return 1 if found 0 if not. - my ($listtype, $sender) = @_; + my ($listtype, $sender, $update) = @_; - my $status = 0; - my $rule; + $update //= 1; + + my $status = 0; + my ($rule, $sequence, $hit_count); my $statement = "select pattern, domain, comment, sequence, hit_count from list where userid = '$userid' and type = '$listtype'"; @@ -225,8 +227,8 @@ sub CheckOnList ($$) { while (my @row = $sth->fetchrow_array) { last if !@row; - my $hit_count = pop (@row); - my $sequence = pop (@row); + $hit_count = pop (@row); + $sequence = pop (@row); my $comment = pop (@row); my $domain = pop (@row); my $pattern = pop (@row); @@ -264,7 +266,7 @@ sub CheckOnList ($$) { $rule .= " - $comment" if $comment and $comment ne ''; $status = 1; - RecordHit $listtype, $sequence, ++$hit_count; + RecordHit $listtype, $sequence, ++$hit_count if $update; last; } # if @@ -272,7 +274,7 @@ sub CheckOnList ($$) { $sth->finish; - return ($status, $rule); + return ($status, $rule, $sequence, $hit_count); } # CheckOnList sub CleanEmail ($) { @@ -996,27 +998,17 @@ END sub ReturnMessages ($$) { my ($userid, $sender) = @_; - # Note, the left(timestamp,16) chops off the seconds and the group - # by effectively squashes two emails received in the same minute to - # just one. We get a lot of double emails within the same minute. I - # think it's a result of the mailer configuration and it attempting - # to resend the message, not that it's the spammer sending just two - # emails in under a minute then going away. This will mean we will - # see fewer emails listed (essentially dups within one minute are - # squashed) yet they still will count towards the number of hits - # before we autonullist. We should squash these upon receipt, not - # upon report. Maybe latter... my $statement = <<"END"; select subject, - left(timestamp,16) + timestamp from email where userid = '$userid' and sender = '$sender' group by - left(timestamp,16) desc + timestamp desc END my $sth = $DB->prepare ($statement)