From 069a2ef21425007d092342c8c11ec28da2f410d7 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 13 Sep 2009 20:32:27 +0000 Subject: Clean up Command constructor git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11707 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_alltime.cpp | 6 +++--- src/modules/m_callerid.cpp | 4 ++-- src/modules/m_cap.cpp | 11 ++++++----- src/modules/m_cban.cpp | 6 +++--- src/modules/m_cgiirc.cpp | 7 ++++--- src/modules/m_check.cpp | 6 +++--- src/modules/m_chghost.cpp | 7 +++---- src/modules/m_chgident.cpp | 6 +++--- src/modules/m_chgname.cpp | 6 +++--- src/modules/m_clones.cpp | 6 +++--- src/modules/m_close.cpp | 6 +++--- src/modules/m_customtitle.cpp | 4 ++-- src/modules/m_cycle.cpp | 6 +++--- src/modules/m_dccallow.cpp | 4 ++-- src/modules/m_devoice.cpp | 4 ++-- src/modules/m_filter.cpp | 7 ++++--- src/modules/m_globalload.cpp | 14 +++++++------- src/modules/m_globops.cpp | 6 +++--- src/modules/m_helpop.cpp | 4 ++-- src/modules/m_jumpserver.cpp | 7 +++---- src/modules/m_knock.cpp | 4 ++-- src/modules/m_lockserv.cpp | 12 +++++------- src/modules/m_nicklock.cpp | 6 ++++-- src/modules/m_ojoin.cpp | 6 +++--- src/modules/m_opermotd.cpp | 6 +++--- src/modules/m_password_hash.cpp | 5 ++--- src/modules/m_randquote.cpp | 4 ++-- src/modules/m_remove.cpp | 15 +++++++-------- src/modules/m_rline.cpp | 6 +++--- src/modules/m_sajoin.cpp | 6 +++--- src/modules/m_sakick.cpp | 6 +++--- src/modules/m_samode.cpp | 6 +++--- src/modules/m_sanick.cpp | 6 +++--- src/modules/m_sapart.cpp | 6 +++--- src/modules/m_saquit.cpp | 6 +++--- src/modules/m_sasl.cpp | 10 +++++----- src/modules/m_satopic.cpp | 7 +++---- src/modules/m_sethost.cpp | 6 +++--- src/modules/m_setident.cpp | 6 +++--- src/modules/m_setidle.cpp | 6 +++--- src/modules/m_setname.cpp | 4 ++-- src/modules/m_showwhois.cpp | 8 ++++---- src/modules/m_shun.cpp | 6 +++--- src/modules/m_silence.cpp | 6 +++--- src/modules/m_spanningtree/main.cpp | 4 ++-- src/modules/m_spanningtree/rconnect.cpp | 5 +++-- src/modules/m_spanningtree/rconnect.h | 2 +- src/modules/m_spanningtree/rsquit.cpp | 5 +++-- src/modules/m_spanningtree/rsquit.h | 2 +- src/modules/m_sslinfo.cpp | 4 ++-- src/modules/m_svshold.cpp | 6 +++--- src/modules/m_swhois.cpp | 6 +++--- src/modules/m_timedbans.cpp | 4 ++-- src/modules/m_tline.cpp | 6 +++--- src/modules/m_uninvite.cpp | 4 ++-- src/modules/m_userip.cpp | 6 +++--- src/modules/m_vhost.cpp | 4 ++-- src/modules/m_watch.cpp | 7 +++---- 58 files changed, 175 insertions(+), 176 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp index 063e18798..abf3c0b1b 100644 --- a/src/modules/m_alltime.cpp +++ b/src/modules/m_alltime.cpp @@ -18,9 +18,9 @@ class CommandAlltime : public Command { public: - CommandAlltime(InspIRCd *Instance, Module* Creator) : Command(Instance, Creator, "ALLTIME", "o", 0) + CommandAlltime(Module* Creator) : Command(Creator, "ALLTIME", 0) { - syntax.clear(); + flags_needed = 'o'; syntax.clear(); translation.push_back(TR_END); } @@ -50,7 +50,7 @@ class Modulealltime : public Module CommandAlltime mycommand; public: Modulealltime(InspIRCd *Me) - : Module(Me), mycommand(Me, this) + : Module(Me), mycommand(this) { ServerInstance->AddCommand(&mycommand); } diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index dab0d3d43..9248a5a31 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -136,7 +136,7 @@ class CommandAccept : public Command public: CallerIDExtInfo extInfo; unsigned int maxaccepts; - CommandAccept(InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "ACCEPT", 0, 1), + CommandAccept(Module* Creator) : Command(Creator, "ACCEPT", 1), extInfo(Creator) { syntax = "{[+|-]}|*}"; @@ -342,7 +342,7 @@ private: } public: - ModuleCallerID(InspIRCd* Me) : Module(Me), cmd(Me, this), myumode(Me, this) + ModuleCallerID(InspIRCd* Me) : Module(Me), cmd(this), myumode(Me, this) { OnRehash(NULL); diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 160c7a9c9..355c6d0fb 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -36,9 +36,10 @@ class CommandCAP : public Command { public: LocalIntExt reghold; - CommandCAP (InspIRCd* Instance, Module* mod) : Command(Instance, mod, "CAP", 0, 1, true), + CommandCAP (Module* mod) : Command(mod, "CAP", 1), reghold("CAP_REGHOLD", mod) { + works_before_reg = true; } CmdResult Handle (const std::vector ¶meters, User *user) @@ -68,7 +69,7 @@ class CommandCAP : public Command reghold.set(user, 1); Event event((char*) &Data, this->creator, "cap_req"); - event.Send(this->ServerInstance); + event.Send(ServerInstance); if (Data.ack.size() > 0) { @@ -96,7 +97,7 @@ class CommandCAP : public Command reghold.set(user, 1); Event event((char*) &Data, this->creator, subcommand == "LS" ? "cap_ls" : "cap_list"); - event.Send(this->ServerInstance); + event.Send(ServerInstance); std::string Result; if (Data.wanted.size() > 0) @@ -116,7 +117,7 @@ class CommandCAP : public Command reghold.set(user, 1); Event event((char*) &Data, this->creator, "cap_clear"); - event.Send(this->ServerInstance); + event.Send(ServerInstance); std::string Result = irc::stringjoiner(" ", Data.ack, 0, Data.ack.size() - 1).GetJoined(); user->WriteServ("CAP * ACK :%s", Result.c_str()); @@ -135,7 +136,7 @@ class ModuleCAP : public Module CommandCAP cmd; public: ModuleCAP(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); Extensible::Register(&cmd.reghold); diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 025540d9f..d5e62c98b 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -84,9 +84,9 @@ class CBanFactory : public XLineFactory class CommandCBan : public Command { public: - CommandCBan(InspIRCd* Me, Module* Creator) : Command(Me, Creator, "CBAN", "o", 1, 3) + CommandCBan(Module* Creator) : Command(Creator, "CBAN", 1, 3) { - this->syntax = " [ :]"; + flags_needed = 'o'; this->syntax = " [ :]"; TRANSLATE4(TR_TEXT,TR_TEXT,TR_TEXT,TR_END); } @@ -166,7 +166,7 @@ class ModuleCBan : public Module CBanFactory f; public: - ModuleCBan(InspIRCd* Me) : Module(Me), mycommand(Me, this), f(Me) + ModuleCBan(InspIRCd* Me) : Module(Me), mycommand(this), f(Me) { ServerInstance->XLines->RegisterFactory(&f); diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index c72e18390..3dc7c627d 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -61,11 +61,12 @@ class CommandWebirc : public Command LocalStringExt webirc_ip; CGIHostlist Hosts; - CommandWebirc(InspIRCd* Instance, Module* Creator, bool bnotify) - : Command(Instance, Creator, "WEBIRC", 0, 4, true), notify(bnotify), + CommandWebirc(Module* Creator, bool bnotify) + : Command(Creator, "WEBIRC", 4), notify(bnotify), realhost("cgiirc_realhost", Creator), realip("cgiirc_realip", Creator), webirc_hostname("cgiirc_webirc_hostname", Creator), webirc_ip("cgiirc_webirc_ip", Creator) { + works_before_reg = true; this->syntax = "password client hostname ip"; } CmdResult Handle(const std::vector ¶meters, User *user) @@ -145,7 +146,7 @@ class ModuleCgiIRC : public Module CommandWebirc cmd; bool NotifyOpers; public: - ModuleCgiIRC(InspIRCd* Me) : Module(Me), cmd(Me, this, NotifyOpers) + ModuleCgiIRC(InspIRCd* Me) : Module(Me), cmd(this, NotifyOpers) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 847e9d5c9..a84bd4dc6 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -20,9 +20,9 @@ class CommandCheck : public Command { public: - CommandCheck (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"CHECK", "o", 1) + CommandCheck(Module* parent) : Command(parent,"CHECK", 1) { - syntax = "||| "; + flags_needed = 'o'; syntax = "||| "; } std::string timestring(time_t time) @@ -198,7 +198,7 @@ class ModuleCheck : public Module private: CommandCheck mycommand; public: - ModuleCheck(InspIRCd* Me) : Module(Me), mycommand(Me, this) + ModuleCheck(InspIRCd* Me) : Module(Me), mycommand(this) { ServerInstance->AddCommand(&mycommand); } diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 0d509b7d9..ef3155cb6 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -22,9 +22,9 @@ class CommandChghost : public Command private: char* hostmap; public: - CommandChghost (InspIRCd* Instance, Module* Creator, char* hmap) : Command(Instance,Creator,"CHGHOST","o",2), hostmap(hmap) + CommandChghost(Module* Creator, char* hmap) : Command(Creator,"CHGHOST", 2), hostmap(hmap) { - syntax = " "; + flags_needed = 'o'; syntax = " "; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -86,8 +86,7 @@ class ModuleChgHost : public Module CommandChghost cmd; char hostmap[256]; public: - ModuleChgHost(InspIRCd* Me) - : Module(Me), cmd(Me, this, hostmap) + ModuleChgHost(InspIRCd* Me) : cmd(this, hostmap) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index d52691054..b570feb46 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -20,9 +20,9 @@ class CommandChgident : public Command { public: - CommandChgident (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CHGIDENT", "o", 2) + CommandChgident(Module* Creator) : Command(Creator,"CHGIDENT", 2) { - syntax = " "; + flags_needed = 'o'; syntax = " "; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -80,7 +80,7 @@ class ModuleChgIdent : public Module CommandChgident cmd; public: - ModuleChgIdent(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleChgIdent(InspIRCd* Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index 0f9302a76..11e7f4c9c 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -20,9 +20,9 @@ class CommandChgname : public Command { public: - CommandChgname (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CHGNAME", "o", 2, 2) + CommandChgname(Module* Creator) : Command(Creator,"CHGNAME", 2, 2) { - syntax = " "; + flags_needed = 'o'; syntax = " "; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -72,7 +72,7 @@ class ModuleChgName : public Module CommandChgname cmd; public: - ModuleChgName(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleChgName(InspIRCd* Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_clones.cpp b/src/modules/m_clones.cpp index 407ef7ef3..5a96a08a7 100644 --- a/src/modules/m_clones.cpp +++ b/src/modules/m_clones.cpp @@ -20,9 +20,9 @@ class CommandClones : public Command { public: - CommandClones (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CLONES", "o", 1) + CommandClones(Module* Creator) : Command(Creator,"CLONES", 1) { - syntax = ""; + flags_needed = 'o'; syntax = ""; } CmdResult Handle (const std::vector ¶meters, User *user) @@ -61,7 +61,7 @@ class ModuleClones : public Module private: CommandClones cmd; public: - ModuleClones(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleClones(InspIRCd* Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp index 1da88c3d5..e81c29d20 100644 --- a/src/modules/m_close.cpp +++ b/src/modules/m_close.cpp @@ -29,9 +29,9 @@ class CommandClose : public Command { public: /* Command 'close', needs operator */ - CommandClose (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CLOSE", "o", 0) + CommandClose(Module* Creator) : Command(Creator,"CLOSE", 0) { - } + flags_needed = 'o'; } CmdResult Handle (const std::vector ¶meters, User *user) { @@ -67,7 +67,7 @@ class ModuleClose : public Module CommandClose cmd; public: ModuleClose(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index fc99cd29f..aa5749a04 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -21,7 +21,7 @@ class CommandTitle : public Command { public: StringExtItem ctitle; - CommandTitle (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"TITLE",0,2), + CommandTitle(Module* Creator) : Command(Creator,"TITLE", 2), ctitle("ctitle", Creator) { syntax = " "; @@ -86,7 +86,7 @@ class ModuleCustomTitle : public Module CommandTitle cmd; public: - ModuleCustomTitle(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleCustomTitle(InspIRCd* Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); Extensible::Register(&cmd.ctitle); diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp index 8caa07b62..55548be95 100644 --- a/src/modules/m_cycle.cpp +++ b/src/modules/m_cycle.cpp @@ -20,9 +20,9 @@ class CommandCycle : public Command { public: - CommandCycle (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CYCLE", 0, 1, false, 3) + CommandCycle(Module* Creator) : Command(Creator,"CYCLE", 1) { - syntax = " :[reason]"; + Penalty = 3; syntax = " :[reason]"; TRANSLATE3(TR_TEXT, TR_TEXT, TR_END); } @@ -81,7 +81,7 @@ class ModuleCycle : public Module CommandCycle cmd; public: ModuleCycle(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index a61582629..fb6847872 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -48,7 +48,7 @@ SimpleExtItem* ext; class CommandDccallow : public Command { public: - CommandDccallow(InspIRCd* Me, Module* parent) : Command(Me, parent, "DCCALLOW", 0, 0) + CommandDccallow(Module* parent) : Command(parent, "DCCALLOW", 0) { syntax = "{[+|-]