# -*- mode: perl; coding: utf-8 -*-
# keitairc/lib/plugins/11url_session
# URL処理(セッション更新してリファラ逆探知防御)

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

$plugin = {
	name => 'url_session',
	action_imprementation => sub {
		my ($request, $name, $session_id, $param) = @_;
		my $ci = new Keitairc::ClientInfo($request);
		my $view = new Keitairc::View($::cf, $ci);

		# 新しい session_id を作って古いのは消す
		$::sm->delete($session_id);
		my $new_session = $::sm->add($ci->{header}->{user_agent}, $ci->serial_key());
		return $view->render('url_session.html', {
			url => $param,
			session_id => $new_session->{id},
			escaped_url => URI::Escape::uri_escape($param),
			     });
	}
};

1;
