# -*-perl-*-
# keitairc/lib/plugins/00topic
# gsbNꗗ
# $Id: 00topic,v 1.1 2008/01/09 19:30:34 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 $channel ($::ib->channels()){
			my $topic;
			$buf .= sprintf(' <a href="all/%s">%s</a><br />',
					::uri_escape($channel),
					$::ib->compact_channel_name($::ib->name($channel)));
			if($topic = $::ib->topic($channel)){
				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;
