summaryrefslogtreecommitdiff
path: root/src/modules/m_override.cpp
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2009-01-22 15:02:37 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2009-01-22 15:02:37 +0000
commit6a88b90b036f3cfc21d45eb76d1ae3e767b8ac5c (patch)
tree8f1a4e27b8491e69163b32e6688e8e7e7efee362 /src/modules/m_override.cpp
parentc68d2cb200c01b95017cf88d8b4f0fb96d5e97b8 (diff)
Fix bug #659, #524 and others: Allow operoverride to set +qa. Based on patch by Phoenix. Note that this is currently untested, feedback is very welcome.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10979 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_override.cpp')
-rw-r--r--src/modules/m_override.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index 083d220f7..c5f1cc11c 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -12,6 +12,7 @@
*/
#include "inspircd.h"
+#include "m_override.h"
/* $ModDesc: Provides support for unreal-style oper-override */
@@ -34,9 +35,13 @@ class ModuleOverride : public Module
OnRehash(NULL,"");
ServerInstance->SNO->EnableSnomask('G', "GODMODE");
OverriddenMode = false;
+ if (!ServerInstance->Modules->PublishFeature("Override", this))
+ {
+ throw ModuleException("m_override: Unable to publish feature 'Override'");
+ }
OverOps = OverDeops = OverVoices = OverDevoices = OverHalfops = OverDehalfops = 0;
- Implementation eventlist[] = { I_OnRehash, I_OnAccessCheck, I_On005Numeric, I_OnUserPreJoin, I_OnUserPreKick, I_OnPostCommand, I_OnLocalTopicChange };
- ServerInstance->Modules->Attach(eventlist, this, 7);
+ Implementation eventlist[] = { I_OnRehash, I_OnAccessCheck, I_On005Numeric, I_OnUserPreJoin, I_OnUserPreKick, I_OnPostCommand, I_OnLocalTopicChange, I_OnRequest };
+ ServerInstance->Modules->Attach(eventlist, this, 8);
}
virtual void OnRehash(User* user, const std::string &parameter)
@@ -313,8 +318,19 @@ class ModuleOverride : public Module
return 0;
}
+ virtual const char* OnRequest(Request* request)
+ {
+ if(strcmp(OVRREQID, request->GetId()) == 0)
+ {
+ OVRrequest* req = static_cast<OVRrequest*>(request);
+ return this->CanOverride(req->requser,req->reqtoken.c_str()) ? "yes":"";
+ }
+ return NULL;
+ }
+
virtual ~ModuleOverride()
{
+ ServerInstance->Modules->UnpublishFeature("Override");
ServerInstance->SNO->DisableSnomask('G');
}