- foreach my $sender (ReturnSenders $userid, $type, $next, $lines, $date) {
- my @msgs = ReturnMessages $userid, $sender;
- my @msgs2 = @msgs;
+ my @senders = ReturnSenders(
+ userid => $userid,
+ type => $type,
+ start_at => $next,
+ lines => $lines,
+ date => $date
+ );
+
+ for my $sender (@senders) {
+ my $msgs = ReturnMessages(
+ userid => $userid,
+ sender => $sender,
+ );
+
+ my $leftclass = 'tableleftdata';
+ my $dataclass = 'tabledata';
+ my $rightclass = 'tablerightdata';
+ my $senderclass = 'sender';
+ my $subjectclass = 'subject';
+
+ # Check to see if this is the last line
+ if ((($next + 1) % $lines) == (@senders % $lines)) {
+ # We always "bottom" the first column
+ $leftclass = 'tablebottomleft';
+
+ # Check to see if there any message lines to display
+ unless (@$msgs) {
+ $dataclass = 'tablebottomdata';
+ $rightclass = 'tablebottomright';
+ $senderclass = 'senderbottom';
+ } # unless
+ } # if