diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/commands/cs_suspend.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/modules/commands/cs_suspend.cpp b/modules/commands/cs_suspend.cpp index e4fc8afad..ae050e1c6 100644 --- a/modules/commands/cs_suspend.cpp +++ b/modules/commands/cs_suspend.cpp @@ -210,6 +210,13 @@ class CSSuspend : public Module } }; + void Expire(ChannelInfo *ci) + { + suspend.Unset(ci); + Log(this) << "Expiring suspend for " << ci->name; + } + + bool Show(CommandSource &source, const Anope::string &what) const { return source.IsOper() || std::find(show.begin(), show.end(), what) != show.end(); @@ -255,23 +262,28 @@ class CSSuspend : public Module expire = false; - if (!si->expires) - return; - - if (si->expires < Anope::CurTime) + if (si->expires && si->expires < Anope::CurTime) { ci->last_used = Anope::CurTime; - suspend.Unset(ci); - - Log(this) << "Expiring suspend for " << ci->name; + Expire(ci); } } EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) anope_override { - if (u->HasMode("OPER") || !c->ci || !suspend.HasExt(c->ci)) + if (u->HasMode("OPER") || !c->ci) return EVENT_CONTINUE; + CSSuspendInfo *si = suspend.Get(c->ci); + if (!si) + return EVENT_CONTINUE; + + if (si->expires && si->expires < Anope::CurTime) + { + Expire(c->ci); + return EVENT_CONTINUE; + } + reason = Language::Translate(u, _("This channel may not be used.")); return EVENT_STOP; } |