- my ($day,$month,$year) = (localtime(time()))[3,4,5];
- my $newlogDate = sprintf("%04d%02d%02d",$year+1900,$month+1,$day);
- if (defined $logDate and $newlogDate != $logDate) {
- &closeLog();
- &compress($file{log});
- &openLog();
- }
- } else {
- $date = time();
+ # public message on channel.
+ my $name = $1;
+
+ if ($addressed) {
+ print "$b_red$name $printable$ob\n";
+ }
+ else {
+ print "$b_cyan$name$ob $printable$ob\n";
+ }
+
+ }
+ elsif ( $printable =~ s/^\* (\S+)\/(\S+) // ) {
+
+ # public action.
+ print "$b_white*$ob $b_cyan$1$ob/$b_blue$2$ob $printable\n";
+
+ }
+ elsif ( $printable =~ s/^(-\S+-) // ) {
+
+ # notice
+ print "$_green$1 $printable$ob\n";
+
+ }
+ elsif ( $printable =~ s/^(\* )?(\[\S+\]) // ) {
+
+ # message/private action from someone
+ print "$b_white$1$ob" if ( defined $1 );
+ print "$b_red$2 $printable$ob\n";
+
+ }
+ elsif ( $printable =~ s/^(>\S+<) // ) {
+
+ # i'm messaging someone
+ print "$b_magenta$1 $printable$ob\n";
+
+ }
+ elsif ( $printable =~ s/^(enter:|update:|forget:) // ) {
+
+ # something that should be SEEN
+ print "$b_green$1 $printable$ob\n";
+
+ }
+ else {
+ print "$printable\n";
+ }
+
+ }
+ else {
+
+ #print "VERBOSITY IS OFF?\n";
+ }
+
+ # log the line into a file.
+ return unless ( &IsParam('logfile') );
+ return unless ( defined fileno LOG );
+
+ # remove control characters from logging to LOGFILE.
+ for ($input) {
+ last if ( &IsParam('logColors') );
+ s/\e\[[0-9;]+m//g; # escape codes.
+ s/[\cA-\c_]//g; # control chars.
+ }
+ $input = "FORK($$) " . $input if ($statcountfix);
+
+ my $date;
+ if ( &IsParam('logType') and $param{'logType'} =~ /DAILY/i ) {
+ $date = sprintf( '%02d:%02d.%02d', ( gmtime $time )[ 2, 1, 0 ] );
+
+ my ( $day, $month, $year ) = ( gmtime $time )[ 3, 4, 5 ];
+ my $newlogDate =
+ sprintf( '%04d%02d%02d', $year + 1900, $month + 1, $day );
+ if ( defined $logDate and $newlogDate != $logDate ) {
+ &closeLog();
+ &compress( $file{log} );
+ &openLog();
+ }
+ }
+ else {
+ $date = $time;