From f277be0f2634cc97881918a0aaf1c0cb6ffad2d6 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 14 Jul 2011 21:40:21 -0400 Subject: Fixed OSOpersOnly & CSOpersOnly --- modules/core/cs_main.cpp | 15 +++++++++++++-- modules/core/os_ignore.cpp | 2 +- modules/core/os_main.cpp | 15 +++++++++++++-- 3 files changed, 27 insertions(+), 5 deletions(-) (limited to 'modules') 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)) -- cgit