diff options
-rw-r--r-- | include/modules.h | 2 | ||||
-rw-r--r-- | modules/core/cs_main.cpp | 15 | ||||
-rw-r--r-- | modules/core/os_ignore.cpp | 2 | ||||
-rw-r--r-- | modules/core/os_main.cpp | 15 | ||||
-rw-r--r-- | src/regchannel.cpp | 2 |
5 files changed, 29 insertions, 7 deletions
diff --git a/include/modules.h b/include/modules.h index 2169513a8..28627f506 100644 --- a/include/modules.h +++ b/include/modules.h @@ -999,7 +999,7 @@ class CoreExport Module : public Extensible * @param message The message * @return EVENT_STOP to halt processing */ - virtual EventReturn OnBotPrivmsg(User *u, BotInfo *bi, const Anope::string &message) { return EVENT_CONTINUE; } + virtual EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) { return EVENT_CONTINUE; } /** Called when we receive a PRIVMSG for a registered channel we are in * @param u The source of the message diff --git a/modules/core/cs_main.cpp b/modules/core/cs_main.cpp index 1aa346d41..8c1678624 100644 --- a/modules/core/cs_main.cpp +++ b/modules/core/cs_main.cpp @@ -24,8 +24,19 @@ class ChanServCore : public Module if (ChanServ == NULL) throw ModuleException("No bot named " + Config->ChanServ); - Implementation i[] = { I_OnDelChan, I_OnPreHelp, I_OnPostHelp }; - ModuleManager::Attach(i, this, 3); + Implementation i[] = { I_OnBotPrivmsg, I_OnDelChan, I_OnPreHelp, I_OnPostHelp }; + ModuleManager::Attach(i, this, 4); + } + + EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) + { + if (Config->CSOpersOnly && !u->HasMode(UMODE_OPER) && bi->nick == Config->ChanServ) + { + u->SendMessage(bi, ACCESS_DENIED); + return EVENT_STOP; + } + + return EVENT_CONTINUE; } void OnDelCore(NickCore *nc) diff --git a/modules/core/os_ignore.cpp b/modules/core/os_ignore.cpp index 1e7977034..88fda076f 100644 --- a/modules/core/os_ignore.cpp +++ b/modules/core/os_ignore.cpp @@ -338,7 +338,7 @@ class OSIgnore : public Module } } - EventReturn OnBotPrivmsg(User *u, BotInfo *bi, const Anope::string &message) + EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) { if (this->osignoreservice.Find(u->nick)) return EVENT_STOP; diff --git a/modules/core/os_main.cpp b/modules/core/os_main.cpp index e8d1f5e28..bfb7ddfe6 100644 --- a/modules/core/os_main.cpp +++ b/modules/core/os_main.cpp @@ -292,8 +292,8 @@ class OperServCore : public Module if (OperServ == NULL) throw ModuleException("No bot named " + Config->OperServ); - Implementation i[] = { I_OnServerQuit, I_OnUserModeSet, I_OnUserModeUnset, I_OnUserConnect, I_OnUserNickChange, I_OnPreHelp }; - ModuleManager::Attach(i, this, 6); + Implementation i[] = { I_OnBotPrivmsg, I_OnServerQuit, I_OnUserModeSet, I_OnUserModeUnset, I_OnUserConnect, I_OnUserNickChange, I_OnPreHelp }; + ModuleManager::Attach(i, this, 7); ModuleManager::RegisterService(&sglines); ModuleManager::RegisterService(&szlines); @@ -307,6 +307,17 @@ class OperServCore : public Module XLineManager::RegisterXLineManager(&snlines); } + EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) + { + if (Config->OSOpersOnly && !u->HasMode(UMODE_OPER) && bi->nick == Config->OperServ) + { + u->SendMessage(bi, ACCESS_DENIED); + return EVENT_STOP; + } + + return EVENT_CONTINUE; + } + void OnServerQuit(Server *server) { if (server->HasFlag(SERVER_JUPED)) diff --git a/src/regchannel.cpp b/src/regchannel.cpp index 131fdf29c..5a6159adc 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -791,7 +791,7 @@ bool ChannelInfo::CheckKick(User *user) bool set_modes = false, do_kick = false; EventReturn MOD_RESULT; - FOREACH_MOD(I_OnCheckKick, OnCheckKick(user, this, do_kick)); + FOREACH_RESULT(I_OnCheckKick, OnCheckKick(user, this, do_kick)); if (MOD_RESULT == EVENT_ALLOW) return false; |