From: matusita Date: Wed, 25 Jun 2008 07:08:05 +0000 (+0000) Subject: Also fixes reconnecting the server. Also support "connect/disconnect" X-Git-Tag: tag20080719~12 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=5a7514e0ff692a93354d7f7a668e8b1b62921ddd;p=keitairc%2Fkeitairc.git Also fixes reconnecting the server. Also support "connect/disconnect" message by *console* buffer. Patches submitted by: Takahashi Yoshihiro --- diff --git a/lib/Keitairc/IrcCallback.pm b/lib/Keitairc/IrcCallback.pm index 23786e9..e58c1e4 100644 --- a/lib/Keitairc/IrcCallback.pm +++ b/lib/Keitairc/IrcCallback.pm @@ -1,6 +1,6 @@ # -*-perl-*- # Keitairc::IrcCallback -# $Id: IrcCallback.pm,v 1.11 2008-06-25 07:05:52 matusita Exp $ +# $Id: IrcCallback.pm,v 1.12 2008-06-25 07:08:05 matusita Exp $ # $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/IrcCallback.pm,v $ # # Copyright (c) 2008 Jun Morimoto @@ -28,9 +28,14 @@ sub irc_001{ my ($kernel, $heap, $sender) = @_[KERNEL, HEAP, SENDER]; my $ib = $heap->{IrcBuffer}; my $cf = $heap->{Config}; - for my $cid ($ib->channels()){ - $ib->add_message($cid, 'Connected to irc server!'); - $ib->part($cid); + my $msg = 'Connected to irc server!'; + + if ($cf->show_console()) { + $ib->add_message($ib->name2cid("*Console*"), $msg); + } else { + for my $cid ($ib->channels()) { + $ib->add_message($cid, $msg); + } } $heap->{disconnect_msg} = 1; $kernel->delay(autoping => $cf->ping_delay()); @@ -286,10 +291,15 @@ sub irc_reconnect{ my ($kernel, $heap) = @_[KERNEL, HEAP]; my $ib = $heap->{IrcBuffer}; my $cf = $heap->{Config}; + my $msg = 'Disconnected from irc server, trying to reconnect...'; if ($heap->{disconnect_msg}) { - for my $cid ($ib->channels()){ - $ib->add_message($cid, 'Disconnected from irc server, trying to reconnect...'); + if ($cf->show_console()) { + $ib->add_message($ib->name2cid("*Console*"), $msg); + } else { + for my $cid ($ib->channels()) { + $ib->add_message($cid, $msg); + } } } $heap->{disconnect_msg} = 0;