OSDN Git Service

imported http://mrmt.net/src/keitairc/keitairc r1.4
authormorimoto <morimoto@180c8125-5b33-4295-ad04-72a68a15b4cc>
Sun, 21 Mar 2004 11:01:50 +0000 (11:01 +0000)
committermorimoto <morimoto@180c8125-5b33-4295-ad04-72a68a15b4cc>
Sun, 21 Mar 2004 11:01:50 +0000 (11:01 +0000)
keitairc

index 570dc1d..5e544f7 100755 (executable)
--- a/keitairc
+++ b/keitairc
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 # keitairc
-# $Id: keitairc,v 1.3 2004-03-21 11:01:33 morimoto Exp $
+# $Id: keitairc,v 1.4 2004-03-21 11:01:50 morimoto Exp $
 #
 # Copyright (c) 2003 Jun Morimoto <morimoto@xantia.citroen.org>
 # This program is covered by the GNU General Public License 2
@@ -31,9 +31,8 @@ my $config = AppConfig->new(
                               web_username web_password)
                            );
 
-unless($config->file($ENV{'HOME'} . '/.keitairc')){
-    $config->file('/etc/keitairc');
-}
+$config->file('/etc/keitairc');
+$config->file($ENV{'HOME'} . '/.keitairc');
 $config->args;
 
 my (%channels, %buffer, %atime, %mtime);
@@ -83,7 +82,11 @@ sub on_irc_join{
 ################################################################
 sub on_irc_part{
     my ($kernel, $who, $channel) = @_[KERNEL, ARG0, ARG1];
-    $channel = Jcode->new($channel->[0])->euc;
+
+    # chop off after the gap (bug workaround of POE::Filter::IRC)
+    $channel =~ s/ .*//;
+
+    $channel = Jcode->new($channel)->euc;
     delete $channels{$channel};
 }
 
@@ -145,7 +148,9 @@ sub index_page{
     my $buf;
     my $accesskey = 1;
 
-    for my $channel (sort(keys(%channels))){
+    for my $channel (sort {
+       $mtime{$b} <=> $mtime{$a};
+    }(keys(%channels))){
 
        if($accesskey < 10){
            $buf .= sprintf('&#%d;', 63878 + $accesskey);