From: timriker Date: Sat, 22 Jan 2005 10:31:01 +0000 (+0000) Subject: move to channel html and colorize more msgs X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6ce38ea0bb8be6ca89edda734fa71c1ca0253f74;p=infobot.git move to channel html and colorize more msgs git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1114 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/scripts/irclog2html.pl b/scripts/irclog2html.pl index fa4b2ae..6ae27e5 100755 --- a/scripts/irclog2html.pl +++ b/scripts/irclog2html.pl @@ -164,7 +164,7 @@ sub output_timenicktext { } sub output_timeservermsg { - my ($date, $time, $line) = @_; + my ($date, $time, $channel, $line) = @_; my $lineout = ''; if ($STYLE =~ /table/) { @@ -176,7 +176,7 @@ sub output_timeservermsg { $lineout .= "$time " if $time; $lineout .= "$line
\n"; } - output_line($date, $time,'',$lineout); + output_line($date, $time, $channel, $lineout); } sub html_rgb @@ -225,14 +225,13 @@ sub main { chomp $line; if (!$line eq "") { - - # parse out the time if ($line =~ s/^([0-9:\.]*) (.*)$/$2/) { $time = $1; } else { - $time = ""; + $time = ''; } + $channel = ''; # Replace ampersands, pointies, control characters # $line =~ s/&/&\;/g; @@ -271,45 +270,40 @@ sub main { $htmlcolour = $colour_nick{$nick} = html_rgb($nickcount, $NICKMAX); } output_timenicktext($date, $time, $channel, $nick, $text, $htmlcolour); - } - - elsif ($line =~ /^>\;>\;>\; /) { + } elsif ($line =~ /^>\;>\;>\; /) { $line =~ s/^>\;>\;>\; /\*\*\* /; # Process changed nick results, and remember colours accordingly # - if ($line =~ /\*\*\* (.*?) are|is now known as (.*)/) { - my $nick_old; - my $nick_new; - - $nick_old = $line; - $nick_old =~ s/\*\*\* (.*?) (are|is) now known as .*/$1/; + if ($line =~ /\*\*\* (.*?) materializes into (.*)/) { + my $nick_old = $1; + my $nick_new = $2; - $nick_new = $line; - $nick_new =~ s/\*\*\* .*? (are|is) now known as (.*)/$2/; + #$nick_old = $line; + #$nick_old =~ s/\*\*\* (.*?) materializes into .*/$1/; + #$nick_new = $line; + #$nick_new =~ s/\*\*\* (.*?) materializes into (.*)/$2/; $colour_nick{$nick_new} = $colour_nick{$nick_old}; $colour_nick{$nick_old} = undef; $line =~ s/(\*\*\* .*)/$1<\/font>/ - } - - # Colourise joined/left/server messages # - elsif ($line =~ /\*\*\* .*left|quit/) { - $line =~ s/(\*\*\* .*)/$1<\/font>/; - } - elsif ($line =~ /\*\*\* .*joined/) { + } elsif ($line =~ /\*\*\* (join|mode|topic)\/(.*?) .*/) { + $channel = lc $2; $line =~ s/(\*\*\* .*)/$1<\/font>/; - } - elsif ($line =~ /\*\*\* /) { + } elsif ($line =~ /\*\*\* (part|kick|banned)\/(.*?) .*/) { + $channel = lc $2; + $line =~ s/(\*\*\* .*)/$1<\/font>/; + } elsif ($line =~ /\*\*\* .* has signed off IRC .*/) { + # Colourise joined/left/server messages # + $line =~ s/(\*\*\* .*)/$1<\/font>/; + } elsif ($line =~ /\*\*\* /) { $line =~ s/(\*\*\* .*)$/$1<\/font>/; - } - - # Colourise the /me's # - elsif ($line =~ /^\* .*$/) { + } elsif ($line =~ /^\* .*$/) { + # Colourise the /me's # $line =~ s/^(\*.*)$/$1<\/font>/; } - output_timeservermsg($date, $time, $line); + output_timeservermsg($date, $time, $channel, $line); } } }