+ ModResult OnStats(Stats::Context& stats) CXX11_OVERRIDE
+ {
+ if (stats.GetSymbol() != 'C')
+ return MOD_RES_PASSTHRU;
+
+ ServerInstance->XLines->InvokeStats("CBAN", stats);
+ return MOD_RES_DENY;
+ }
+
+ ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE
+ {
+ XLine *rl = ServerInstance->XLines->MatchesLine("CBAN", cname);
+
+ if (rl)
+ {
+ // Channel is banned.
+ user->WriteNumeric(ERR_BADCHANNEL, cname, InspIRCd::Format("Channel %s is CBANed: %s", cname.c_str(), rl->reason.c_str()));
+ ServerInstance->SNO->WriteGlobalSno('a', "%s tried to join %s which is CBANed (%s)",
+ user->nick.c_str(), cname.c_str(), rl->reason.c_str());
+ return MOD_RES_DENY;
+ }
+
+ return MOD_RES_PASSTHRU;
+ }
+
+ Version GetVersion() CXX11_OVERRIDE
+ {
+ return Version("Adds the /CBAN command which allows server operators to prevent channels matching a glob from being created.", VF_COMMON | VF_VENDOR, glob ? "glob" : "");
+ }
+};