1 # -*- mode: perl; coding: utf-8 -*-
3 # WARNING: This file is a part of Keitairc::Plugins test suite, not
8 action_imprementation => sub {
9 my ($request, $name, $session_id, $param_string) = @_;
11 ::send_message($request);
13 my $unread_channels = 0;
16 my $format_mtime = sub{
19 return if($mtime <= 0);
20 my $timediff = time - $mtime;
22 return $timediff . '秒';
25 return int($timediff/60) . '分';
27 if($timediff < 86400){
28 return int($timediff/3600) . '時間';
30 if($timediff < 86400 * 30){
31 return int($timediff/86400) . '日';
33 if($timediff < 86400 * 365){
34 return int($timediff/86400/30) . 'ヶ月';
36 return int($timediff/86400/365) . '年';
41 for my $cid ($::ib->channels()){
43 my $channel = $::ib->cid2name($cid);
44 my $cname = $::ib->simple_escape(encode($::cf->web_charset(), $::ib->compact_channel_name($cid)));
47 sprintf('<a accesskey="%1d" href="all/%d">[%1d] %s</a>',
54 sprintf('<a href="all/%d"> %s</a>',
60 if($::ib->unread_lines($cid)){
62 sprintf(' <a href="unread/%d">%s</a>',
64 $::ib->unread_lines($cid));
68 $p->{mtime} = Encode::encode($::cf->web_charset(), $format_mtime->($::ib->mtime($cid)));
72 my $ci = new Keitairc::ClientInfo($request);
73 my $view = new Keitairc::View($::cf, $ci);
74 return $view->render('index.html',
77 unread => $unread_channels,