mirror of
https://github.com/anope/anope.git
synced 2026-07-04 20:13:13 +02:00
Add a config option for whether or not to reset the TS of persistent channels to their registration date
This commit is contained in:
@@ -1133,6 +1133,12 @@ module
|
||||
* 3: ban in the form of *!*user@*.domain
|
||||
*/
|
||||
defbantype = 2
|
||||
|
||||
/*
|
||||
* If set, persisent channels have their creation times lowered to their
|
||||
* original registration dates.
|
||||
*/
|
||||
persist_lower_ts = true
|
||||
}
|
||||
command { service = "ChanServ"; name = "SET"; command = "chanserv/set"; group = "chanserv/management"; }
|
||||
command { service = "ChanServ"; name = "SET AUTOOP"; command = "chanserv/set/autoop"; }
|
||||
|
||||
@@ -1198,6 +1198,8 @@ class CSSet : public Module
|
||||
CommandCSSetSuccessor commandcssetsuccessor;
|
||||
CommandCSSetNoexpire commandcssetnoexpire;
|
||||
|
||||
bool persist_lower_ts;
|
||||
|
||||
public:
|
||||
CSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
noautoop(this, "NOAUTOOP"), peace(this, "PEACE"),
|
||||
@@ -1214,6 +1216,11 @@ class CSSet : public Module
|
||||
{
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) anope_override
|
||||
{
|
||||
persist_lower_ts = conf->GetModule(this)->Get<bool>("persist_lower_ts");
|
||||
}
|
||||
|
||||
void OnCreateChan(ChannelInfo *ci) anope_override
|
||||
{
|
||||
ci->bantype = Config->GetModule(this)->Get<int>("defbantype", "2");
|
||||
@@ -1296,7 +1303,7 @@ class CSSet : public Module
|
||||
|
||||
void OnJoinChannel(User *u, Channel *c) anope_override
|
||||
{
|
||||
if (c->ci && persist.HasExt(c->ci) && c->creation_time > c->ci->time_registered)
|
||||
if (persist_lower_ts && c->ci && persist.HasExt(c->ci) && c->creation_time > c->ci->time_registered)
|
||||
{
|
||||
Log(LOG_DEBUG) << "Changing TS of " << c->name << " from " << c->creation_time << " to " << c->ci->time_registered;
|
||||
c->creation_time = c->ci->time_registered;
|
||||
|
||||
Reference in New Issue
Block a user