#!/usr/bin/perl
print <
IRC Log
EOF
while (<>) {
chomp;
s{^\[(\d+-\d+-\d+) (\d+:\d+:\d+)\] }{};
$date = $1;
$time = $2;
if ($date ne $curdate) {
print " $date |
\n";
$curdate = $date;
}
if (s{^<([^:]+):([^>]+)> }{}) {
$nick = $1;
$channel = $2;
$outnick = "<$nick>";
} elsif (s{^\* ([^/]+)/([^ ]+) }{}) {
$nick = $1;
$channel = $2;
$outnick = "* $nick";
}
if ($channel ne $curchan) {
print " $channel |
\n";
$curchan = $channel;
}
s{&}{&}g;
s{<}{<}g;
s{>}{>}g;
s{([^]*)}{$1}g;
s{([^]*)}{$1}g;
if ($outnick) {
s{^}{$outnick };
}
s{^}{ | $time | };
s{$}{ |
};
print "$_\n";
}
print <