Add an option to allow channel ops to enable the permchannels mode.

Closes #1964.
This commit is contained in:
Sadie Powell 2022-02-05 23:40:40 +00:00
parent 24229f59f7
commit 2b2a3a31d7
2 changed files with 12 additions and 1 deletions

View File

@ -1787,9 +1787,14 @@
#
# 'saveperiod' determines how often to check if the database needs to be
# saved to disk. Defaults to every five seconds.
#
# 'operonly' determines whether a server operator or services server is
# needed to enable the permchannels mode. You should generally keep this
# set to yes unless you know what you are doing.
#<permchanneldb filename="permchannels.conf"
# listmodes="yes"
# saveperiod="5s">
# saveperiod="5s"
# operonly="yes">
#<include file="permchannels.conf" missingokay="yes">
#
# You may also create channels on startup by using the <permchannels> block.

View File

@ -52,6 +52,11 @@ class PermChannel : public ModeHandler
return MODEACTION_ALLOW;
}
void SetOperOnly(bool value)
{
oper = value;
}
};
// Not in a class due to circular dependency hell.
@ -190,6 +195,7 @@ public:
ConfigTag* tag = ServerInstance->Config->ConfValue("permchanneldb");
permchannelsconf = tag->getString("filename");
save_listmodes = tag->getBool("listmodes", true);
p.SetOperOnly(tag->getBool("operonly", true));
SetInterval(tag->getDuration("saveperiod", 5));
if (!permchannelsconf.empty())