#!/usr/bin/perl
# keitairc
-# $Id: keitairc,v 1.8 2004-03-21 11:02:59 morimoto Exp $
+# $Id: keitairc,v 1.9 2004-03-21 11:03:19 morimoto Exp $
#
# Copyright (c) 2003 Jun Morimoto <morimoto@xantia.citroen.org>
# This program is covered by the GNU General Public License 2
# Depends: libjcode-pm-perl, libpoe-component-irc-perl,
# liburi-perl, libwww-perl, libappconfig-perl
-my $rcsid = q$Id: keitairc,v 1.8 2004-03-21 11:02:59 morimoto Exp $;
+my $rcsid = q$Id: keitairc,v 1.9 2004-03-21 11:03:19 morimoto Exp $;
my ($version) = $rcsid =~ m#,v ([0-9.]+)#;
use strict;
use Jcode;
use POE;
use POE::Component::Server::TCP;
-use POE::Component::IRC;
use POE::Filter::HTTPD;
+use POE::Component::IRC;
use URI::Escape;
use HTTP::Response;
use AppConfig qw(:argcount);
my %channel_buffer;
# \e$B3F%A%c%M%k$N:G=*%"%/%;%9;~9o!":G?7H/8@;~9o\e(B
-my (%atime, %mtime);
+my %mtime;
+
+# unread lines
+my %unread;
# irc component
POE::Component::IRC->new('keitairc');
}
$mtime{$channel} = time;
+ $unread{$channel}++;
+ if ($unread{$channel} > $config->web_lines) {
+ $unread{$channel} = $config->web_lines;
+ }
}
################################################################
$buf .= &label($accesskey);
- unless(defined($channel_buffer{$channel})){
- $buf .= &compact_channel_name($channel);
- }else{
- if($accesskey < 10){
- $buf .= sprintf('<a accesskey="%1d" href="%s%s">%s</a>',
- $accesskey,
- $docroot,
- uri_escape($channel),
- &compact_channel_name($channel));
- }else{
+ if($accesskey < 10){
+ $buf .= sprintf('<a accesskey="%1d" href="%s%s">%s</a>',
+ $accesskey,
+ $docroot,
+ uri_escape($channel),
+ &compact_channel_name($channel));
+ }else{
$buf .= sprintf('<a href="%s%s">%s</a>',
- $docroot,
- uri_escape($channel),
- &compact_channel_name($channel));
- }
- }
+ $docroot,
+ uri_escape($channel),
+ &compact_channel_name($channel));
+ }
$accesskey++;
- if($atime{$channel} < $mtime{$channel}){
- $buf .= '*';
+ if($unread{$channel} > 0){
+ $buf .= sprintf(' (%d)', $unread{$channel});
}
$buf .= '<br>';
}
$buf .= qq(<a href="$docroot" accesskey="0"></a>);
- $buf .= qq( - keitairc $version);
+ $buf .= qq( - keitairc $version +);
$buf;
}
$content .= '<a name="1"></a>';
$content .= '<a accesskey="7" href="#1"></a>';
+ $content .= '<a accesskey="8" href="../"></a>';
$content .= sprintf('<form action="%s%s" method="post">',
$docroot, $uri);
$content .= '<input type="submit" accesskey="1" value="OK">';
# $content .= '<input type="submit" accesskey="1" value="聆">';
$content .= '</form>';
+ $content .= '<a href="../">..back (push 8)</a><BR>';
if(defined($channel_name{$channel})){
if(defined($channel_buffer{$channel}) &&
$content .= "no such channel";
}
- $atime{$channel} = time;
+ $unread{$channel} = 0;
}
$content .= '</body></html>';