OSDN Git Service

fixed Keitairc::IrcBuffer::part()
[keitairc/keitairc.git] / lib / Keitairc / IrcBuffer.pm
index 4c2a424..439dc14 100644 (file)
@@ -1,6 +1,6 @@
 # -*-perl-*-
 # Keitairc::IrcBuffer
-# $Id: IrcBuffer.pm,v 1.6 2008-01-13 15:31:09 morimoto Exp $
+# $Id: IrcBuffer.pm,v 1.8 2008-01-18 16:55:46 morimoto Exp $
 # $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/IrcBuffer.pm,v $
 #
 # Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
@@ -137,7 +137,7 @@ sub cid2name{
 ################################################################
 sub part{
        my($me, $cid) = @_;
-       delete $me->{name}->{$cid};
+       delete $me->{cid2name}->{$cid};
 }
 
 ################################################################
@@ -303,14 +303,19 @@ sub colorize{
        do{
                if($colored){
                        s|\x03(\d{1,2})|sprintf('</font><font color="%s">', $ct{0+$1})|e;
+                       if(s|\x03|</font>|){
+                               $colored = 0;
+                       }
                }else{
-                       s|\x03(\d{1,2})|sprintf('<font color="%s">', $ct{0+$1})|e;
-                       $colored = 1;
+                       if(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;
+       if($colored){
+               $_ .= '</font>';
+       }
 
        $_;
 }