summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-12-26 12:06:39 -0500
committerAdam <Adam@anope.org>2013-12-26 12:06:39 -0500
commit5829d7da39cd92c2590c281a931ae7a032da1842 (patch)
tree60e93e2f4657a74d83983f955b5aec7bb5350df2
parent2f29c1388cd8c4ded58bc2bf540463ba79ac9b30 (diff)
Add a config option for whether or not to reset the TS of persistent channels to their registration date
-rw-r--r--data/chanserv.example.conf6
-rw-r--r--modules/commands/cs_set.cpp9
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;