X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=maps%2Fbin%2Fcheckaddress.cgi;h=210d5c1ad35872559c8c33c62dfb231df5731ff2;hb=084f73a8091145061aea951f7342946046b16ff7;hp=3b28cce9b6acae442b05a7756a60232c220446c2;hpb=12005924b97cde62e3b2f2ddc2c50aa22661a190;p=clearscm.git diff --git a/maps/bin/checkaddress.cgi b/maps/bin/checkaddress.cgi index 3b28cce..210d5c1 100755 --- a/maps/bin/checkaddress.cgi +++ b/maps/bin/checkaddress.cgi @@ -2,7 +2,7 @@ ################################################################################ # # File: $RCSfile: checkaddress.cgi,v $ -# Revision: $Revision: 1.1 $ +# Revision: $Revision: 1.1 $ # Description: Check an email address # Author: Andrew@DeFaria.com # Created: Mon Jan 16 20:25:32 PST 2006 @@ -16,26 +16,55 @@ use strict; use warnings; use FindBin; -$0 = $FindBin::Script; +local $0 = $FindBin::Script; -use lib $FindBin::Bin; +use lib "$FindBin::Bin/../lib"; +use lib "$FindBin::Bin/../../lib"; use MAPS; -use CGI qw (:standard); +use CGI qw(:standard); # Get MAPSUser from cookie my $userid; if (param "user") { - $userid = param "user"; + $userid = param 'user'; } else { - $userid = cookie ("MAPSUser"); + $userid = cookie 'MAPSUser'; } # if -my $sender = param ("sender"); +$userid //= $ENV{USER}; -sub Heading { +my $sender = param 'sender'; + +sub formatRule($$$) { + my ($list, $email_on_file, $rec) = @_; + + my $next = $rec->{sequence} - 1; + my $rule = 'Rule: "'; + $rule .= $rec->{pattern} || ''; + $rule .= '@'; + $rule .= $rec->{domain} || ''; + $rule .= '" - '; + $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 header (-title => "MAPS: Check Address"), start_html (-title => "MAPS: Check Address", @@ -43,10 +72,12 @@ sub Heading { print h3 {-align => "center", -class => "header"}, "MAPS: Checking address $sender"; + + return; } # Heading -sub Body { - my ($onlist, $rule); +sub Body() { + 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 @@ -64,49 +95,60 @@ sub Body { # 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"}, + 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"}, + 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"}, + print div {-align => "center"}, + font {-color => "red"}, "Messages from", b ($sender), "will be", b ("returned"); } # if } # if } # if print br div {-align => "center"}, - submit (-name => "submit", - -value => "Close", - -onClick => "window.close (self)"); + submit(-name => "submit", + -value => "Close", + -onClick => "window.close (self)"); + + return; } # Body -sub Footing { +sub Footing() { print end_html; + + return; } # Footing # Main -SetContext $userid; +SetContext($userid); Heading; Body; Footing;