using namespace std;
-#include <stdio.h>
#include "users.h"
#include "channels.h"
#include "modules.h"
-#include "helperfuncs.h"
#include "inspircd.h"
/* $ModDesc: Provides channel mode +L (limit redirection) */
-extern InspIRCd* ServerInstance;
-
class Redirect : public ModeHandler
{
public:
class ModuleRedirect : public Module
{
- Server *Srv;
+
Redirect* re;
public:
{
re = new Redirect(ServerInstance);
- Srv->AddMode(re, 'L');
+ ServerInstance->AddMode(re, 'L');
}
void Implements(char* List)
{
- List[I_On005Numeric] = List[I_OnUserPreJoin] = 1;
+ List[I_OnUserPreJoin] = 1;
}
- virtual void On005Numeric(std::string &output)
- {
- ServerInstance->ModeGrok->InsertMode(output, "L", 3);
- }
-
virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
{
if (chan)
{
- if (chan->IsModeSet('L'))
+ if (chan->IsModeSet('L') && chan->limit)
{
if (chan->GetUserCounter() >= chan->limit)
{
virtual ~ModuleRedirect()
{
+ ServerInstance->Modes->DelMode(re);
DELETE(re);
}
virtual Version GetVersion()
{
- return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
+ return Version(1, 0, 0, 0, VF_COMMON | VF_VENDOR);
}
};