- my ($date) = @_;
- my $files;
-
- my $line;
- my $time;
- my $lastdate = "";
- my $nick;
- my $channel;
- my $text;
-
- my $htmlcolour;
- my $nickcount = 0;
- my $NICKMAX = 30;
-
- my %colour_nick = %prefs_colour_nick;
-
- while ($line = <STDIN>) {
-
- chomp $line;
-
- if (!$line eq "") {
-
- # parse out the time
- if ($line =~ s/^([0-9:\.]*) (.*)$/\2/) {
- $time = $1;
- } else {
- $time = "";
- }
-
- # Replace ampersands, pointies, control characters #
- $line =~ s/&/&\;/g;
- $line =~ s/</<\;/g;
- $line =~ s/>/>\;/g;
- $line =~ s/\e\[[0-1]*m//g;
- $line =~ s/[\x00-\x1f]+//g;
-
- # Replace possible URLs with links #
- $line =~ s/((http|https|ftp|gopher|news):\/\/\S*)/<a href="$1">$1<\/a>/g;
-
- # Colourise the comments
- if ($line =~ /^<\;[^\/]*?\/\#.*?>\; .*$/) {
- # Split $nick, $channel and $line
- $nick = $line;
- $nick =~ s/^<\;([^\/]*?)\/\#.*?>\; .*$/$1/;
- $channel = $line;
- $channel =~ s/^<\;[^\/]*?\/\#(.*?)>\; .*$/$1/;
-
- # $nick =~ tr/[A-Z]/[a-z]/;
- # <======= move this into another function when getting nick colour
-
- $text = $line;
- $text =~ s/^<\;.*?>\; (.*)$/$1/;
- $text =~ s/ / \; \;/g;
-
- $htmlcolour = $colour_nick{$nick};
- if (!defined($htmlcolour)) {
- # new nick
- $nickcount++;
-
- # if we've exceeded our estimate of the number of nicks, double it
- $NICKMAX *= 2 if $nickcount >= $NICKMAX;
-
- $htmlcolour = $colour_nick{$nick} = html_rgb($nickcount, $NICKMAX);
- }
- output_timenicktext($date, $time, $channel, $nick, $text, $htmlcolour);
- }
-
- 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/;
-
- $nick_new = $line;
- $nick_new =~ s/\*\*\* .*? (are|is) now known as (.*)/$2/;
-
- $colour_nick{$nick_new} = $colour_nick{$nick_old};
- $colour_nick{$nick_old} = undef;
-
- $line =~ s/(\*\*\* .*)/<font color=\"$colour_nickchange\">$1<\/font>/
- }
-
- # Colourise joined/left/server messages #
- elsif ($line =~ /\*\*\* .*left|quit/) {
- $line =~ s/(\*\*\* .*)/<font color=\"$colour_left\">$1<\/font>/;
- }
- elsif ($line =~ /\*\*\* .*joined/) {
- $line =~ s/(\*\*\* .*)/<font color=\"$colour_joined\">$1<\/font>/;
- }
- elsif ($line =~ /\*\*\* /) {
- $line =~ s/(\*\*\* .*)$/<font color=\"$colour_server\">$1<\/font>/;
- }
-
- # Colourise the /me's #
- elsif ($line =~ /^\* .*$/) {
- $line =~ s/^(\*.*)$/<font color=\"$colour_action\">$1<\/font>/;
- }
-
- output_timeservermsg($date, $time, $line);
- }
- }
- }
-
- add_footers();
-
- return 0;
+ my ($date) = @_;
+ my $files;
+
+ my $line;
+ my $time;
+ my $lastdate = "";
+ my $nick;
+ my $channel;
+ my $text;
+
+ my $htmlcolour;
+ my $nickcount = 0;
+ my $NICKMAX = 30;
+
+ my %colour_nick = %prefs_colour_nick;
+
+ while ( $line = <STDIN> ) {
+
+ chomp $line;
+
+ if ( !$line eq "" ) {
+
+ # parse out the time
+ if ( $line =~ s/^([0-9:\.]*) (.*)$/$2/ ) {
+ $time = $1;
+ }
+ else {
+ $time = '';
+ }
+ $channel = '';
+
+ # Replace ampersands, pointies, control characters #
+ $line =~ s/&/&\;/g;
+ $line =~ s/</<\;/g;
+ $line =~ s/>/>\;/g;
+ $line =~ s/\e\[[0-1]*m//g;
+ $line =~ s/[\x00-\x1f]+//g;
+
+ # Replace possible URLs with links #
+ $line =~
+ s/((http|https|ftp|gopher|news):\/\/\S*)/<a href="$1">$1<\/a>/g;
+
+ # Colourise the comments
+ if ( $line =~ /^<\;[^\/]*?\/\#.*?>\; .*$/ ) {
+
+ # Split $nick, $channel and $line
+ $nick = $line;
+ $nick =~ s/^<\;([^\/]*?)\/\#.*?>\; .*$/$1/;
+ $channel = $line;
+ $channel =~ s/^<\;[^\/]*?\/(\#.*?)>\; .*$/$1/;
+
+ # $nick =~ tr/[A-Z]/[a-z]/;
+ # <======= move this into another function when getting nick colour
+
+ $text = $line;
+ $text =~ s/^<\;.*?>\; (.*)$/$1/;
+ $text =~ s/^ .*/<\;PROTECTED>\;/g;
+ $text =~ s/ / \; \;/g;
+
+ $htmlcolour = $colour_nick{$nick};
+ if ( !defined($htmlcolour) ) {
+
+ # new nick
+ $nickcount++;
+
+ # if we've exceeded our estimate of the number of nicks, double it
+ $NICKMAX *= 2 if $nickcount >= $NICKMAX;
+
+ $htmlcolour = $colour_nick{$nick} =
+ html_rgb( $nickcount, $NICKMAX );
+ }
+ output_timenicktext( $date, $time, $channel, $nick, $text,
+ $htmlcolour );
+ }
+ elsif ( $line =~ /^>\;>\;>\; / ) {
+ $line =~ s/^>\;>\;>\; /\*\*\* /;
+
+ # Process changed nick results, and remember colours accordingly #
+ if ( $line =~ /\*\*\* (.*?) materializes into (.*)/ ) {
+ my $nick_old = $1;
+ my $nick_new = $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/(\*\*\* .*)/<font color=\"$colour_nickchange\">$1<\/font>/;
+ }
+ elsif ( $line =~ /\*\*\* (join|mode|topic)\/(.*?) .*/ ) {
+ $channel = lc $2;
+ $line =~
+ s/(\*\*\* .*)/<font color=\"$colour_joined\">$1<\/font>/;
+ }
+ elsif ( $line =~ /\*\*\* (part|kick|banned)\/(.*?) .*/ ) {
+ $channel = lc $2;
+ $line =~
+ s/(\*\*\* .*)/<font color=\"$colour_left\">$1<\/font>/;
+ }
+ elsif ( $line =~ /\*\*\* .* has signed off IRC .*/ ) {
+
+ # Colourise joined/left/server messages #
+ $line =~
+ s/(\*\*\* .*)/<font color=\"$colour_left\">$1<\/font>/;
+ }
+ elsif ( $line =~ /\*\*\* / ) {
+ $line =~
+ s/(\*\*\* .*)$/<font color=\"$colour_server\">$1<\/font>/;
+ }
+ elsif ( $line =~ /^\* .*$/ ) {
+
+ # Colourise the /me's #
+ $line =~
+ s/^(\*.*)$/<font color=\"$colour_action\">$1<\/font>/;
+ }
+
+ output_timeservermsg( $date, $time, $channel, $line );
+ }
+ }
+ }
+
+ add_footers();
+
+ return 0;