#!/usr/bin/perl -w use strict; use warnings; my %namelites = ( "Zin" => 1, "Juggelo" => 1, "Ulath" => 1, ); my %specials = ( "[" => [ "[", "]", "mortal" ], "{" => [ "{", "}", "raceldr" ], "(" => [ "(", ")", "birther" ], "<" => [ "<", ">", "wizard" ], ); my %baselites = ( "sales" => "c1", "nightlife+" => "c2", "bat" => "c3", "wanted" => "c4", "mage" => "c4", ); sub tq($) { my ($str) = @_; $str =~ s/&/&/; $str =~ s//>/; $str =~ s/ä/ä/; $str =~ s/ö/ö/; $str =~ s/Ä/Ä/; $str =~ s/Ö/Ö/; return $str; } my ($b1, $b2, $qc, $bt); sub update($$$) { my ($ctype, $chn, $name) = @_; $qc = " class=\"c0\""; if (defined($baselites{$chn})) { my $str = $baselites{$chn}; if (substr($str, 0, 1) eq "#") { $qc = " style=\"color: ".$str."\""; } else { $qc = " class=\"".$str."\""; } } if (defined($specials{$ctype})) { $b1 = $specials{$ctype}[0]; $b2 = $specials{$ctype}[1]; $bt = " class=\"".$specials{$ctype}[2]."\""; } else { $bt = $b1 = $b2 = ""; } if (defined($namelites{$name})) { $qc = $bt; } } sub span($$) { print "".tq($_[1])."
\n"; } print << 'EOT'; Logfile
EOT my $nline = 0; while (defined(my $line = )) { $nline++; $line =~ s@\s+$@@; $line =~ s@^s+@@; if ($line =~ /^([A-ZäöåÄÖÅ][A-Za-zäöåÄÖÅ '-]+) ([\(\<\{\[])([a-z+]+)([\]\}\>\)])\: (.*)$/) { # Channel say update($2, $3, $1); print "".tq($1)." ".$b1."".tq($3)."".$b2.": ".tq($5)."
\n"; } elsif ($line =~ /^([\(\<\{\[])([a-z+]+)([\]\}\>\)])\: (.*)$/) { # Channel emotes my ($brace, $chn, $text) = ($1, $2, $4); my $name = ""; if ($text =~ /^([A-Z][a-z]+)(.*)$/) { $name = $1; } update($brace, $chn, $name); print "".$b1."". "".tq($chn)."". "".$b2.": ".tq($text)."
\n"; } elsif ($line =~ /^([A-Z][a-z]+) tells ([^\']+) \'(.*)\'$/) { # Someone send tell to you span("r_tell", $line); } elsif ($line =~ /^\@([A-Z][a-z]+) .+$/) { # Received emotes span("r_emote", $line); } elsif ($line =~ /^([A-Z][a-z]+) tells ([^\']+) \'(.*)\' \(([A-Za-z0-9 :]+)\)$/) { # Offline tells span("r_offtell", $line); } elsif ($line =~ /^You tell ([^\']+) \'(.*)\'$/) { # You send tell to one or more people span("s_tell", $line); } elsif ($line =~ /^Info: .+$/) { # Inform lines span("inform", $line); } elsif ($line =~ /^-- *$/) { print "

\n"; } elsif ($line =~ / (says|exclaims|roars) /) { span("r_say", $line); } else { # All other lines print tq($line)."
\n"; } } print << 'EOT';

Valid XHTML 1.0 Strict

EOT