#!/usr/bin/perl -w
# $Id$
# fucknet darabolo by grin, 2004/4/27
#

use IO::File;

opendir( D, '.' ) or die "dir";
my @dir = grep { -f $_ } readdir( D );
closedir(D);

my %mail;

foreach my $file (@dir) {
	my $f=new IO::File "< $file" or die "$file nem nyilik";
	while( <$f> ) {
		chomp;
		if( /Area: (\S+?)\s+/ ) { $mail{'area'}=$1; }
		elsif( /Date: (\S+?)\s+/) { $mail{'date'}=$1; }
		elsif( /From: (.+?)\s+Read:/ ) { $mail{'from'}=$1; }
		elsif( /To: (.+?)\s+Mark:/ ) { $mail{'to'}=$1; }
		elsif( /Subj: (.+?)\s*$/ ) { $mail{'subj'}=$1; }
	}
	if( $mail{'from'} ne "" ) {
		my $link1="<a href=\"$file\">";
		print "<tr>";
		print "<td>$mail{'area'}</td>";
		print "<td>$link1$mail{'date'}</a></td>";
		print "<td>$mail{'from'}</td>";
		print "<td>$mail{'to'}</td>";
		print "<td>$link1$mail{'subj'}</a></td>";
		print "</tr>\n";
	}
	undef %mail;
}
