#!/usr/bin/perl
# keitairc
-# $Id: keitairc,v 1.37 2008-01-13 09:30:39 morimoto Exp $
+# $Id: keitairc,v 1.38 2008-01-13 10:14:55 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/keitairc,v $
#
# Copyright (c) 2003-2008 Jun Morimoto <morimoto@mrmt.net>
next unless length;
$_ = $ib->simple_escape($_);
+ $_ = $ib->colorize($_);
for my $name ($pl->list_replace_plugins()){
last if s/$pl->{plugins}->{$name}->{message_replace_regexp}/$pl->{plugins}->{$name}->{message_replace_imprementation}($session_id, $1, $2, $3, $4, $5, $6, $7, $8, $9)/eg;
# -*-perl-*-
# Keitairc::IrcBuffer
-# $Id: IrcBuffer.pm,v 1.4 2008-01-13 09:30:39 morimoto Exp $
+# $Id: IrcBuffer.pm,v 1.5 2008-01-13 10:14:55 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/IrcBuffer.pm,v $
#
# Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
$_;
}
+################################################################
+sub colorize{
+ my $me = shift;
+ local($_) = shift;
+
+ my %ct = (
+ 1 => 'Black',
+ 2 => '#000080', # Navy Blue
+ 3 => 'Green',
+ 4 => 'Red',
+ 5 => 'Maroon',
+ 6 => 'Purple',
+ 7 => 'Olive',
+ 8 => 'Yellow',
+ 9 => '#32cd32', # Lime Green
+ 10 => 'Teal',
+ 11 => 'Aqua',
+ 12 => '#4169e1', # Royal Blue
+ 13 => '#ff69b4', # Hot Pink
+ 14 => '#a9a9a9', # Dark Gray
+ 15 => '#d3d3d3', # Light Gray
+ 16 => 'White');
+ my $colored = 0;
+
+ do{
+ if($colored){
+ s|\x03(\d{1,2})|sprintf('</font><font color="%s">', $ct{0+$1})|e;
+ }else{
+ s|\x03(\d{1,2})|sprintf('<font color="%s">', $ct{0+$1})|e;
+ $colored = 1;
+ }
+ }while(m|\x03\d{1,2}|);
+
+ # s|\x03|</font>|g if $colored;
+ $_ .= '</font>' if $colored;
+
+ $_;
+}
+
1;