# -*-perl-*-
# keitairc/lib/plugins/00topic
# gsbNꗗ
# $Id: 00topic,v 1.2 2008/01/13 15:31:09 morimoto Exp $
# $Source: /cvsroot/keitairc/lib/plugins/00topic,v $

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

		for my $cid ($::ib->channels()){
			my $channel = $::ib->cid2name($cid);
			my $topic;
			$buf .= sprintf(' <a href="all/%d">%s</a><br />',
					$cid,
					$::ib->compact_channel_name($cid));
			if($topic = $::ib->topic($cid)){
				Encode::from_to($topic, 'jis', 'shiftjis');
			}else{
				$topic = '(߯ݒ)';
			}
			$buf .= $topic;
			$buf .= "<br />\n";
		}

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

1;
