diff options
-rw-r--r-- | data/chanserv.example.conf | 6 | ||||
-rw-r--r-- | modules/commands/cs_set.cpp | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/data/chanserv.example.conf b/data/chanserv.example.conf index 7bfd1ff8c..4a07d0082 100644 --- a/data/chanserv.example.conf +++ b/data/chanserv.example.conf @@ -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"; } diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp index 0c5e9b6c6..f4c7e176d 100644 --- a/modules/commands/cs_set.cpp +++ b/modules/commands/cs_set.cpp @@ -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; |