diff options
| author | Adam <Adam@anope.org> | 2012-02-26 23:23:15 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2012-02-26 23:23:15 -0500 |
| commit | a5b9e235ae240439608aa743c9ebb3bf6e7d342a (patch) | |
| tree | 9c3040b865ace191c224a94ef525ab60581c6ba5 /modules | |
| parent | a78790eac4da788a8432d0b83fa72de7853dd697 (diff) | |
Added chanserv:require config option to set which modes must be on all registered channels. Prevents the core from always enforcing +r on every channel, even if chanserv is not loaded.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/commands/cs_clone.cpp | 2 | ||||
| -rw-r--r-- | modules/commands/cs_drop.cpp | 7 | ||||
| -rw-r--r-- | modules/commands/cs_mode.cpp | 2 | ||||
| -rw-r--r-- | modules/commands/cs_register.cpp | 12 | ||||
| -rw-r--r-- | modules/commands/cs_set_persist.cpp | 7 | ||||
| -rw-r--r-- | modules/protocol/inspircd-ts6.h | 3 | ||||
| -rw-r--r-- | modules/pseudoclients/chanserv.cpp | 13 |
7 files changed, 26 insertions, 20 deletions
diff --git a/modules/commands/cs_clone.cpp b/modules/commands/cs_clone.cpp index 8205b723c..1676c70f6 100644 --- a/modules/commands/cs_clone.cpp +++ b/modules/commands/cs_clone.cpp @@ -67,7 +67,7 @@ public: { target_ci->c->ci = target_ci; - check_modes(target_ci->c); + target_ci->c->CheckModes(); ChannelMode *cm; if (u->FindChannel(target_ci->c) != NULL) diff --git a/modules/commands/cs_drop.cpp b/modules/commands/cs_drop.cpp index e9736851a..abdbed17e 100644 --- a/modules/commands/cs_drop.cpp +++ b/modules/commands/cs_drop.cpp @@ -53,16 +53,17 @@ class CommandCSDrop : public Command return; } - if (ci->c && ModeManager::FindChannelModeByName(CMODE_REGISTERED)) - ci->c->RemoveMode(NULL, CMODE_REGISTERED, "", false); - bool override = (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv("FOUNDER")); Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "(founder was: " << (ci->GetFounder() ? ci->GetFounder()->display : "none") << ")"; + Channel *c = ci->c; delete ci; source.Reply(_("Channel \002%s\002 has been dropped."), chan.c_str()); + if (c) + c->CheckModes(); + FOREACH_MOD(I_OnChanDrop, OnChanDrop(chan)); return; diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index c2b9c7de4..c9d7c112a 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -96,7 +96,7 @@ class CommandCSMode : public Command } if (ci->c) - check_modes(ci->c); + ci->c->CheckModes(); } else if (subcommand.equals_ci("DEL") && !param.empty()) { diff --git a/modules/commands/cs_register.cpp b/modules/commands/cs_register.cpp index 633364d31..570fd8125 100644 --- a/modules/commands/cs_register.cpp +++ b/modules/commands/cs_register.cpp @@ -76,7 +76,7 @@ class CommandCSRegister : public Command /* Implement new mode lock */ if (c) { - check_modes(c); + c->CheckModes(); ChannelMode *cm; if (u->FindChannel(c) != NULL) @@ -138,16 +138,6 @@ class CSRegister : public Module commandcsregister(this) { this->SetAuthor("Anope"); - - ModuleManager::Attach(I_OnDelChan, this); - } - - void OnDelChan(ChannelInfo *ci) anope_override - { - if (ci->c && ci->c->HasMode(CMODE_REGISTERED)) - ci->c->RemoveMode(NULL, CMODE_REGISTERED, "", false); - if (ci->c && ci->HasFlag(CI_PERSIST)) - ci->c->RemoveMode(NULL, CMODE_PERM, "", false); } }; diff --git a/modules/commands/cs_set_persist.cpp b/modules/commands/cs_set_persist.cpp index 4a1d676dd..b9d4d2c35 100644 --- a/modules/commands/cs_set_persist.cpp +++ b/modules/commands/cs_set_persist.cpp @@ -172,6 +172,13 @@ class CSSetPersist : public Module { this->SetAuthor("Anope"); + ModuleManager::Attach(I_OnDelChan, this); + } + + void OnDelChan(ChannelInfo *ci) anope_override + { + if (ci->c && ci->HasFlag(CI_PERSIST)) + ci->c->RemoveMode(NULL, CMODE_PERM, "", false); } }; diff --git a/modules/protocol/inspircd-ts6.h b/modules/protocol/inspircd-ts6.h index a079d54ce..964232080 100644 --- a/modules/protocol/inspircd-ts6.h +++ b/modules/protocol/inspircd-ts6.h @@ -411,9 +411,6 @@ class InspircdIRCdMessage : public IRCdMessage { c->creation_time = ts; c->Reset(); - - /* Reset mlock */ - check_modes(c); } /* Their TS is newer than ours, our modes > theirs, unset their modes if need be */ else if (ts > c->creation_time) diff --git a/modules/pseudoclients/chanserv.cpp b/modules/pseudoclients/chanserv.cpp index b5deaf284..f1ad3ec6a 100644 --- a/modules/pseudoclients/chanserv.cpp +++ b/modules/pseudoclients/chanserv.cpp @@ -65,7 +65,7 @@ class ChanServCore : public Module if (ChanServ == NULL) throw ModuleException("No bot named " + Config->ChanServ); - Implementation i[] = { I_OnBotPrivmsg, I_OnDelCore, I_OnPreHelp, I_OnPostHelp }; + Implementation i[] = { I_OnBotPrivmsg, I_OnDelCore, I_OnPreHelp, I_OnPostHelp, I_OnCheckModes }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); } @@ -179,6 +179,17 @@ class ChanServCore : public Module "any channel, view (and modify) the access, levels and akick\n" "lists and settings for any channel.")); } + + EventReturn OnCheckModes(Channel *c) anope_override + { + if (!Config->CSRequire.empty()) + if (c->ci) + c->SetModes(NULL, false, "+%s", Config->CSRequire.c_str()); + else + c->SetModes(NULL, false, "-%s", Config->CSRequire.c_str()); + + return EVENT_CONTINUE; + } }; MODULE_INIT(ChanServCore) |
