}
var features =
- "height=320" + "," +
- "location=no" + "," +
- "menubar=no" + "," +
- "status=no" + "," +
- "toolbar=no" + "," +
- "scrollbar=yes" + "," +
- "width=600";
+ "height=320" + "," +
+ "location=no" + "," +
+ "menubar=no" + "," +
+ "status=no" + "," +
+ "toolbar=no" + "," +
+ "scrollbar=yes" + "," +
+ "width=800";
var url = "/maps/bin/checkaddress.cgi?";
$rec{sender} = CheckEmail $rec{pattern}, $rec{domain};
- my ($status, $rule) = OnBlacklist($rec{sender});
+ my ($status) = OnBlacklist($rec{sender});
if ($status) {
print br {-class => 'error'},
$rec{sender} = CheckEmail $rec{pattern}, $rec{domain};
- my ($status, $rule) = OnNulllist($rec{sender});
+ my ($status) = OnNulllist($rec{sender});
if ($status) {
print br {-class => 'error'},
$rec{sender} = CheckEmail $rec{pattern}, $rec{domain};
- my ($status, $rule) = OnWhitelist($rec{sender}, $rec{userid});
+ my ($status) = OnWhitelist($rec{sender}, $rec{userid});
if ($status) {
print br {-class => 'error'},
$userid //= $ENV{USER};
-my $sender = param("sender");
+my $sender = param 'sender';
+
+sub formatRule($$$) {
+ my ($list, $email_on_file, $rec) = @_;
+
+ my $next = $rec->{sequence} - 1;
+ my $rule = "Rule: $email_on_file (";
+ $rule .= a {
+ -href => "/maps/php/list.php?type=$list&next=$next",
+ -target => '_blank',
+ }, "$list:$rec->{sequence}";
+ $rule .= ')' . br;
+
+ if ($rec->{retention}) {
+ $rule .= "Retention: " . $rec->{retention} . br;
+ } # if
+
+ if ($rec->{comment}) {
+ $rule .= "Comment: " . $rec->{comment};
+ } # if
+
+ return $rule;
+} # formatRule
sub Heading() {
print
} # Heading
sub Body() {
- my ($onlist, $rule);
+ my ($onlist, $rec);
# Algorithm change: We now first check to see if the sender is not found
# in the message and skip it if so. Then we handle if we are the sender
# Then we process nulllist people.
#
# Finally, we handle return processing
- ($onlist, $rule) = OnWhitelist($sender, $userid, 0);
+
+ # Some email addresses have a '+' in them (e.g.
+ # wipro+autoreply@talent.icims.com). The problem is that CGI.pm replaces the
+ # '+' with a space. Now email addresses cannot contain spaces so we're gonna
+ # assume that a space in the email should be a '+'.
+ $sender =~ s/\s/\+/g;
+
+ ($onlist, $rec) = OnWhitelist($sender, $userid, 0);
if ($onlist) {
print div {-align => "center"},
font {-color => "green"},
"Messages from", b ($sender), "will be", b ("delivered"), br, hr;
- print $rule;
+ print formatRule('white', $sender, $rec);
} else {
- ($onlist, $rule) = OnBlacklist($sender, 0);
+ ($onlist, $rec) = OnBlacklist($sender, 0);
if ($onlist) {
print div {-align => "center"},
font {-color => "black"},
"Messages from", b ($sender), "will be", b ("blacklisted"), br, hr;
- print $rule;
+ print formatRule('black', $sender, $rec);
} else {
- ($onlist, $rule) = OnNulllist($sender, 0);
+ ($onlist, $rec) = OnNulllist($sender, 0);
if ($onlist) {
print div {-align => "center"},
font {-color => "grey"},
"Messages from", b ($sender), "will be", b ("discarded"), br, hr;
- print $rule;
+ print formatRule('null', $sender, $rec);
} else {
print div {-align => "center"},
font {-color => "red"},
use MAPSWeb;
use DateUtils;
-my $type = param 'type';
-my $next = param 'next';
-my $lines = param 'lines';
-my $date = param 'date';
+my $type = param 'type';
+my $list = substr $type, 0, -4 if $type =~ /list$/;
+my $next = param 'next';
+my $lines = param 'lines';
+my $date = param 'date';
$date ||= '';
]
);
+sub formatRule($) {
+ my ($rec) = @_;
+
+ return '' unless $rec->{pattern} or $rec->{domain};
+
+ $rec->{pattern} //= '';
+ $rec->{domain} //= '';
+
+ return "$rec->{pattern}\@$rec->{domain}";
+} # formatRule
+
sub MakeButtons($) {
my ($type) = @_;
my $current = $next + 1;
+ my ($onlist, $rec);
+
print div {-align => 'center'}, b (
'(' . $current . '-' . $last . ' of ' . $total . ')');
print start_form {
print
Tr [
- th {-class => 'tablebordertopleft'}, '',
- th {-class => 'tableborder'}, 'Sender',
- th {-class => 'tableborder'}, 'List',
- th {-class => 'tableborder'}, 'Hit Count',
- th {-class => 'tableborder'}, 'Rule',
- th {-class => 'tablebordertopright'}, 'Comment',
+ th {-class => 'tablebordertopleft'}, '',
+ th {-class => 'tableborder'}, 'Sender',
+ th {-class => 'tableborder'}, 'List',
+ th {-class => 'tableborder'}, 'Hit Count',
+ th {-class => 'tableborder'}, 'Rule',
+ th {-class => 'tableborder'}, 'Retention',
+ th {-class => 'tablebordertopright'}, 'Comment/Date',
];
my @senders = ReturnSenders(
$heading = $msgs->[0]{subject} if $msgs->[0]{subject};
} # if
- my ($onlist, $seq);
-
- my $rule = 'none';
- my $hit_count = 0;
-
- ($onlist, $rule, $seq, $hit_count) = OnWhitelist($sender, $userid, 0);
+ ($onlist, $rec) = OnWhitelist($sender, $userid, 0);
unless ($onlist) {
- ($onlist, $rule, $seq, $hit_count) = OnBlacklist($sender, 0);
+ ($onlist, $rec) = OnBlacklist($sender, 0);
unless ($onlist) {
- ($onlist, $rule, $seq, $hit_count) = OnNulllist($sender, 0);
+ ($onlist, $rec) = OnNulllist($sender, 0);
} # unless
} # unless
- $hit_count //= '';
-
- my $list = '';
- my $sequence = 0;
- my $comment = '';
-
- # Parse rule
- if ($rule) {
- if ($rule =~ /\((\w+):(\d+)\)\s+"(\S*)"/) {
- $list = $1;
- $sequence = $2;
- $rule = $3;
- $comment = '';
- } elsif ($rule =~ /\((\w+):(\d+)\)\s+"(\S*) - (.*)"/) {
- $list = $1;
- $sequence = $2;
- $rule = $3;
- $comment = $4;
- } # if
-
- $rule =~ s/\\@/\@/;
- } # if
-
- $sequence //= 0;
$next++;
# Start Sender line
-href => "mailto:$sender$heading",
}, " $sender";
- my $listlink = ($list and $sequence) ? "$list:$sequence" : ' ';
+ if ($rec) {
+ my $listlink = ($rec->{type} and $rec->{sequence}) ? "$rec->{type}:$rec->{sequence}" : '';
+
+ $rec->{comment} //= '';
+
+ print td {
+ -class => $dataclass,
+ -align => 'right',
+ }, a {
+ href => "/maps/php/list.php?type=$rec->{type}&next=" . ($rec->{sequence} - 1),
+ }, $listlink,
+ td {
+ -class => $dataclass,
+ -align => 'right',
+ }, "$rec->{hit_count} ",
+ td {
+ -class => $dataclass,
+ }, formatRule($rec),
+ td {
+ -class => $dataclass,
+ -align => 'right',
+ }, "$rec->{retention} ",
+ td {
+ -class => $rightclass,
+ }, $rec->{comment};
+ } else {
+ # $rec will be undefined if this message will be returned
+ print td {-class => $dataclass},
+ td {-class => $dataclass},
+ td {-class => $dataclass},
+ td {-class => $dataclass},
+ td {-class => $rightclass};
+ } # if
- print td {
- -class => $dataclass,
- -align => 'right',
- }, a {
- href => "/maps/php/list.php?type=$list&next=" . ($sequence - 1),
- }, $listlink,
- td {
- -class => $dataclass,
- -align => 'right',
- }, "$hit_count ",
- td {
- -class => $dataclass,
- }, $rule,
- td {
- -class => $rightclass,
- }, $comment;
print end_Tr;
my $msgnbr = 0;
Tr [
td {
-class => $subjectclass,
- -colspan => 4,
+ -colspan => 5,
}, a {
-href => "display.cgi?sender=$sender;msg_date=$rec->{timestamp}",
}, ' ' . $rec->{subject},
return defined $uid ? 1 : 0;
} # ValidDomainUser
+sub formatRule($) {
+ my ($rec) = @_;
+
+ return "Rule: $rec->{pattern}\@$rec->{domain}:$rec->{sequence}/$rec->{hit_count}";
+} # formatRule
+
sub ProcessMsgs ($$$) {
my ($msgfile, $username, $user_email) = @_;
while (!eof $msgfile) {
my ($sender, $sender_long, $reply_to, $subject, $data) = ReadMsg ($msgfile);
- my ($onlist, $rule, $sequence, $hit_count);
+ my ($onlist, $rec, $sequence, $hit_count);
# Algorithm change: We now first check to see if the sender is not found
# in the message and skip it if so. Then we handle if we are the sender
} # if
# Check whitelist:
- ($onlist, $rule, $sequence, $hit_count) = OnWhitelist $sender;
+ ($onlist, $rec) = OnWhitelist $sender;
if ($onlist) {
if (ValidDomainUser $sender) {
- $log->msg("Whitelisting $sender - Rule: $rule:$sequence/$hit_count");
+ $log->msg("Whitelisting $sender - Rule: " . formatRule($rec));
- Whitelist $sender, $data, $sequence, $hit_count;
+ Whitelist $sender, $data, $rec->{sequence}, $rec->{hit_count};
} else {
$log->msg("Sender ($sender) from this domain but user not found");
} # if
# Check blacklist:
- ($onlist, $rule, $sequence, $hit_count) = OnBlacklist $sender;
+ ($onlist, $rec) = OnBlacklist $sender;
if ($onlist) {
- $log->msg("Blacklisting $sender - Rule: $rule:$sequence/$hit_count");
+ $log->msg("Blacklisting $sender - Rule: " . formatRule($rec));
Blacklist(
userid => $userid,
sender => $sender,
- sequence => $sequence,
- hit_count => $hit_count,
+ sequence => $rec->{sequence},
+ hit_count => $rec->{hit_count},
data => $data,
);
} # if
# Check nulllist:
- ($onlist, $rule, $sequence, $hit_count) = OnNulllist $sender;
+ ($onlist, $rec) = OnNulllist $sender;
if ($onlist) {
- $log->msg("Nulllisting $sender - Rule: $rule:$sequence/$hit_count");
- Nulllist $sender, $sequence, $hit_count;
+ #$log->msg("Nulllisting $sender - Rule: $rule:$sequence/$hit_count");
+ $log->msg("Nulllisting $sender - Rule: " . formatRule($rec));
+ Nulllist $sender, $rec->{sequence}, $rec->{hit_count};
next;
} # if
border-right: solid 3px SteelBlue;
border-left: 1px dotted #ccc;
border-bottom: 1px dotted #ccc;
- font-size: 12px;
+ font-size: 14px;
}
.tablebottomleft {
background: White;