mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-13 12:39:05 -04:00
Port to new API
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4226 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
8d3cfd9c6b
commit
800c7ddd73
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user