summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-09 15:55:26 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-09 15:55:26 +0000
commit4eb1796dbda553761a15b83bece1f12c7d0057c0 (patch)
treec4bdfcdfa73e6caad048329bce3023f80dc40c71 /src
parent800c7ddd7368c469415f5db13cb8c9c4bcc0966a (diff)
Convert to new api
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4227 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_nokicks.cpp48
1 files changed, 33 insertions, 15 deletions
diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp
index 564ff86e6..aa764b18b 100644
--- a/src/modules/m_nokicks.cpp
+++ b/src/modules/m_nokicks.cpp
@@ -24,9 +24,38 @@ using namespace std;
/* $ModDesc: Provides support for unreal-style channel mode +Q */
+class NoKicks : public ModeHandler
+{
+ public:
+ NoKicks() : ModeHandler('Q', 0, 0, false, MODETYPE_CHANNEL, false) { }
+
+ ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
+ {
+ if (adding)
+ {
+ if (!channel->IsModeSet('Q'))
+ {
+ channel->SetMode('Q',true);
+ return MODEACTION_ALLOW;
+ }
+ }
+ else
+ {
+ if (channel->IsModeSet('Q'))
+ {
+ channel->SetMode('Q',false);
+ return MODEACTION_ALLOW;
+ }
+ }
+
+ return MODEACTION_DENY;
+ }
+};
+
class ModuleNoKicks : public Module
{
Server *Srv;
+ NoKicks* nk;
public:
@@ -34,12 +63,13 @@ class ModuleNoKicks : public Module
: Module::Module(Me)
{
Srv = Me;
- Srv->AddExtendedMode('Q',MT_CHANNEL,false,0,0);
+ nk = new NoKicks();
+ Srv->AddMode(nk, 'Q');
}
void Implements(char* List)
{
- List[I_On005Numeric] = List[I_OnAccessCheck] = List[I_OnExtendedMode] = 1;
+ List[I_On005Numeric] = List[I_OnAccessCheck] = 1;
}
virtual void On005Numeric(std::string &output)
@@ -68,22 +98,10 @@ class ModuleNoKicks : public Module
}
return ACR_DEFAULT;
}
-
- virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params)
- {
- // check if this is our mode character...
- if ((modechar == 'Q') && (type == MT_CHANNEL))
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
virtual ~ModuleNoKicks()
{
+ DELETE(nk);
}
virtual Version GetVersion()