OSDN Git Service

Add a (virtual) channel, named '*console*', for gathering system
authormatusita <matusita@180c8125-5b33-4295-ad04-72a68a15b4cc>
Fri, 2 May 2008 15:22:47 +0000 (15:22 +0000)
committermatusita <matusita@180c8125-5b33-4295-ad04-72a68a15b4cc>
Fri, 2 May 2008 15:22:47 +0000 (15:22 +0000)
information.  At this time, all join/leave messages are shown.

This is enabled by a new option, show_console.

Closes #12452.

ChangeLog
etc/dot.keitairc
lib/Keitairc/Config.pm
lib/Keitairc/IrcCallback.pm

index 5d816f0..ee2c394 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-05-03  Makoto Matsushita  <matusita@galdvalion.matatabi.or.jp>
+
+       * etc/dot.keitairc, lib/Keitairc/Config.pm,
+       lib/Keitairc/IrcCallback.pm: join/leave\e$B%a%C%;!<%8$r$^$H$a$FI=<($9\e(B
+       \e$B$k%7%9%F%`%a%C%;!<%8MQ\e(B(\e$B2>A[\e(B)\e$B%A%c%s%M%k$rI=<($9$k$?$a$N%*%W%7%g%s$r\e(B
+       \e$BDI2C\e(B (thanks to Takahashi Yoshihiro)\e$B!%\e(B Closes #12452.
+
 2008-05-02  Makoto Matsushita  <matusita@jp.FreeBSD.org>
 
        * keitairc, etc/dot.keitairc, lib/Keitairc/Config.pm,
index b9b57c1..d221825 100644 (file)
@@ -1,7 +1,7 @@
 #
 # sample ~/.keitairc for keitairc 2.x
 #
-# $Id: dot.keitairc,v 1.10 2008-05-02 14:50:12 matusita Exp $
+# $Id: dot.keitairc,v 1.11 2008-05-02 15:22:47 matusita Exp $
 # $Source: /home/ishikawa/work/keitairc/tmp/keitairc/etc/dot.keitairc,v $
 
 ################################################################
@@ -86,6 +86,10 @@ web_password = 1234
 # Set to this value to '0' to disable.
 # show_joinleave = 0
 
+# Create '*console*' channel for gathering IRC system message.
+# Works with show_joinleave is not zero.
+# show_console = 1
+
 # Set to 1 if you wanna daemonize keitairc.
 # daemonize = 1
 
index 35d5e44..bb529f3 100644 (file)
@@ -1,6 +1,6 @@
 # -*-perl-*-
 # Keitairc::Config
-# $Id: Config.pm,v 1.10 2008-05-02 14:49:23 matusita Exp $
+# $Id: Config.pm,v 1.11 2008-05-02 15:22:47 matusita Exp $
 # $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/Config.pm,v $
 #
 # Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
@@ -31,7 +31,8 @@ sub new{
                   use_cookie cookie_ttl session_ttl
                   web_port web_title web_lines web_root
                   web_username web_password web_host
-                  show_newmsgonly show_joinleave ping_delay reconnect_delay
+                  show_newmsgonly show_joinleave show_console
+                  ping_delay reconnect_delay
                   smtp_server smtp_from smtp_to debug
                   template_dir version daemonize pid_dir pid_file plugin_dir
                   reverse_message reverse_recent reverse_unread)
index 22b3e65..8e88093 100644 (file)
@@ -1,6 +1,6 @@
 # -*-perl-*-
 # Keitairc::IrcCallback
-# $Id: IrcCallback.pm,v 1.7 2008-05-02 14:49:23 matusita Exp $
+# $Id: IrcCallback.pm,v 1.8 2008-05-02 15:22:47 matusita Exp $
 # $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/IrcCallback.pm,v $
 #
 # Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
@@ -55,9 +55,17 @@ sub irc_join{
        $channel =~ s/ .*//;
 
        $ib->join($channel);
-       if($who ne $cf->irc_nick()){
-               my $cid = $ib->name2cid($channel);
-               $ib->add_message($cid, "$who joined") if ($cf->show_joinleave());
+       if($who ne $cf->irc_nick() && $cf->show_joinleave()) {
+               my $cid;
+               if ($cf->show_console()) {
+                       my $ch = $channel;
+                       Encode::from_to($ch, 'jis', 'euc-jp');
+                       $cid = $ib->name2cid("*Console*");
+                       $ib->add_message($cid, "$who joined to $ch");
+               } else {
+                       $cid = $ib->name2cid($channel);
+                       $ib->add_message($cid, "$who joined");
+               }
        }
 
        $heap->{Irc}->yield(who => $channel);
@@ -78,8 +86,15 @@ sub irc_part{
        my $cid = $ib->name2cid($channel);
        if($who eq $cf->irc_nick()){
                $ib->part($cid);
-       } else {
-               $ib->add_message($cid, "$who leaves") if ($cf->show_joinleave());
+       } elsif ($cf->show_joinleave()) {
+               if ($cf->show_console()) {
+                       my $ch = $channel;
+                       Encode::from_to($ch, 'jis', 'euc-jp');
+                       $ib->add_message($ib->name2cid("*Console*"),
+                                        "$who leaves from $ch");
+               } else {
+                       $ib->add_message($cid, "$who leaves");
+               }
        }
        $ib->remove_nick($cid, $who);
        $heap->{seen_traffic} = 1;