# -*- mode: perl; coding: utf-8 -*-
# keitairc/lib/plugins/00topic
# トピック一覧
# $Id: 00topic,v 1.8 2008-12-28 15:25:07 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00topic,v $

# The line number (1 incremented) and filename below must be
# actual. see perlsyn.
# line 10 "keitairc/lib/plugins/00topic"

$plugin = {
	name => 'topic',
	action_imprementation => sub {
		my ($request, $name, $session_id, $param) = @_;
		my @loop;
		for my $cid ($::ib->channels()){
			my $p = {};
			$p->{cid} = $cid;
			$p->{cname} = Encode::encode($::cf->web_charset(), $::ib->simple_escape($::ib->compact_channel_name($cid)));
			$p->{topic} = Encode::encode($::cf->web_charset(), $::ib->simple_escape(Encode::decode($::cf->irc_charset(), $::ib->topic($cid))));
			push @loop, $p;
		}

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

1;
