projects
/
clearscm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Some changes to dot files
[clearscm.git]
/
maps
/
lib
/
MAPS.pm
diff --git
a/maps/lib/MAPS.pm
b/maps/lib/MAPS.pm
index
c2069c1
..
c0e3448
100644
(file)
--- a/
maps/lib/MAPS.pm
+++ b/
maps/lib/MAPS.pm
@@
-106,14
+106,14
@@
my $mapsbase = "$FindBin::Bin/..";
sub _cleanTables($$;$) {
my ($table, $timestamp, $dryrun) = @_;
sub _cleanTables($$;$) {
my ($table, $timestamp, $dryrun) = @_;
- my $count = 0;
- my $msg = 'Records deleted';
my $condition = "userid = '$userid' and timestamp < '$timestamp'";
if ($dryrun) {
return $db->count($table, $condition);
} else {
my $condition = "userid = '$userid' and timestamp < '$timestamp'";
if ($dryrun) {
return $db->count($table, $condition);
} else {
- return $db->delete($table, $condition);
+ my ($count, $msg) = $db->delete($table, $condition);
+
+ return $count;
} # if
} # _cleanTables
} # if
} # _cleanTables
@@
-291,7
+291,7
@@
sub AddList(%) {
$rec{hit_count} //= $db->count(
'email',
$rec{hit_count} //= $db->count(
'email',
- "userid = '$rec{userid}' and sender like '$rec{sender}%'"
+ "userid = '$rec{userid}' and sender like '
%
$rec{sender}%'"
);
($rec{pattern}, $rec{domain}) = split /\@/, delete $rec{sender};
);
($rec{pattern}, $rec{domain}) = split /\@/, delete $rec{sender};
@@
-403,6
+403,8
@@
sub CheckEmail(;$$) {
if ($username) {
if ($username =~ /(.*)\@(.*)/) {
return lc "$1\@$2";
if ($username) {
if ($username =~ /(.*)\@(.*)/) {
return lc "$1\@$2";
+ } else {
+ return lc "$username\@";
} # if
} elsif ($domain) {
if ($domain =~ /(.*)\@(.*)/) {
} # if
} elsif ($domain) {
if ($domain =~ /(.*)\@(.*)/) {
@@
-458,7
+460,9
@@
sub CheckOnList ($$;$) {
? "$email_on_file\@"
: $email_on_file;
if ($sender and $sender =~ /$search_for/i) {
? "$email_on_file\@"
: $email_on_file;
if ($sender and $sender =~ /$search_for/i) {
- $rule = "Matching rule: ($listtype:$rec->{sequence}) \"$email_on_file\"";
+ my $comment = $rec->{comment} ? " - $rec->{comment}" : '';
+
+ $rule = "Matching rule: ($listtype:$rec->{sequence}) \"$email_on_file$comment\"";
$rule .= " - $rec->{comment}" if $rec->{comment};
$status = 1;
$rule .= " - $rec->{comment}" if $rec->{comment};
$status = 1;
@@
-500,6
+504,7
@@
sub CleanList(%) {
my $table = 'list';
my $condition = "userid='$params{userid}' and type='$params{type}'";
my $count = 0;
my $table = 'list';
my $condition = "userid='$params{userid}' and type='$params{type}'";
my $count = 0;
+ my $msg;
# First let's go through the list to see if we have an domain level entry
# (e.g. @spammer.com) and also individual entries (baddude@spammer.com) then
# First let's go through the list to see if we have an domain level entry
# (e.g. @spammer.com) and also individual entries (baddude@spammer.com) then
@@
-536,11
+541,14
@@
sub CleanList(%) {
} # for
} # while
} # for
} # while
- my $msg = 'Records deleted';
$condition = "userid='$params{userid}' and type='$params{type}' and retention is not null";
# First see if anything needs to be deleted
$condition = "userid='$params{userid}' and type='$params{type}' and retention is not null";
# First see if anything needs to be deleted
- return (0, $msg) unless $db->count($table, $condition);
+ ($count, $msg) = $db->count($table, $condition);
+
+ return 0 unless $count;
+
+ $count = 0;
my ($err, $errmsg) = $db->find($table, $condition);
my ($err, $errmsg) = $db->find($table, $condition);
@@
-570,9
+578,9
@@
sub CleanList(%) {
. "$rec->{pattern}\@$rec->{domain} $dryrunstr");
$params{log}->dbug("last hit = $rec->{last_hit} < agedDate = $agedDate");
} # if
. "$rec->{pattern}\@$rec->{domain} $dryrunstr");
$params{log}->dbug("last hit = $rec->{last_hit} < agedDate = $agedDate");
} # if
-
- $count++;
} # unless
} # unless
+
+ $count++;
} else {
$params{log}->dbug("$rec->{userid}:$params{type}:$rec->{sequence}: nodelete $dryrunstr "
. "last hit = $rec->{last_hit} >= agedDate = $agedDate")
} else {
$params{log}->dbug("$rec->{userid}:$params{type}:$rec->{sequence}: nodelete $dryrunstr "
. "last hit = $rec->{last_hit} >= agedDate = $agedDate")
@@
-583,9
+591,9
@@
sub CleanList(%) {
ResequenceList(
userid => $params{userid},
type => $params{type},
ResequenceList(
userid => $params{userid},
type => $params{type},
- ) if $count
and
!$params{dryrun};
+ ) if $count
&&
!$params{dryrun};
- return
wantarray ? ($count, $msg) : $count;
+ return
$count;
} # CleanList
sub CountEmail(%) {
} # CleanList
sub CountEmail(%) {
@@
-1009,7
+1017,7
@@
sub ResequenceList(%) {
$db->lock('write', $table);
# Get all records for $userid and $type
$db->lock('write', $table);
# Get all records for $userid and $type
- my $listrecs = $db->get($table, $condition);
+ my $listrecs = $db->get($table, $condition
,'*', 'order by hit_count desc'
);
# Delete all of the list entries for this $userid and $type
my ($count, $msg) = $db->delete($table, $condition);
# Delete all of the list entries for this $userid and $type
my ($count, $msg) = $db->delete($table, $condition);