- foreach my $sender (ReturnSenders $userid, $type, $next, $lines, $date) {
- my @msgs = ReturnMessages $userid, $sender;
+ for my $sender (ReturnSenders(
+ userid => $userid,
+ type => $type,
+ start_at => $next,
+ lines => $lines,
+ date => $date
+ )) {
+ my $msgs = ReturnMessages(
+ userid => $userid,
+ sender => $sender,
+ );
+
+ # This is for the purposes of supplying a subject line if the mailto address
+ # is clicked on. It's kludgy because we are simply grabbing the subject line
+ # of the first email sent where there may be many emails from this sender.
+ # Still it is often the right subject (or a good enough one)
+ #
+ # A little tricky here because of transliteration. If I test for
+ # $msg->[0]{subject} when $msg->[0] is essentially empty I create the hash
+ # making it non empty. Therefore I need to first test if $msgs->[0] exists
+ # first.
+ my $heading = '';
+
+ if ($msgs->[0]) {
+ $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);
+
+ unless ($onlist) {
+ ($onlist, $rule, $seq, $hit_count) = OnBlacklist($sender, 0);
+
+ unless ($onlist) {
+ ($onlist, $rule, $seq, $hit_count) = OnNulllist($sender, 0);
+ } # unless
+ } # unless
+
+ if ($rule) {
+ if ($rule =~ /\((\w+):(\d+)\)\s+"(.*)"/) {
+ my $list = $1;
+ my $sequence = $2;
+ my $next = $sequence - 1;
+ $rule = $3;
+
+ $rule =~ s/\\@/\@/;
+
+ $rule = "<a href=\"/maps/php/list.php?type=$list&next=$next\">$list:$sequence</a>/$hit_count $rule";
+ } # if
+ } # if