mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-20 07:59:03 -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 */
|
/* $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
|
class ModuleNoInvite : public Module
|
||||||
{
|
{
|
||||||
Server *Srv;
|
Server *Srv;
|
||||||
|
NoInvite *ni;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ModuleNoInvite(Server* Me)
|
ModuleNoInvite(Server* Me) : Module::Module(Me)
|
||||||
: Module::Module(Me)
|
|
||||||
{
|
{
|
||||||
Srv = Me;
|
Srv = Me;
|
||||||
Srv->AddExtendedMode('V',MT_CHANNEL,false,0,0);
|
ni = new NoInvite();
|
||||||
|
Srv->AddMode(ni, 'V');
|
||||||
}
|
}
|
||||||
|
|
||||||
void Implements(char* List)
|
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)
|
virtual void On005Numeric(std::string &output)
|
||||||
@ -58,21 +87,9 @@ class ModuleNoInvite : public Module
|
|||||||
return 0;
|
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()
|
virtual ~ModuleNoInvite()
|
||||||
{
|
{
|
||||||
|
DELETE(ni);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Version GetVersion()
|
virtual Version GetVersion()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user