diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-09 15:39:50 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-09 15:39:50 +0000 |
commit | 800c7ddd7368c469415f5db13cb8c9c4bcc0966a (patch) | |
tree | ef0b854e616988f130388424898d7659fd0d1ef6 | |
parent | 8d3cfd9c6b4c01dc9b5133ad4ce735bf03126edd (diff) |
Port to new API
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4226 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/m_noinvite.cpp | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp index a0caade2a..86b960b63 100644 --- a/src/modules/m_noinvite.cpp +++ b/src/modules/m_noinvite.cpp @@ -24,22 +24,51 @@ using namespace std; /* $ModDesc: Provides support for unreal-style channel mode +V */ +class NoInvite : public ModeHandler +{ + public: + NoInvite() : ModeHandler('V', 0, 0, false, MODETYPE_CHANNEL, false) { } + + ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) + { + if (adding) + { + if (!channel->IsModeSet('V')) + { + channel->SetMode('V',true); + return MODEACTION_ALLOW; + } + } + else + { + if (channel->IsModeSet('V')) + { + channel->SetMode('V',false); + return MODEACTION_ALLOW; + } + } + + return MODEACTION_DENY; + } +}; + class ModuleNoInvite : public Module { Server *Srv; + NoInvite *ni; public: - ModuleNoInvite(Server* Me) - : Module::Module(Me) + ModuleNoInvite(Server* Me) : Module::Module(Me) { Srv = Me; - Srv->AddExtendedMode('V',MT_CHANNEL,false,0,0); + ni = new NoInvite(); + Srv->AddMode(ni, 'V'); } void Implements(char* List) { - List[I_On005Numeric] = List[I_OnUserPreInvite] = List[I_OnExtendedMode] = 1; + List[I_On005Numeric] = List[I_OnUserPreInvite] = 1; } virtual void On005Numeric(std::string &output) @@ -57,22 +86,10 @@ class ModuleNoInvite : public Module } return 0; } - - virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) - { - // check if this is our mode character... - if ((modechar == 'V') && (type == MT_CHANNEL)) - { - return 1; - } - else - { - return 0; - } - } virtual ~ModuleNoInvite() { + DELETE(ni); } virtual Version GetVersion() |