<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
package IkiWiki::Plugin::opendiscussion;

use warnings;
use strict;
use IkiWiki 3.00;

sub import {
	hook(type =&gt; "getsetup", id =&gt; "opendiscussion", call =&gt; \&amp;getsetup);
	hook(type =&gt; "canedit", id =&gt; "opendiscussion", call =&gt; \&amp;canedit,
		first =&gt; 1);
}

sub getsetup () {
	return 
		plugin =&gt; {
			safe =&gt; 1,
			rebuild =&gt; 0,
			section =&gt; "auth",
		},
}

sub canedit ($$) {
	my $page=shift;
	my $cgi=shift;
	my $session=shift;

	return "" if $config{discussion} &amp;&amp; $page=~/(\/|^)\Q$config{discussionpage}\E$/i;
	return "" if pagespec_match($page, "postcomment(*)");
	return undef;
}

1
</pre></body></html>