From: matusita Date: Fri, 2 May 2008 15:22:47 +0000 (+0000) Subject: Add a (virtual) channel, named '*console*', for gathering system X-Git-Tag: tag20080719~39 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=c14e9f4c3e492b5038b474c1f19e40e0958bc00f;p=keitairc%2Fkeitairc.git Add a (virtual) channel, named '*console*', for gathering system information. At this time, all join/leave messages are shown. This is enabled by a new option, show_console. Closes #12452. --- diff --git a/ChangeLog b/ChangeLog index 5d816f0..ee2c394 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-05-03 Makoto Matsushita + + * etc/dot.keitairc, lib/Keitairc/Config.pm, + lib/Keitairc/IrcCallback.pm: join/leaveメッセージをまとめて表示す + るシステムメッセージ用(仮想)チャンネルを表示するためのオプションを + 追加 (thanks to Takahashi Yoshihiro). Closes #12452. + 2008-05-02 Makoto Matsushita * keitairc, etc/dot.keitairc, lib/Keitairc/Config.pm, diff --git a/etc/dot.keitairc b/etc/dot.keitairc index b9b57c1..d221825 100644 --- a/etc/dot.keitairc +++ b/etc/dot.keitairc @@ -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 diff --git a/lib/Keitairc/Config.pm b/lib/Keitairc/Config.pm index 35d5e44..bb529f3 100644 --- a/lib/Keitairc/Config.pm +++ b/lib/Keitairc/Config.pm @@ -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 @@ -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) diff --git a/lib/Keitairc/IrcCallback.pm b/lib/Keitairc/IrcCallback.pm index 22b3e65..8e88093 100644 --- a/lib/Keitairc/IrcCallback.pm +++ b/lib/Keitairc/IrcCallback.pm @@ -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 @@ -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;