OSDN Git Service

*** empty log message ***
authormorimoto <morimoto@180c8125-5b33-4295-ad04-72a68a15b4cc>
Sat, 24 Jul 2004 08:54:51 +0000 (08:54 +0000)
committermorimoto <morimoto@180c8125-5b33-4295-ad04-72a68a15b4cc>
Sat, 24 Jul 2004 08:54:51 +0000 (08:54 +0000)
keitairc

index 741c161..cc97cde 100755 (executable)
--- a/keitairc
+++ b/keitairc
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 # keitairc
-# $Id: keitairc,v 1.20 2004-06-07 01:27:57 morimoto Exp $
+# $Id: keitairc,v 1.21 2004-07-24 08:54:51 morimoto Exp $
 #
 # Copyright (c) 2003 Jun Morimoto <morimoto@xantia.citroen.org>
 # This program is covered by the GNU General Public License 2
@@ -8,7 +8,7 @@
 # Depends: libjcode-pm-perl, libpoe-component-irc-perl,
 #   liburi-perl, libwww-perl, libappconfig-perl
 
-my $rcsid = q$Id: keitairc,v 1.20 2004-06-07 01:27:57 morimoto Exp $;
+my $rcsid = q$Id: keitairc,v 1.21 2004-07-24 08:54:51 morimoto Exp $;
 my ($version) = $rcsid =~ m#,v ([0-9.]+)#;
 
 use strict;
@@ -66,6 +66,7 @@ POE::Session->new(
                  irc_part => \&on_irc_part,
                  irc_public => \&on_irc_public,
                  irc_notice => \&on_irc_notice,
+                 irc_ctcp_action => \&on_irc_ctcp_action,
                  );
 
 # web server component
@@ -141,6 +142,15 @@ sub on_irc_notice{
 }
 
 ################################################################
+sub on_irc_ctcp_action{
+    my ($kernel, $who, $channel, $msg) = @_[KERNEL, ARG0 .. ARG2];
+    $who =~ s/!.*//;
+    $channel = $channel->[0];
+    $msg = sprintf('* %s %s', $who, Jcode->new($msg, 'jis')->euc);
+    &add_message($channel, '', $msg);
+}
+
+################################################################
 # $msg \e$B$O\e(B EUC \e$B$K$J$C$F$$$k$O$:\e(B
 # $channel \e$B$O\e(B jis \e$B$G$-$F$k$>\e(B
 sub add_message{
@@ -192,9 +202,9 @@ sub now{
 ################################################################
 sub escape{
     local($_) = shift;
-    s/&/&amp;/;
-    s/>/&gt;/;
-    s/</&lt;/;
+    s/&/&amp;/g;
+    s/>/&gt;/g;
+    s/</&lt;/g;
     $_;
 }