# -*-perl-*-
# keitairc/lib/plugins/00index
# チャネル一覧
# $Id: 00index,v 1.1 2008-01-09 19:30:34 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00index,v $
$plugin = {
name => 'index',
action_imprementation => sub {
my ($request, $name, $session_id, $param_string) = @_;
my $unread_channels = 0;
my $accesskey = 1;
my $buf;
for my $channel ($::ib->channels()){
if($accesskey < 10){
$buf .= sprintf('[%1d] %s',
$accesskey,
::uri_escape($channel),
$accesskey,
$::ib->compact_channel_name($::ib->name($channel)));
}else{
$buf .= sprintf(' %s',
::uri_escape($channel),
$::ib->compact_channel_name($::ib->name($channel)));
}
$accesskey++;
# 未読行数
if($::ib->unread_lines($channel)){
$buf .= sprintf(' %s',
::uri_escape($channel),
$::ib->unread_lines($channel));
$unread_channels++;
}
$buf .= "
\n";
}
my $ci = new Keitairc::ClientInfo($request);
my $view = new Keitairc::View($::cf, $ci);
return $view->render('index.html',
{
buf => $buf,
unread => $unread_channels,
});
}
};
1;