# -*-perl-*-
# keitairc/lib/plugins/00recent
# ǔꗗ
# $Id: 00recent,v 1.1 2008/01/09 19:30:34 morimoto Exp $
# $Source: /cvsroot/keitairc/lib/plugins/00recent,v $

$plugin = {
	name => 'recent',
	action_imprementation => sub {
		my ($request, $name, $session_id, $param_string) = @_;
		my $buf;

		for my $channel ($::ib->channels()){
			if($::ib->unread_lines($channel)){
				my $name = $::ib->name($channel);
				Encode::from_to($name, 'jis', 'shiftjis');
				$buf .= $name;
				$buf .= sprintf(' <a href="all/%s">S</a><br />', uri_escape($channel));
				$buf .= ::render_line($::ib->unread($channel), $session_id);
				$buf .= "<hr />\n";
				$::ib->clear_unread($channel);
			}
		}

		my $ci = new Keitairc::ClientInfo($request);
		my $view = new Keitairc::View($::cf, $ci);
		return $view->render('recent.html', { buf => $buf });
	}
};

1;
