X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=maps%2Flib%2FMAPS.pm;h=c0e3448c7c0f291dee2619a785ae8c074ed0bca6;hb=99d800f7afaf8a200aea0aea4609a6c435dca5ad;hp=d63f9b9e4ad62b5d3d3b7fa7176f3bc201695440;hpb=9a7e8178524ea77a12d2793791b9630017e1cbe8;p=clearscm.git diff --git a/maps/lib/MAPS.pm b/maps/lib/MAPS.pm index d63f9b9..c0e3448 100644 --- a/maps/lib/MAPS.pm +++ b/maps/lib/MAPS.pm @@ -291,7 +291,7 @@ sub AddList(%) { $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}; @@ -403,6 +403,8 @@ sub CheckEmail(;$$) { if ($username) { if ($username =~ /(.*)\@(.*)/) { return lc "$1\@$2"; + } else { + return lc "$username\@"; } # if } elsif ($domain) { if ($domain =~ /(.*)\@(.*)/) { @@ -458,7 +460,9 @@ sub CheckOnList ($$;$) { ? "$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; @@ -544,6 +548,8 @@ sub CleanList(%) { return 0 unless $count; + $count = 0; + my ($err, $errmsg) = $db->find($table, $condition); croak "Unable to find $params{type} entries for $condition - $errmsg" if $err; @@ -1011,7 +1017,7 @@ sub ResequenceList(%) { $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);