if (x->source == std::string(source))
{
cmdlist.erase(safei);
- delete x;
}
}
int clientactive;
bool cred_alloc;
- CommandStartTLS* starttls;
+ CommandStartTLS starttls;
public:
ModuleSSLGnuTLS(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), starttls(Me, this)
{
ServerInstance->Modules->PublishInterface("BufferedSocketHook", this);
I_OnPostConnect, I_OnEvent, I_OnHookUserIO };
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
- starttls = new CommandStartTLS(ServerInstance, this);
- ServerInstance->AddCommand(starttls);
+ ServerInstance->AddCommand(&starttls);
}
virtual void OnRehash(User* user)
class ModuleAllowInvite : public Module
{
- AllowInvite *ni;
+ AllowInvite ni;
public:
- ModuleAllowInvite(InspIRCd* Me) : Module(Me)
+ ModuleAllowInvite(InspIRCd* Me) : Module(Me), ni(Me)
{
- ni = new AllowInvite(ServerInstance);
- if (!ServerInstance->Modes->AddMode(ni))
+ if (!ServerInstance->Modes->AddMode(&ni))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreInvite, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 2);
virtual ~ModuleAllowInvite()
{
- ServerInstance->Modes->DelMode(ni);
- delete ni;
+ ServerInstance->Modes->DelMode(&ni);
}
virtual Version GetVersion()
class Modulealltime : public Module
{
- CommandAlltime *mycommand;
+ CommandAlltime mycommand;
public:
Modulealltime(InspIRCd *Me)
- : Module(Me)
+ : Module(Me), mycommand(Me)
{
- mycommand = new CommandAlltime(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&mycommand);
}
virtual ~Modulealltime()
class ModuleAuditorium : public Module
{
private:
- AuditoriumMode* aum;
+ AuditoriumMode aum;
bool ShowOps;
bool OperOverride;
public:
ModuleAuditorium(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), aum(Me)
{
- aum = new AuditoriumMode(ServerInstance);
- if (!ServerInstance->Modes->AddMode(aum))
- {
- delete aum;
+ if (!ServerInstance->Modes->AddMode(&aum))
throw ModuleException("Could not add new modes!");
- }
OnRehash(NULL);
virtual ~ModuleAuditorium()
{
- ServerInstance->Modes->DelMode(aum);
- delete aum;
+ ServerInstance->Modes->DelMode(&aum);
}
virtual void OnRehash(User* user)
class ModuleBanException : public Module
{
- BanException* be;
-
+ BanException be;
public:
- ModuleBanException(InspIRCd* Me) : Module(Me)
+ ModuleBanException(InspIRCd* Me) : Module(Me), be(Me)
{
- be = new BanException(ServerInstance);
- if (!ServerInstance->Modes->AddMode(be))
+ if (!ServerInstance->Modes->AddMode(&be))
throw ModuleException("Could not add new modes!");
ServerInstance->Modules->PublishInterface("ChannelBanList", this);
- be->DoImplements(this);
+ be.DoImplements(this);
Implementation list[] = { I_OnRehash, I_OnRequest, I_On005Numeric, I_OnCheckBan, I_OnCheckExtBan, I_OnCheckStringExtBan };
Me->Modules->Attach(list, this, 6);
if (chan != NULL)
{
modelist *list;
- chan->GetExt(be->GetInfoKey(), list);
+ chan->GetExt(be.GetInfoKey(), list);
if (!list)
return 0;
if (chan != NULL)
{
modelist *list;
- chan->GetExt(be->GetInfoKey(), list);
+ chan->GetExt(be.GetInfoKey(), list);
if (!list)
return 0;
if (chan != NULL)
{
modelist* list;
- chan->GetExt(be->GetInfoKey(), list);
+ chan->GetExt(be.GetInfoKey(), list);
if (!list)
{
virtual void OnCleanup(int target_type, void* item)
{
- be->DoCleanup(target_type, item);
+ be.DoCleanup(target_type, item);
}
virtual void OnSyncChannel(Channel* chan, Module* proto, void* opaque)
{
- be->DoSyncChannel(chan, proto, opaque);
+ be.DoSyncChannel(chan, proto, opaque);
}
virtual void OnChannelDelete(Channel* chan)
{
- be->DoChannelDelete(chan);
+ be.DoChannelDelete(chan);
}
virtual void OnRehash(User* user)
{
- be->DoRehash();
+ be.DoRehash();
}
virtual const char* OnRequest(Request* request)
{
- return be->DoOnRequest(request);
+ return be.DoOnRequest(request);
}
virtual Version GetVersion()
virtual ~ModuleBanException()
{
- ServerInstance->Modes->DelMode(be);
- delete be;
+ ServerInstance->Modes->DelMode(&be);
ServerInstance->Modules->UnpublishInterface("ChannelBanList", this);
}
};
class ModuleBanRedirect : public Module
{
- BanRedirect* re;
+ BanRedirect re;
bool nofollow;
Module* ExceptionModule;
public:
ModuleBanRedirect(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), re(Me)
{
- re = new BanRedirect(Me);
nofollow = false;
- if(!ServerInstance->Modes->AddModeWatcher(re))
- {
- delete re;
+ if(!ServerInstance->Modes->AddModeWatcher(&re))
throw ModuleException("Could not add mode watcher");
- }
OnRehash(NULL);
virtual ~ModuleBanRedirect()
{
- ServerInstance->Modes->DelModeWatcher(re);
- delete re;
+ ServerInstance->Modes->DelModeWatcher(&re);
}
virtual Version GetVersion()
class ModuleBlockCAPS : public Module
{
- BlockCaps* bc;
+ BlockCaps bc;
int percent;
unsigned int minlen;
char capsmap[256];
public:
- ModuleBlockCAPS(InspIRCd* Me) : Module(Me)
+ ModuleBlockCAPS(InspIRCd* Me) : Module(Me), bc(Me)
{
OnRehash(NULL);
- bc = new BlockCaps(ServerInstance);
- if (!ServerInstance->Modes->AddMode(bc))
- {
- delete bc;
+ if (!ServerInstance->Modes->AddMode(&bc))
throw ModuleException("Could not add new modes!");
- }
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 4);
}
virtual ~ModuleBlockCAPS()
{
- ServerInstance->Modes->DelMode(bc);
- delete bc;
+ ServerInstance->Modes->DelMode(&bc);
}
virtual Version GetVersion()
class ModuleBlockColour : public Module
{
bool AllowChanOps;
- BlockColor *bc;
+ BlockColor bc;
public:
- ModuleBlockColour(InspIRCd* Me) : Module(Me)
+ ModuleBlockColour(InspIRCd* Me) : Module(Me), bc(Me)
{
- bc = new BlockColor(ServerInstance);
- if (!ServerInstance->Modes->AddMode(bc))
+ if (!ServerInstance->Modes->AddMode(&bc))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 3);
virtual ~ModuleBlockColour()
{
- ServerInstance->Modes->DelMode(bc);
- delete bc;
+ ServerInstance->Modes->DelMode(&bc);
}
virtual Version GetVersion()
class ModuleBotMode : public Module
{
-
- BotMode* bm;
+ BotMode bm;
public:
ModuleBotMode(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), bm(Me)
{
-
- bm = new BotMode(ServerInstance);
- if (!ServerInstance->Modes->AddMode(bm))
+ if (!ServerInstance->Modes->AddMode(&bm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhois };
ServerInstance->Modules->Attach(eventlist, this, 1);
virtual ~ModuleBotMode()
{
- ServerInstance->Modes->DelMode(bm);
- delete bm;
+ ServerInstance->Modes->DelMode(&bm);
}
virtual Version GetVersion()
class ModuleCallerID : public Module
{
private:
- CommandAccept *mycommand;
- User_g* myumode;
+ CommandAccept mycommand;
+ User_g myumode;
// Configuration variables:
unsigned int maxaccepts; // Maximum ACCEPT entries.
}
public:
- ModuleCallerID(InspIRCd* Me) : Module(Me)
+ ModuleCallerID(InspIRCd* Me) : Module(Me), mycommand(Me, maxaccepts), myumode(Me)
{
OnRehash(NULL);
- mycommand = new CommandAccept(ServerInstance, maxaccepts);
- myumode = new User_g(ServerInstance);
- if (!ServerInstance->Modes->AddMode(myumode))
- {
- delete mycommand;
- delete myumode;
+ if (!ServerInstance->Modes->AddMode(&myumode))
throw ModuleException("Could not add usermode +g");
- }
- try
- {
- ServerInstance->AddCommand(mycommand);
- }
- catch (const ModuleException& e)
- {
- delete mycommand;
- delete myumode;
- throw ModuleException("Could not add command!");
- }
+
+ ServerInstance->AddCommand(&mycommand);
Implementation eventlist[] = { I_OnRehash, I_OnUserPreNick, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage, I_OnCleanup };
ServerInstance->Modules->Attach(eventlist, this, 7);
virtual ~ModuleCallerID()
{
- ServerInstance->Modes->DelMode(myumode);
- delete myumode;
+ ServerInstance->Modes->DelMode(&myumode);
}
virtual Version GetVersion()
class ModuleCAP : public Module
{
- CommandCAP* newcommand;
+ CommandCAP newcommand;
public:
ModuleCAP(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), newcommand(Me, this)
{
- // Create a new command
- newcommand = new CommandCAP(ServerInstance, this);
- ServerInstance->AddCommand(newcommand);
+ ServerInstance->AddCommand(&newcommand);
Implementation eventlist[] = { I_OnCheckReady };
ServerInstance->Modules->Attach(eventlist, this, 1);
class ModuleCBan : public Module
{
- CommandCBan* mycommand;
- CBanFactory *f;
+ CommandCBan mycommand;
+ CBanFactory f;
public:
- ModuleCBan(InspIRCd* Me) : Module(Me)
+ ModuleCBan(InspIRCd* Me) : Module(Me), mycommand(Me), f(Me)
{
- f = new CBanFactory(ServerInstance);
- ServerInstance->XLines->RegisterFactory(f);
+ ServerInstance->XLines->RegisterFactory(&f);
- mycommand = new CommandCBan(Me);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&mycommand);
Implementation eventlist[] = { I_OnUserPreJoin, I_OnSyncOtherMetaData, I_OnDecodeMetaData, I_OnStats };
ServerInstance->Modules->Attach(eventlist, this, 4);
}
virtual ~ModuleCBan()
{
ServerInstance->XLines->DelAll("CBAN");
- ServerInstance->XLines->UnregisterFactory(f);
+ ServerInstance->XLines->UnregisterFactory(&f);
}
virtual int OnStats(char symbol, User* user, string_list &out)
class ModuleCensor : public Module
{
censor_t censors;
- CensorUser *cu;
- CensorChannel *cc;
+ CensorUser cu;
+ CensorChannel cc;
public:
ModuleCensor(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cu(Me), cc(Me)
{
/* Read the configuration file on startup.
*/
OnRehash(NULL);
- cu = new CensorUser(ServerInstance);
- cc = new CensorChannel(ServerInstance);
- if (!ServerInstance->Modes->AddMode(cu) || !ServerInstance->Modes->AddMode(cc))
- {
- delete cu;
- delete cc;
+ if (!ServerInstance->Modes->AddMode(&cu) || !ServerInstance->Modes->AddMode(&cc))
throw ModuleException("Could not add new modes!");
- }
Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice, I_OnRunTestSuite };
ServerInstance->Modules->Attach(eventlist, this, 4);
}
virtual ~ModuleCensor()
{
- ServerInstance->Modes->DelMode(cu);
- ServerInstance->Modes->DelMode(cc);
- delete cu;
- delete cc;
+ ServerInstance->Modes->DelMode(&cu);
+ ServerInstance->Modes->DelMode(&cc);
}
// format of a config entry is <badword text="shit" replace="poo">
*/
class CommandWebirc : public Command
{
- CGIHostlist Hosts;
- bool notify;
+ bool notify;
public:
+ CGIHostlist Hosts;
CommandWebirc(InspIRCd* Instance, bool bnotify) : Command(Instance, "WEBIRC", 0, 4, true), notify(bnotify)
{
this->source = "m_cgiirc.so";
ServerInstance->SNO->WriteGlobalSno('a', "Connecting user %s tried to use WEBIRC, but didn't match any configured webirc blocks.", user->GetFullRealHost().c_str());
return CMD_FAILURE;
}
-
- void SetHosts(CGIHostlist &phosts)
- {
- this->Hosts = phosts;
- }
};
class ModuleCgiIRC : public Module
{
- CommandWebirc* mycommand;
+ CommandWebirc cmd;
bool NotifyOpers;
- CGIHostlist Hosts;
public:
- ModuleCgiIRC(InspIRCd* Me) : Module(Me)
+ ModuleCgiIRC(InspIRCd* Me) : Module(Me), cmd(Me, NotifyOpers)
{
- mycommand = new CommandWebirc(Me, NotifyOpers);
OnRehash(NULL);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCleanup, I_OnSyncUserMetaData, I_OnDecodeMetaData, I_OnUserDisconnect, I_OnUserConnect };
ServerInstance->Modules->Attach(eventlist, this, 7);
virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
- Hosts.clear();
+ cmd.Hosts.clear();
NotifyOpers = Conf.ReadFlag("cgiirc", "opernotice", 0); // If we send an oper notice when a CGI:IRC has their host changed.
if (cgitype == INVALID)
cgitype = PASS;
- Hosts.push_back(CGIhost(hostmask,cgitype, password.length() ? password : "" ));
+ cmd.Hosts.push_back(CGIhost(hostmask,cgitype, password.length() ? password : "" ));
}
}
else
continue;
}
}
-
- mycommand->SetHosts(Hosts);
}
virtual void OnCleanup(int target_type, void* item)
virtual int OnUserRegister(User* user)
{
- for(CGIHostlist::iterator iter = Hosts.begin(); iter != Hosts.end(); iter++)
+ for(CGIHostlist::iterator iter = cmd.Hosts.begin(); iter != cmd.Hosts.end(); iter++)
{
if(InspIRCd::Match(user->host, iter->hostmask, ascii_case_insensitive_map) || InspIRCd::MatchCIDR(user->GetIPString(), iter->hostmask, ascii_case_insensitive_map))
{
class ModuleChanFilter : public Module
{
-
- ChanFilter* cf;
+ ChanFilter cf;
bool hidemask;
public:
ModuleChanFilter(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cf(Me)
{
- cf = new ChanFilter(ServerInstance);
- if (!ServerInstance->Modes->AddMode(cf))
+ if (!ServerInstance->Modes->AddMode(&cf))
throw ModuleException("Could not add new modes!");
- cf->DoImplements(this);
+ cf.DoImplements(this);
Implementation eventlist[] = { I_OnCleanup, I_OnChannelDelete, I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice, I_OnSyncChannel };
ServerInstance->Modules->Attach(eventlist, this, 6);
virtual void OnChannelDelete(Channel* chan)
{
- cf->DoChannelDelete(chan);
+ cf.DoChannelDelete(chan);
}
virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
hidemask = Conf.ReadFlag("chanfilter", "hidemask", 0);
- cf->DoRehash();
+ cf.DoRehash();
}
virtual int ProcessMessages(User* user,Channel* chan,std::string &text)
return 0;
modelist* list;
- chan->GetExt(cf->GetInfoKey(), list);
+ chan->GetExt(cf.GetInfoKey(), list);
if (list)
{
virtual void OnCleanup(int target_type, void* item)
{
- cf->DoCleanup(target_type, item);
+ cf.DoCleanup(target_type, item);
}
virtual const char* OnRequest(Request* request)
{
- return cf->DoOnRequest(request);
+ return cf.DoOnRequest(request);
}
virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
virtual void OnSyncChannel(Channel* chan, Module* proto, void* opaque)
{
- cf->DoSyncChannel(chan, proto, opaque);
+ cf.DoSyncChannel(chan, proto, opaque);
}
virtual Version GetVersion()
virtual ~ModuleChanFilter()
{
- ServerInstance->Modes->DelMode(cf);
- delete cf;
+ ServerInstance->Modes->DelMode(&cf);
ServerInstance->Modules->UnpublishInterface("ChannelBanList", this);
}
};
class ModuleCheck : public Module
{
private:
- CommandCheck *mycommand;
+ CommandCheck mycommand;
public:
- ModuleCheck(InspIRCd* Me) : Module(Me)
+ ModuleCheck(InspIRCd* Me) : Module(Me), mycommand(Me, this)
{
- mycommand = new CommandCheck(ServerInstance, this);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&mycommand);
}
virtual ~ModuleCheck()
{
User* user = static_cast<User*>(opaque);
user->WriteServ("304 " + std::string(user->nick) + " :CHECK meta:" + name + " " + value);
- mycommand->md_sent = true;
+ mycommand.md_sent = true;
}
};
class ModuleChgHost : public Module
{
- CommandChghost* mycommand;
+ CommandChghost cmd;
char hostmap[256];
public:
ModuleChgHost(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me, hostmap)
{
OnRehash(NULL);
- mycommand = new CommandChghost(ServerInstance, hostmap);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 1);
}
class ModuleChgIdent : public Module
{
- CommandChgident* mycommand;
-
+ CommandChgident cmd;
public:
- ModuleChgIdent(InspIRCd* Me) : Module(Me)
+ ModuleChgIdent(InspIRCd* Me) : Module(Me), cmd(Me)
{
- mycommand = new CommandChgident(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleChgIdent()
class ModuleChgName : public Module
{
- CommandChgname* mycommand;
-
+ CommandChgname cmd;
public:
- ModuleChgName(InspIRCd* Me) : Module(Me)
+ ModuleChgName(InspIRCd* Me) : Module(Me), cmd(Me)
{
- mycommand = new CommandChgname(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleChgName()
class ModuleCloaking : public Module
{
private:
-
CloakUser* cu;
- Module* HashModule;
public:
ModuleCloaking(InspIRCd* Me)
: Module(Me)
{
/* Attempt to locate the md5 service provider, bail if we can't find it */
- HashModule = ServerInstance->Modules->Find("m_md5.so");
+ Module* HashModule = ServerInstance->Modules->Find("m_md5.so");
if (!HashModule)
throw ModuleException("Can't find m_md5.so. Please load m_md5.so before m_cloaking.so.");
class ModuleClones : public Module
{
private:
- CommandClones *mycommand;
+ CommandClones cmd;
public:
- ModuleClones(InspIRCd* Me) : Module(Me)
+ ModuleClones(InspIRCd* Me) : Module(Me), cmd(Me)
{
-
- mycommand = new CommandClones(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleClones()
class ModuleClose : public Module
{
- CommandClose* newcommand;
+ CommandClose cmd;
public:
ModuleClose(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
- // Create a new command
- newcommand = new CommandClose(ServerInstance);
- ServerInstance->AddCommand(newcommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleClose()
class ModulePrivacyMode : public Module
{
- PrivacyMode* pm;
+ PrivacyMode pm;
public:
- ModulePrivacyMode(InspIRCd* Me) : Module(Me)
+ ModulePrivacyMode(InspIRCd* Me) : Module(Me), pm(Me)
{
- pm = new PrivacyMode(ServerInstance);
- if (!ServerInstance->Modes->AddMode(pm))
+ if (!ServerInstance->Modes->AddMode(&pm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice };
ServerInstance->Modules->Attach(eventlist, this, 2);
virtual ~ModulePrivacyMode()
{
- ServerInstance->Modes->DelMode(pm);
- delete pm;
+ ServerInstance->Modes->DelMode(&pm);
}
virtual Version GetVersion()
class ModuleCustomTitle : public Module
{
- CommandTitle* mycommand;
+ CommandTitle cmd;
public:
- ModuleCustomTitle(InspIRCd* Me) : Module(Me)
+ ModuleCustomTitle(InspIRCd* Me) : Module(Me), cmd(Me)
{
-
- mycommand = new CommandTitle(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnDecodeMetaData, I_OnWhoisLine, I_OnSyncUserMetaData, I_OnUserQuit, I_OnCleanup };
ServerInstance->Modules->Attach(eventlist, this, 5);
}
class ModuleCycle : public Module
{
- CommandCycle* mycommand;
+ CommandCycle cmd;
public:
ModuleCycle(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandCycle(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleCycle()
class ModuleDCCAllow : public Module
{
- CommandDccallow* mycommand;
+ CommandDccallow cmd;
public:
ModuleDCCAllow(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
Conf = new ConfigReader(ServerInstance);
- mycommand = new CommandDccallow(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
ReadFileConf();
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserQuit, I_OnUserPreNick, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 5);
class ModuleDeaf : public Module
{
- User_d* m1;
+ User_d m1;
std::string deaf_bypasschars;
std::string deaf_bypasschars_uline;
public:
ModuleDeaf(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), m1(Me)
{
- m1 = new User_d(ServerInstance);
- if (!ServerInstance->Modes->AddMode(m1))
+ if (!ServerInstance->Modes->AddMode(&m1))
throw ModuleException("Could not add new modes!");
OnRehash(NULL);
virtual ~ModuleDeaf()
{
- ServerInstance->Modes->DelMode(m1);
- delete m1;
+ ServerInstance->Modes->DelMode(&m1);
}
virtual Version GetVersion()
class ModuleDelayJoin : public Module
{
private:
- DelayJoinMode* djm;
+ DelayJoinMode djm;
CUList nl;
public:
- ModuleDelayJoin(InspIRCd* Me) : Module(Me)
+ ModuleDelayJoin(InspIRCd* Me) : Module(Me), djm(Me, this)
{
- djm = new DelayJoinMode(ServerInstance, this);
- if (!ServerInstance->Modes->AddMode(djm))
+ if (!ServerInstance->Modes->AddMode(&djm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart, I_OnUserKick, I_OnUserQuit, I_OnNamesListItem, I_OnText, I_OnHostCycle };
ServerInstance->Modules->Attach(eventlist, this, 7);
ModuleDelayJoin::~ModuleDelayJoin()
{
- ServerInstance->Modes->DelMode(djm);
- delete djm;
+ ServerInstance->Modes->DelMode(&djm);
}
Version ModuleDelayJoin::GetVersion()
class ModuleDeVoice : public Module
{
- CommandDevoice *mycommand;
+ CommandDevoice cmd;
public:
- ModuleDeVoice(InspIRCd* Me) : Module(Me)
+ ModuleDeVoice(InspIRCd* Me) : Module(Me), cmd(Me)
{
-
- mycommand = new CommandDevoice(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleDeVoice()
}
};
-class CommandFilter;
+class FilterBase;
+
+class CommandFilter : public Command
+{
+ FilterBase* Base;
+ public:
+ CommandFilter(FilterBase* f, InspIRCd* Me, const std::string &ssource) : Command(Me, "FILTER", "o", 1, 5), Base(f)
+ {
+ this->source = ssource;
+ this->syntax = "<filter-definition> <action> <flags> [<gline-duration>] :<reason>";
+ }
+ CmdResult Handle(const std::vector<std::string>&, User*);
+
+ void TooFewParams(User* user, const std::string &extra_text)
+ {
+ user->WriteServ("NOTICE %s :*** Not enough parameters%s", user->nick.c_str(), extra_text.c_str());
+ }
+};
class FilterBase : public Module
{
- CommandFilter* filtcommand;
+ CommandFilter filtcommand;
int flags;
protected:
std::vector<std::string> exemptfromfilter; // List of channel names excluded from filtering.
virtual void ReadFilters(ConfigReader &MyConf) = 0;
};
-class CommandFilter : public Command
+CmdResult CommandFilter::Handle(const std::vector<std::string> ¶meters, User *user)
{
- FilterBase* Base;
- public:
- CommandFilter(FilterBase* f, InspIRCd* Me, const std::string &ssource) : Command(Me, "FILTER", "o", 1, 5), Base(f)
+ if (parameters.size() == 1)
{
- this->source = ssource;
- this->syntax = "<filter-definition> <action> <flags> [<gline-duration>] :<reason>";
- }
-
- CmdResult Handle(const std::vector<std::string> ¶meters, User *user)
- {
- if (parameters.size() == 1)
+ /* Deleting a filter */
+ if (Base->DeleteFilter(parameters[0]))
{
- /* Deleting a filter */
- if (Base->DeleteFilter(parameters[0]))
- {
- user->WriteServ("NOTICE %s :*** Removed filter '%s'", user->nick.c_str(), parameters[0].c_str());
- ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'a' : 'A', std::string("FILTER: ")+user->nick+" removed filter '"+parameters[0]+"'");
- return CMD_SUCCESS;
- }
- else
- {
- user->WriteServ("NOTICE %s :*** Filter '%s' not found in list, try /stats s.", user->nick.c_str(), parameters[0].c_str());
- return CMD_FAILURE;
- }
+ user->WriteServ("NOTICE %s :*** Removed filter '%s'", user->nick.c_str(), parameters[0].c_str());
+ ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'a' : 'A', std::string("FILTER: ")+user->nick+" removed filter '"+parameters[0]+"'");
+ return CMD_SUCCESS;
}
else
{
- /* Adding a filter */
- if (parameters.size() >= 4)
- {
- std::string freeform = parameters[0];
- std::string type = parameters[1];
- std::string flags = parameters[2];
- std::string reason;
- long duration = 0;
+ user->WriteServ("NOTICE %s :*** Filter '%s' not found in list, try /stats s.", user->nick.c_str(), parameters[0].c_str());
+ return CMD_FAILURE;
+ }
+ }
+ else
+ {
+ /* Adding a filter */
+ if (parameters.size() >= 4)
+ {
+ std::string freeform = parameters[0];
+ std::string type = parameters[1];
+ std::string flags = parameters[2];
+ std::string reason;
+ long duration = 0;
- if ((type != "gline") && (type != "none") && (type != "block") && (type != "kill") && (type != "silent"))
- {
- user->WriteServ("NOTICE %s :*** Invalid filter type '%s'. Supported types are 'gline', 'none', 'block', 'silent' and 'kill'.", user->nick.c_str(), type.c_str());
- return CMD_FAILURE;
- }
+ if ((type != "gline") && (type != "none") && (type != "block") && (type != "kill") && (type != "silent"))
+ {
+ user->WriteServ("NOTICE %s :*** Invalid filter type '%s'. Supported types are 'gline', 'none', 'block', 'silent' and 'kill'.", user->nick.c_str(), type.c_str());
+ return CMD_FAILURE;
+ }
- if (type == "gline")
+ if (type == "gline")
+ {
+ if (parameters.size() >= 5)
{
- if (parameters.size() >= 5)
- {
- duration = ServerInstance->Duration(parameters[3]);
- reason = parameters[4];
- }
- else
- {
- this->TooFewParams(user, ": When setting a gline type filter, a gline duration must be specified as the third parameter.");
- return CMD_FAILURE;
- }
+ duration = ServerInstance->Duration(parameters[3]);
+ reason = parameters[4];
}
else
{
- reason = parameters[3];
+ this->TooFewParams(user, ": When setting a gline type filter, a gline duration must be specified as the third parameter.");
+ return CMD_FAILURE;
}
- std::pair<bool, std::string> result = Base->AddFilter(freeform, type, reason, duration, flags);
- if (result.first)
- {
- user->WriteServ("NOTICE %s :*** Added filter '%s', type '%s'%s%s, flags '%s', reason: '%s'", user->nick.c_str(), freeform.c_str(),
- type.c_str(), (duration ? ", duration " : ""), (duration ? parameters[3].c_str() : ""),
- flags.c_str(), reason.c_str());
+ }
+ else
+ {
+ reason = parameters[3];
+ }
+ std::pair<bool, std::string> result = Base->AddFilter(freeform, type, reason, duration, flags);
+ if (result.first)
+ {
+ user->WriteServ("NOTICE %s :*** Added filter '%s', type '%s'%s%s, flags '%s', reason: '%s'", user->nick.c_str(), freeform.c_str(),
+ type.c_str(), (duration ? ", duration " : ""), (duration ? parameters[3].c_str() : ""),
+ flags.c_str(), reason.c_str());
- ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'a' : 'A', std::string("FILTER: ")+user->nick+" added filter '"+freeform+"', type '"+type+"', "+(duration ? "duration "+parameters[3]+", " : "")+"flags '"+flags+"', reason: "+reason);
+ ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'a' : 'A', std::string("FILTER: ")+user->nick+" added filter '"+freeform+"', type '"+type+"', "+(duration ? "duration "+parameters[3]+", " : "")+"flags '"+flags+"', reason: "+reason);
- return CMD_SUCCESS;
- }
- else
- {
- user->WriteServ("NOTICE %s :*** Filter '%s' could not be added: %s", user->nick.c_str(), freeform.c_str(), result.second.c_str());
- return CMD_FAILURE;
- }
+ return CMD_SUCCESS;
}
else
{
- this->TooFewParams(user, ".");
+ user->WriteServ("NOTICE %s :*** Filter '%s' could not be added: %s", user->nick.c_str(), freeform.c_str(), result.second.c_str());
return CMD_FAILURE;
}
-
}
- }
+ else
+ {
+ this->TooFewParams(user, ".");
+ return CMD_FAILURE;
+ }
- void TooFewParams(User* user, const std::string &extra_text)
- {
- user->WriteServ("NOTICE %s :*** Not enough parameters%s", user->nick.c_str(), extra_text.c_str());
}
-};
+}
bool FilterBase::AppliesToMe(User* user, FilterResult* filter, int iflags)
{
return true;
}
-FilterBase::FilterBase(InspIRCd* Me, const std::string &source) : Module(Me)
+FilterBase::FilterBase(InspIRCd* Me, const std::string &source) : Module(Me), filtcommand(this, Me, source)
{
Me->Modules->UseInterface("RegularExpression");
- filtcommand = new CommandFilter(this, Me, source);
- ServerInstance->AddCommand(filtcommand);
+ ServerInstance->AddCommand(&filtcommand);
Implementation eventlist[] = { I_OnPreCommand, I_OnStats, I_OnSyncOtherMetaData, I_OnDecodeMetaData, I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash, I_OnLoadModule };
ServerInstance->Modules->Attach(eventlist, this, 8);
}
class ModuleGlobalLoad : public Module
{
- CommandGloadmodule *mycommand;
- CommandGunloadmodule *mycommand2;
- CommandGreloadmodule *mycommand3;
+ CommandGloadmodule cmd1;
+ CommandGunloadmodule cmd2;
+ CommandGreloadmodule cmd3;
public:
- ModuleGlobalLoad(InspIRCd* Me) : Module(Me)
+ ModuleGlobalLoad(InspIRCd* Me)
+ : Module(Me), cmd1(Me), cmd2(Me), cmd3(Me)
{
-
- mycommand = new CommandGloadmodule(ServerInstance);
- mycommand2 = new CommandGunloadmodule(ServerInstance);
- mycommand3 = new CommandGreloadmodule(ServerInstance);
- ServerInstance->AddCommand(mycommand);
- ServerInstance->AddCommand(mycommand2);
- ServerInstance->AddCommand(mycommand3);
-
+ ServerInstance->AddCommand(&cmd1);
+ ServerInstance->AddCommand(&cmd2);
+ ServerInstance->AddCommand(&cmd3);
}
virtual ~ModuleGlobalLoad()
class ModuleGlobops : public Module
{
- CommandGlobops* mycommand;
+ CommandGlobops cmd;
public:
ModuleGlobops(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
- mycommand = new CommandGlobops(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
ServerInstance->SNO->EnableSnomask('g',"GLOBOPS");
}
{
private:
std::string h_file;
- CommandHelpop* mycommand;
- Helpop* ho;
+ CommandHelpop cmd;
+ Helpop ho;
public:
ModuleHelpop(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me), ho(Me)
{
ReadConfig();
- ho = new Helpop(ServerInstance);
- if (!ServerInstance->Modes->AddMode(ho))
+ if (!ServerInstance->Modes->AddMode(&ho))
throw ModuleException("Could not add new modes!");
- mycommand = new CommandHelpop(ServerInstance);
- ServerInstance->AddCommand(mycommand);
- Implementation eventlist[] = { I_OnRehash, I_OnWhois };
- ServerInstance->Modules->Attach(eventlist, this, 2);
+ ServerInstance->AddCommand(&cmd);
+ Implementation eventlist[] = { I_OnRehash, I_OnWhois };
+ ServerInstance->Modules->Attach(eventlist, this, 2);
}
virtual void ReadConfig()
virtual ~ModuleHelpop()
{
- ServerInstance->Modes->DelMode(ho);
- delete ho;
+ ServerInstance->Modes->DelMode(&ho);
}
virtual Version GetVersion()
class ModuleHideChans : public Module
{
bool AffectsOpers;
- HideChans* hm;
+ HideChans hm;
public:
- ModuleHideChans(InspIRCd* Me) : Module(Me)
+ ModuleHideChans(InspIRCd* Me) : Module(Me), hm(Me)
{
-
- hm = new HideChans(ServerInstance);
- if (!ServerInstance->Modes->AddMode(hm))
+ if (!ServerInstance->Modes->AddMode(&hm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhoisLine, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 2);
virtual ~ModuleHideChans()
{
- ServerInstance->Modes->DelMode(hm);
- delete hm;
+ ServerInstance->Modes->DelMode(&hm);
}
virtual Version GetVersion()
class ModuleHideOper : public Module
{
-
- HideOper* hm;
+ HideOper hm;
public:
ModuleHideOper(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), hm(Me)
{
- hm = new HideOper(ServerInstance);
- if (!ServerInstance->Modes->AddMode(hm))
+ if (!ServerInstance->Modes->AddMode(&hm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhoisLine };
ServerInstance->Modules->Attach(eventlist, this, 1);
virtual ~ModuleHideOper()
{
- ServerInstance->Modes->DelMode(hm);
- delete hm;
+ ServerInstance->Modes->DelMode(&hm);
}
virtual Version GetVersion()
class ModuleInvisible : public Module
{
private:
- InvisibleMode* qm;
- InvisibleDeOper* ido;
+ InvisibleMode qm;
+ InvisibleDeOper ido;
public:
ModuleInvisible(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), qm(Me), ido(Me)
{
conf = new ConfigReader(ServerInstance);
- qm = new InvisibleMode(ServerInstance);
- if (!ServerInstance->Modes->AddMode(qm))
+ if (!ServerInstance->Modes->AddMode(&qm))
throw ModuleException("Could not add new modes!");
- ido = new InvisibleDeOper(ServerInstance);
- if (!ServerInstance->Modes->AddModeWatcher(ido))
+ if (!ServerInstance->Modes->AddModeWatcher(&ido))
throw ModuleException("Could not add new mode watcher on usermode +o!");
/* Yeah i know people can take this out. I'm not about to obfuscate code just to be a pain in the ass. */
virtual ~ModuleInvisible()
{
- ServerInstance->Modes->DelMode(qm);
- ServerInstance->Modes->DelModeWatcher(ido);
- delete qm;
- delete ido;
+ ServerInstance->Modes->DelMode(&qm);
+ ServerInstance->Modes->DelModeWatcher(&ido);
delete conf;
};
class ModuleInviteException : public Module
{
- InviteException* ie;
+ InviteException ie;
public:
- ModuleInviteException(InspIRCd* Me) : Module(Me)
+ ModuleInviteException(InspIRCd* Me) : Module(Me), ie(Me)
{
- ie = new InviteException(ServerInstance);
- if (!ServerInstance->Modes->AddMode(ie))
+ if (!ServerInstance->Modes->AddMode(&ie))
throw ModuleException("Could not add new modes!");
ServerInstance->Modules->PublishInterface("ChannelBanList", this);
- ie->DoImplements(this);
+ ie.DoImplements(this);
Implementation eventlist[] = { I_OnRequest, I_On005Numeric, I_OnCheckInvite };
ServerInstance->Modules->Attach(eventlist, this, 3);
}
if(chan != NULL)
{
modelist* list;
- chan->GetExt(ie->GetInfoKey(), list);
+ chan->GetExt(ie.GetInfoKey(), list);
if (list)
{
std::string mask = std::string(user->nick) + "!" + user->ident + "@" + user->GetIPString();
virtual const char* OnRequest(Request* request)
{
- return ie->DoOnRequest(request);
+ return ie.DoOnRequest(request);
}
virtual void OnCleanup(int target_type, void* item)
{
- ie->DoCleanup(target_type, item);
+ ie.DoCleanup(target_type, item);
}
virtual void OnSyncChannel(Channel* chan, Module* proto, void* opaque)
{
- ie->DoSyncChannel(chan, proto, opaque);
+ ie.DoSyncChannel(chan, proto, opaque);
}
virtual void OnChannelDelete(Channel* chan)
{
- ie->DoChannelDelete(chan);
+ ie.DoChannelDelete(chan);
}
virtual void OnRehash(User* user)
{
- ie->DoRehash();
+ ie.DoRehash();
}
virtual Version GetVersion()
~ModuleInviteException()
{
- ServerInstance->Modes->DelMode(ie);
- delete ie;
+ ServerInstance->Modes->DelMode(&ie);
ServerInstance->Modules->UnpublishInterface("ChannelBanList", this);
}
};
class ModuleJoinFlood : public Module
{
- JoinFlood* jf;
+ JoinFlood jf;
public:
ModuleJoinFlood(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), jf(Me)
{
- jf = new JoinFlood(ServerInstance);
- if (!ServerInstance->Modes->AddMode(jf))
+ if (!ServerInstance->Modes->AddMode(&jf))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnChannelDelete, I_OnUserPreJoin, I_OnUserJoin };
ServerInstance->Modules->Attach(eventlist, this, 3);
virtual ~ModuleJoinFlood()
{
- ServerInstance->Modes->DelMode(jf);
- delete jf;
+ ServerInstance->Modes->DelMode(&jf);
}
virtual Version GetVersion()
class ModuleJumpServer : public Module
{
- CommandJumpserver* js;
+ CommandJumpserver js;
public:
ModuleJumpServer(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), js(Me)
{
-
- js = new CommandJumpserver(ServerInstance);
- ServerInstance->AddCommand(js);
+ ServerInstance->AddCommand(&js);
Implementation eventlist[] = { I_OnUserRegister };
ServerInstance->Modules->Attach(eventlist, this, 1);
}
virtual int OnUserRegister(User* user)
{
- if (js->port && js->redirect_new_users)
+ if (js.port && js.redirect_new_users)
{
- user->WriteNumeric(10, "%s %s %d :Please use this Server/Port instead", user->nick.c_str(), js->redirect_to.c_str(), js->port);
- ServerInstance->Users->QuitUser(user, js->reason);
+ user->WriteNumeric(10, "%s %s %d :Please use this Server/Port instead",
+ user->nick.c_str(), js.redirect_to.c_str(), js.port);
+ ServerInstance->Users->QuitUser(user, js.reason);
return 0;
}
return 0;
class ModuleKickNoRejoin : public Module
{
- KickRejoin* kr;
+ KickRejoin kr;
public:
ModuleKickNoRejoin(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), kr(Me)
{
-
- kr = new KickRejoin(ServerInstance);
- if (!ServerInstance->Modes->AddMode(kr))
+ if (!ServerInstance->Modes->AddMode(&kr))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnCleanup, I_OnChannelDelete, I_OnUserPreJoin, I_OnUserKick };
ServerInstance->Modules->Attach(eventlist, this, 4);
virtual ~ModuleKickNoRejoin()
{
- ServerInstance->Modes->DelMode(kr);
- delete kr;
+ ServerInstance->Modes->DelMode(&kr);
}
virtual Version GetVersion()
class ModuleKnock : public Module
{
- CommandKnock* mycommand;
- Knock* kn;
+ CommandKnock cmd;
+ Knock kn;
public:
- ModuleKnock(InspIRCd* Me) : Module(Me)
+ ModuleKnock(InspIRCd* Me) : Module(Me), cmd(Me), kn(Me)
{
- kn = new Knock(ServerInstance);
-
- if (!ServerInstance->Modes->AddMode(kn))
+ if (!ServerInstance->Modes->AddMode(&kn))
throw ModuleException("Could not add new modes!");
-
- mycommand = new CommandKnock(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleKnock()
{
- ServerInstance->Modes->DelMode(kn);
- delete kn;
+ ServerInstance->Modes->DelMode(&kn);
}
virtual Version GetVersion()
{
private:
bool locked;
- CommandLockserv* lockcommand;
- CommandUnlockserv* unlockcommand;
+ CommandLockserv lockcommand;
+ CommandUnlockserv unlockcommand;
virtual void ResetLocked()
{
}
public:
- ModuleLockserv(InspIRCd* Me) : Module(Me)
+ ModuleLockserv(InspIRCd* Me) : Module(Me), lockcommand(Me, locked), unlockcommand(Me, locked)
{
ResetLocked();
- lockcommand = new CommandLockserv(ServerInstance, locked);
- ServerInstance->AddCommand(lockcommand);
-
- unlockcommand = new CommandUnlockserv(ServerInstance, locked);
- ServerInstance->AddCommand(unlockcommand);
+ ServerInstance->AddCommand(&lockcommand);
+ ServerInstance->AddCommand(&unlockcommand);
Implementation eventlist[] = { I_OnUserRegister, I_OnRehash, I_OnCheckReady };
ServerInstance->Modules->Attach(eventlist, this, 3);
}
ModuleMapHide(InspIRCd* Me)
: Module(Me)
{
- // Create a new command
ServerInstance->Modules->Attach(I_OnPreCommand, this);
ServerInstance->Modules->Attach(I_OnRehash, this);
OnRehash(NULL);
class ModuleMsgFlood : public Module
{
-
- MsgFlood* mf;
+ MsgFlood mf;
public:
ModuleMsgFlood(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), mf(Me)
{
-
- mf = new MsgFlood(ServerInstance);
- if (!ServerInstance->Modes->AddMode(mf))
+ if (!ServerInstance->Modes->AddMode(&mf))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnChannelDelete, I_OnUserPreNotice, I_OnUserPreMessage };
ServerInstance->Modules->Attach(eventlist, this, 3);
virtual ~ModuleMsgFlood()
{
- ServerInstance->Modes->DelMode(mf);
- delete mf;
+ ServerInstance->Modes->DelMode(&mf);
}
virtual Version GetVersion()
class ModuleNickFlood : public Module
{
- NickFlood* jf;
+ NickFlood jf;
public:
ModuleNickFlood(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), jf(Me)
{
-
- jf = new NickFlood(ServerInstance);
- if (!ServerInstance->Modes->AddMode(jf))
+ if (!ServerInstance->Modes->AddMode(&jf))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnChannelDelete, I_OnUserPreNick, I_OnUserPostNick };
ServerInstance->Modules->Attach(eventlist, this, 3);
virtual ~ModuleNickFlood()
{
- ServerInstance->Modes->DelMode(jf);
- delete jf;
+ ServerInstance->Modes->DelMode(&jf);
}
virtual Version GetVersion()
class ModuleNickLock : public Module
{
- CommandNicklock* cmd1;
- CommandNickunlock* cmd2;
+ CommandNicklock cmd1;
+ CommandNickunlock cmd2;
char* n;
public:
ModuleNickLock(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd1(Me), cmd2(Me)
{
-
- cmd1 = new CommandNicklock(ServerInstance);
- cmd2 = new CommandNickunlock(ServerInstance);
- ServerInstance->AddCommand(cmd1);
- ServerInstance->AddCommand(cmd2);
+ ServerInstance->AddCommand(&cmd1);
+ ServerInstance->AddCommand(&cmd2);
Implementation eventlist[] = { I_OnUserPreNick, I_OnUserQuit, I_OnCleanup };
ServerInstance->Modules->Attach(eventlist, this, 3);
}
class ModuleNoCTCP : public Module
{
- NoCTCP* nc;
+ NoCTCP nc;
public:
ModuleNoCTCP(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), nc(Me)
{
-
- nc = new NoCTCP(ServerInstance);
- if (!ServerInstance->Modes->AddMode(nc))
+ if (!ServerInstance->Modes->AddMode(&nc))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 3);
virtual ~ModuleNoCTCP()
{
- ServerInstance->Modes->DelMode(nc);
- delete nc;
+ ServerInstance->Modes->DelMode(&nc);
}
virtual Version GetVersion()
class ModuleNoKicks : public Module
{
- NoKicks* nk;
+ NoKicks nk;
public:
ModuleNoKicks(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), nk(Me)
{
- nk = new NoKicks(ServerInstance);
- if (!ServerInstance->Modes->AddMode(nk))
+ if (!ServerInstance->Modes->AddMode(&nk))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnAccessCheck, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 2);
virtual ~ModuleNoKicks()
{
- ServerInstance->Modes->DelMode(nk);
- delete nk;
+ ServerInstance->Modes->DelMode(&nk);
}
virtual Version GetVersion()
class ModuleNoNickChange : public Module
{
- NoNicks* nn;
+ NoNicks nn;
public:
- ModuleNoNickChange(InspIRCd* Me) : Module(Me)
+ ModuleNoNickChange(InspIRCd* Me) : Module(Me), nn(Me)
{
-
- nn = new NoNicks(ServerInstance);
- ServerInstance->Modes->AddMode(nn);
+ ServerInstance->Modes->AddMode(&nn);
Implementation eventlist[] = { I_OnUserPreNick, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
virtual ~ModuleNoNickChange()
{
- ServerInstance->Modes->DelMode(nn);
- delete nn;
+ ServerInstance->Modes->DelMode(&nn);
}
virtual Version GetVersion()
class ModuleNoNotice : public Module
{
-
- NoNotice* nt;
+ NoNotice nt;
public:
ModuleNoNotice(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), nt(Me)
{
-
- nt = new NoNotice(ServerInstance);
- if (!ServerInstance->Modes->AddMode(nt))
+ if (!ServerInstance->Modes->AddMode(&nt))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreNotice, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 2);
virtual ~ModuleNoNotice()
{
- ServerInstance->Modes->DelMode(nt);
- delete nt;
+ ServerInstance->Modes->DelMode(&nt);
}
virtual Version GetVersion()
class ModuleOperChans : public Module
{
- OperChans* oc;
+ OperChans oc;
public:
ModuleOperChans(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), oc(Me)
{
-
- oc = new OperChans(ServerInstance);
- if (!ServerInstance->Modes->AddMode(oc))
+ if (!ServerInstance->Modes->AddMode(&oc))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnCheckBan, I_OnUserPreJoin };
ServerInstance->Modules->Attach(eventlist, this, 2);
virtual ~ModuleOperChans()
{
- ServerInstance->Modes->DelMode(oc);
- delete oc;
+ ServerInstance->Modes->DelMode(&oc);
}
virtual Version GetVersion()
class ModuleOpermotd : public Module
{
- CommandOpermotd* mycommand;
+ CommandOpermotd cmd;
bool onoper;
public:
}
ModuleOpermotd(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
opermotd = NULL;
- mycommand = new CommandOpermotd(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
opermotd = new FileReader(ServerInstance);
LoadOperMOTD();
Implementation eventlist[] = { I_OnRehash, I_OnOper };
class ModuleOperHash : public Module
{
- CommandMkpasswd* mycommand;
+ CommandMkpasswd cmd;
hashymodules hashers; /* List of modules which implement HashRequest */
std::deque<std::string> names; /* Module names which implement HashRequest */
public:
ModuleOperHash(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me, this, hashers, names)
{
diduseiface = false;
diduseiface = true;
}
- mycommand = new CommandMkpasswd(ServerInstance, this, hashers, names);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnPassCompare, I_OnLoadModule };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
class ModulePermanentChannels : public Module
{
- PermChannel *p;
+ PermChannel p;
public:
- ModulePermanentChannels(InspIRCd* Me) : Module(Me)
+ ModulePermanentChannels(InspIRCd* Me) : Module(Me), p(Me)
{
- p = new PermChannel(ServerInstance);
- if (!ServerInstance->Modes->AddMode(p))
- {
- delete p;
+ if (!ServerInstance->Modes->AddMode(&p))
throw ModuleException("Could not add new modes!");
- }
Implementation eventlist[] = { I_OnChannelPreDelete };
ServerInstance->Modules->Attach(eventlist, this, 1);
virtual ~ModulePermanentChannels()
{
- ServerInstance->Modes->DelMode(p);
- delete p;
+ ServerInstance->Modes->DelMode(&p);
}
virtual void OnRehash(User *user)
class ModuleRandQuote : public Module
{
private:
- CommandRandquote* mycommand;
+ CommandRandquote cmd;
ConfigReader *conf;
public:
ModuleRandQuote(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
conf = new ConfigReader(ServerInstance);
prefix = conf->ReadValue("randquote","prefix",0);
suffix = conf->ReadValue("randquote","suffix",0);
- mycommand = NULL;
-
if (q_file.empty())
{
throw ModuleException("m_randquote: Quotefile not specified - Please check your config.");
else
{
/* Hidden Command -- Mode clients assume /quote sends raw data to an IRCd >:D */
- mycommand = new CommandRandquote(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
}
Implementation eventlist[] = { I_OnUserConnect };
ServerInstance->Modules->Attach(eventlist, this, 1);
virtual void OnUserConnect(User* user)
{
- if (mycommand)
- mycommand->Handle(std::vector<std::string>(), user);
+ cmd.Handle(std::vector<std::string>(), user);
}
};
class ModuleRedirect : public Module
{
- Redirect* re;
+ Redirect re;
public:
ModuleRedirect(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), re(Me)
{
- re = new Redirect(ServerInstance);
- if (!ServerInstance->Modes->AddMode(re))
+ if (!ServerInstance->Modes->AddMode(&re))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreJoin };
ServerInstance->Modules->Attach(eventlist, this, 1);
virtual ~ModuleRedirect()
{
- ServerInstance->Modes->DelMode(re);
- delete re;
+ ServerInstance->Modes->DelMode(&re);
}
virtual Version GetVersion()
class ModuleRemove : public Module
{
- CommandRemove* mycommand;
- CommandFpart* mycommand2;
+ CommandRemove cmd1;
+ CommandFpart cmd2;
bool supportnokicks;
public:
ModuleRemove(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd1(Me, supportnokicks), cmd2(Me, supportnokicks)
{
- mycommand = new CommandRemove(ServerInstance, supportnokicks);
- mycommand2 = new CommandFpart(ServerInstance, supportnokicks);
- ServerInstance->AddCommand(mycommand);
- ServerInstance->AddCommand(mycommand2);
+ ServerInstance->AddCommand(&cmd1);
+ ServerInstance->AddCommand(&cmd2);
OnRehash(NULL);
Implementation eventlist[] = { I_On005Numeric, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 2);
class ModuleRLine : public Module
{
private:
- CommandRLine *r;
- RLineFactory *f;
+ CommandRLine r;
+ RLineFactory f;
bool MatchOnNickChange;
std::string RegexEngine;
public:
- ModuleRLine(InspIRCd* Me) : Module(Me)
+ ModuleRLine(InspIRCd* Me) : Module(Me), r(Me), f(Me)
{
mymodule = this;
OnRehash(NULL);
Me->Modules->UseInterface("RegularExpression");
- // Create a new command
- r = new CommandRLine(ServerInstance);
- ServerInstance->AddCommand(r);
-
- f = new RLineFactory(ServerInstance);
- ServerInstance->XLines->RegisterFactory(f);
+ ServerInstance->AddCommand(&r);
+ ServerInstance->XLines->RegisterFactory(&f);
Implementation eventlist[] = { I_OnUserConnect, I_OnRehash, I_OnUserPostNick, I_OnLoadModule, I_OnStats };
ServerInstance->Modules->Attach(eventlist, this, 5);
{
ServerInstance->Modules->DoneWithInterface("RegularExpression");
ServerInstance->XLines->DelAll("R");
- ServerInstance->XLines->UnregisterFactory(f);
+ ServerInstance->XLines->UnregisterFactory(&f);
}
virtual Version GetVersion()
class ModuleSajoin : public Module
{
- CommandSajoin* mycommand;
+ CommandSajoin cmd;
public:
ModuleSajoin(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSajoin(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSajoin()
class ModuleSakick : public Module
{
- CommandSakick* mycommand;
+ CommandSakick cmd;
public:
ModuleSakick(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSakick(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSakick()
class ModuleSaMode : public Module
{
- CommandSamode* mycommand;
+ CommandSamode cmd;
public:
ModuleSaMode(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSamode(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSaMode()
class ModuleSanick : public Module
{
- CommandSanick* mycommand;
+ CommandSanick cmd;
public:
ModuleSanick(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSanick(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSanick()
class ModuleSapart : public Module
{
- CommandSapart* mycommand;
+ CommandSapart cmd;
public:
ModuleSapart(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSapart(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSapart()
class ModuleSaquit : public Module
{
- CommandSaquit* mycommand;
+ CommandSaquit cmd;
public:
ModuleSaquit(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSaquit(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSaquit()
class ModuleSASL : public Module
{
- CommandAuthenticate* sasl;
+ CommandAuthenticate sasl;
public:
ModuleSASL(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), sasl(Me, this)
{
Implementation eventlist[] = { I_OnEvent, I_OnUserRegister, I_OnPostConnect, I_OnUserDisconnect, I_OnCleanup };
ServerInstance->Modules->Attach(eventlist, this, 5);
- sasl = new CommandAuthenticate(ServerInstance, this);
- ServerInstance->AddCommand(sasl);
+ ServerInstance->AddCommand(&sasl);
if (!ServerInstance->Modules->Find("m_services_account.so") || !ServerInstance->Modules->Find("m_cap.so"))
ServerInstance->Logs->Log("m_sasl", DEFAULT, "WARNING: m_services_account.so and m_cap.so are not loaded! m_sasl.so will NOT function correctly until these two modules are loaded!");
class ModuleSATopic : public Module
{
- CommandSATopic* mycommand;
+ CommandSATopic cmd;
public:
ModuleSATopic(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
- mycommand = new CommandSATopic(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSATopic()
class ModuleServicesAccount : public Module
{
- AChannel_R* m1;
- AChannel_M* m2;
- AUser_R* m3;
- Channel_r *m4;
- User_r *m5;
+ AChannel_R m1;
+ AChannel_M m2;
+ AUser_R m3;
+ Channel_r m4;
+ User_r m5;
public:
- ModuleServicesAccount(InspIRCd* Me) : Module(Me)
+ ModuleServicesAccount(InspIRCd* Me) : Module(Me),
+ m1(Me), m2(Me), m3(Me), m4(Me), m5(Me)
{
- m1 = new AChannel_R(ServerInstance);
- m2 = new AChannel_M(ServerInstance);
- m3 = new AUser_R(ServerInstance);
- m4 = new Channel_r(ServerInstance);
- m5 = new User_r(ServerInstance);
- if (!ServerInstance->Modes->AddMode(m1) || !ServerInstance->Modes->AddMode(m2) || !ServerInstance->Modes->AddMode(m3) || !ServerInstance->Modes->AddMode(m4) || !ServerInstance->Modes->AddMode(m5))
+ if (!ServerInstance->Modes->AddMode(&m1) || !ServerInstance->Modes->AddMode(&m2) ||
+ !ServerInstance->Modes->AddMode(&m3) || !ServerInstance->Modes->AddMode(&m4) ||
+ !ServerInstance->Modes->AddMode(&m5))
throw ModuleException("Some other module has claimed our modes!");
Implementation eventlist[] = { I_OnWhois, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreJoin, I_OnCheckBan,
virtual ~ModuleServicesAccount()
{
- ServerInstance->Modes->DelMode(m1);
- ServerInstance->Modes->DelMode(m2);
- ServerInstance->Modes->DelMode(m3);
- ServerInstance->Modes->DelMode(m4);
- ServerInstance->Modes->DelMode(m5);
- delete m1;
- delete m2;
- delete m3;
- delete m4;
- delete m5;
+ ServerInstance->Modes->DelMode(&m1);
+ ServerInstance->Modes->DelMode(&m2);
+ ServerInstance->Modes->DelMode(&m3);
+ ServerInstance->Modes->DelMode(&m4);
+ ServerInstance->Modes->DelMode(&m5);
}
virtual Version GetVersion()
class ModuleServProtectMode : public Module
{
- ServProtectMode* bm;
+ ServProtectMode bm;
public:
ModuleServProtectMode(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), bm(Me)
{
-
- bm = new ServProtectMode(ServerInstance);
- if (!ServerInstance->Modes->AddMode(bm))
+ if (!ServerInstance->Modes->AddMode(&bm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhois, I_OnKill, I_OnWhoisLine, I_OnRawMode, I_OnUserPreKick };
ServerInstance->Modules->Attach(eventlist, this, 5);
virtual ~ModuleServProtectMode()
{
- ServerInstance->Modes->DelMode(bm);
- delete bm;
+ ServerInstance->Modes->DelMode(&bm);
}
virtual Version GetVersion()
class ModuleSetHost : public Module
{
- CommandSethost* mycommand;
+ CommandSethost cmd;
char hostmap[256];
public:
ModuleSetHost(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me, hostmap)
{
OnRehash(NULL);
- mycommand = new CommandSethost(ServerInstance, hostmap);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 1);
}
class ModuleSetIdent : public Module
{
- CommandSetident* mycommand;
+ CommandSetident cmd;
public:
- ModuleSetIdent(InspIRCd* Me) : Module(Me)
+ ModuleSetIdent(InspIRCd* Me) : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSetident(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSetIdent()
class ModuleSetIdle : public Module
{
- CommandSetidle* mycommand;
+ CommandSetidle cmd;
public:
ModuleSetIdle(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSetidle(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSetIdle()
class ModuleSetName : public Module
{
- CommandSetname* mycommand;
+ CommandSetname cmd;
public:
ModuleSetName(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSetname(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSetName()
class ModuleShun : public Module
{
- CommandShun* mycommand;
- ShunFactory *f;
+ CommandShun cmd;
+ ShunFactory f;
std::set<std::string> ShunEnabledCommands;
bool NotifyOfShun;
bool affectopers;
public:
- ModuleShun(InspIRCd* Me) : Module(Me)
+ ModuleShun(InspIRCd* Me) : Module(Me), cmd(Me), f(Me)
{
- f = new ShunFactory(ServerInstance);
- ServerInstance->XLines->RegisterFactory(f);
-
- mycommand = new CommandShun(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->XLines->RegisterFactory(&f);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnStats, I_OnPreCommand, I_OnUserConnect, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 4);
virtual ~ModuleShun()
{
ServerInstance->XLines->DelAll("SHUN");
- ServerInstance->XLines->UnregisterFactory(f);
+ ServerInstance->XLines->UnregisterFactory(&f);
}
virtual int OnStats(char symbol, User* user, string_list& out)
class ModuleSilence : public Module
{
- CommandSilence* cmdsilence;
- CommandSVSSilence *cmdsvssilence;
unsigned int maxsilence;
+ CommandSilence cmdsilence;
+ CommandSVSSilence cmdsvssilence;
public:
ModuleSilence(InspIRCd* Me)
- : Module(Me), maxsilence(32)
+ : Module(Me), maxsilence(32), cmdsilence(Me, maxsilence), cmdsvssilence(Me)
{
OnRehash(NULL);
- cmdsilence = new CommandSilence(ServerInstance,maxsilence);
- cmdsvssilence = new CommandSVSSilence(ServerInstance);
- ServerInstance->AddCommand(cmdsilence);
- ServerInstance->AddCommand(cmdsvssilence);
+ ServerInstance->AddCommand(&cmdsilence);
+ ServerInstance->AddCommand(&cmdsvssilence);
Implementation eventlist[] = { I_OnRehash, I_OnBuildExemptList, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage, I_OnUserPreInvite };
ServerInstance->Modules->Attach(eventlist, this, 7);
/* This will also free the listeners */
delete Utils;
+ delete command_rconnect;
+ delete command_rsquit;
+
ServerInstance->Timers->DelTimer(RefreshTimer);
ServerInstance->Modules->DoneWithInterface("BufferedSocketHook");
class ModuleSSLInfo : public Module
{
- CommandSSLInfo* newcommand;
+ CommandSSLInfo cmd;
public:
ModuleSSLInfo(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
- newcommand = new CommandSSLInfo(ServerInstance);
- ServerInstance->AddCommand(newcommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnSyncUserMetaData, I_OnDecodeMetaData, I_OnWhois, I_OnPreCommand };
ServerInstance->Modules->Attach(eventlist, this, 4);
class ModuleSSLModes : public Module
{
- SSLMode* sslm;
+ SSLMode sslm;
public:
ModuleSSLModes(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), sslm(Me)
{
-
-
- sslm = new SSLMode(ServerInstance);
- if (!ServerInstance->Modes->AddMode(sslm))
+ if (!ServerInstance->Modes->AddMode(&sslm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreJoin };
ServerInstance->Modules->Attach(eventlist, this, 1);
virtual ~ModuleSSLModes()
{
- ServerInstance->Modes->DelMode(sslm);
- delete sslm;
+ ServerInstance->Modes->DelMode(&sslm);
}
virtual Version GetVersion()
class ModuleStripColor : public Module
{
bool AllowChanOps;
- ChannelStripColor *csc;
- UserStripColor *usc;
+ ChannelStripColor csc;
+ UserStripColor usc;
public:
- ModuleStripColor(InspIRCd* Me) : Module(Me)
+ ModuleStripColor(InspIRCd* Me) : Module(Me), csc(Me), usc(Me)
{
- usc = new UserStripColor(ServerInstance);
- csc = new ChannelStripColor(ServerInstance);
-
- if (!ServerInstance->Modes->AddMode(usc) || !ServerInstance->Modes->AddMode(csc))
+ if (!ServerInstance->Modes->AddMode(&usc) || !ServerInstance->Modes->AddMode(&csc))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 3);
virtual ~ModuleStripColor()
{
- ServerInstance->Modes->DelMode(usc);
- ServerInstance->Modes->DelMode(csc);
- delete usc;
- delete csc;
+ ServerInstance->Modes->DelMode(&usc);
+ ServerInstance->Modes->DelMode(&csc);
}
virtual void On005Numeric(std::string &output)
class ModuleSVSHold : public Module
{
- CommandSvshold *mycommand;
- SVSHoldFactory *s;
+ CommandSvshold cmd;
+ SVSHoldFactory s;
public:
- ModuleSVSHold(InspIRCd* Me) : Module(Me)
+ ModuleSVSHold(InspIRCd* Me) : Module(Me), cmd(Me), s(Me)
{
- s = new SVSHoldFactory(ServerInstance);
- ServerInstance->XLines->RegisterFactory(s);
- mycommand = new CommandSvshold(Me);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->XLines->RegisterFactory(&s);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnUserPreNick, I_OnSyncOtherMetaData, I_OnDecodeMetaData, I_OnStats };
ServerInstance->Modules->Attach(eventlist, this, 4);
}
virtual ~ModuleSVSHold()
{
ServerInstance->XLines->DelAll("SVSHOLD");
- ServerInstance->XLines->UnregisterFactory(s);
+ ServerInstance->XLines->UnregisterFactory(&s);
}
virtual Version GetVersion()
class ModuleSWhois : public Module
{
- CommandSwhois* mycommand;
+ CommandSwhois cmd;
ConfigReader* Conf;
public:
- ModuleSWhois(InspIRCd* Me) : Module(Me)
+ ModuleSWhois(InspIRCd* Me) : Module(Me), cmd(Me)
{
Conf = new ConfigReader(ServerInstance);
- mycommand = new CommandSwhois(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnDecodeMetaData, I_OnWhoisLine, I_OnSyncUserMetaData, I_OnUserQuit, I_OnCleanup, I_OnRehash, I_OnPostCommand };
ServerInstance->Modules->Attach(eventlist, this, 7);
}
class ModuleTaxonomy : public Module
{
- CommandTaxonomy* newcommand;
+ CommandTaxonomy cmd;
bool claimed;
public:
ModuleTaxonomy(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me, this, claimed)
{
-
- // Create a new command
- newcommand = new CommandTaxonomy(ServerInstance, this, claimed);
- ServerInstance->AddCommand(newcommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_ProtoSendMetaData };
ServerInstance->Modules->Attach(eventlist, this, 1);
}
class ModuleTimedBans : public Module
{
- CommandTban* mycommand;
+ CommandTban cmd;
public:
ModuleTimedBans(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandTban(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
TimedBanList.clear();
Implementation eventlist[] = { I_OnDelBan, I_OnBackgroundTimer };
ServerInstance->Modules->Attach(eventlist, this, 2);
class ModuleTLine : public Module
{
- CommandTline* newcommand;
+ CommandTline cmd;
public:
ModuleTLine(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- newcommand = new CommandTline(ServerInstance);
- ServerInstance->AddCommand(newcommand);
-
+ ServerInstance->AddCommand(&cmd);
}
class ModuleUninvite : public Module
{
- CommandUninvite *mycommand;
+ CommandUninvite cmd;
public:
- ModuleUninvite(InspIRCd* Me) : Module(Me)
+ ModuleUninvite(InspIRCd* Me) : Module(Me), cmd(Me)
{
-
- mycommand = new CommandUninvite(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleUninvite()
class ModuleUserIP : public Module
{
- CommandUserip* mycommand;
+ CommandUserip cmd;
public:
ModuleUserIP(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandUserip(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 1);
}
class ModuleVHost : public Module
{
private:
-
- CommandVhost* mycommand;
+ CommandVhost cmd;
public:
- ModuleVHost(InspIRCd* Me) : Module(Me)
+ ModuleVHost(InspIRCd* Me) : Module(Me), cmd(Me)
{
- mycommand = new CommandVhost(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleVHost()
class Modulewatch : public Module
{
- CommandWatch* mycommand;
- CommandSVSWatch *sw;
unsigned int maxwatch;
+ CommandWatch cmdw;
+ CommandSVSWatch sw;
public:
Modulewatch(InspIRCd* Me)
- : Module(Me), maxwatch(32)
+ : Module(Me), maxwatch(32), cmdw(Me, maxwatch), sw(Me)
{
OnRehash(NULL);
whos_watching_me = new watchentries();
- mycommand = new CommandWatch(ServerInstance, maxwatch);
- ServerInstance->AddCommand(mycommand);
- sw = new CommandSVSWatch(ServerInstance);
- ServerInstance->AddCommand(sw);
+ ServerInstance->AddCommand(&cmdw);
+ ServerInstance->AddCommand(&sw);
Implementation eventlist[] = { I_OnRehash, I_OnGarbageCollect, I_OnCleanup, I_OnUserQuit, I_OnPostConnect, I_OnUserPostNick, I_On005Numeric, I_OnSetAway };
ServerInstance->Modules->Attach(eventlist, this, 8);
}