From 24731c63b6320be22f7b3220236271fa7476b975 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 2 Sep 2009 00:48:48 +0000 Subject: Add Module* creator to Command and ModeHandler git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11631 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/command_parse.h | 8 ++++---- include/commands/cmd_admin.h | 2 +- include/commands/cmd_away.h | 2 +- include/commands/cmd_clearcache.h | 2 +- include/commands/cmd_commands.h | 2 +- include/commands/cmd_connect.h | 2 +- include/commands/cmd_die.h | 2 +- include/commands/cmd_eline.h | 2 +- include/commands/cmd_gline.h | 2 +- include/commands/cmd_info.h | 2 +- include/commands/cmd_invite.h | 2 +- include/commands/cmd_ison.h | 2 +- include/commands/cmd_join.h | 2 +- include/commands/cmd_kick.h | 2 +- include/commands/cmd_kill.h | 2 +- include/commands/cmd_kline.h | 2 +- include/commands/cmd_links.h | 2 +- include/commands/cmd_list.h | 2 +- include/commands/cmd_loadmodule.h | 2 +- include/commands/cmd_lusers.h | 2 +- include/commands/cmd_map.h | 2 +- include/commands/cmd_mode.h | 2 +- include/commands/cmd_modules.h | 2 +- include/commands/cmd_motd.h | 2 +- include/commands/cmd_names.h | 2 +- include/commands/cmd_nick.h | 2 +- include/commands/cmd_notice.h | 2 +- include/commands/cmd_oper.h | 2 +- include/commands/cmd_part.h | 2 +- include/commands/cmd_pass.h | 2 +- include/commands/cmd_ping.h | 2 +- include/commands/cmd_pong.h | 2 +- include/commands/cmd_privmsg.h | 2 +- include/commands/cmd_qline.h | 2 +- include/commands/cmd_quit.h | 2 +- include/commands/cmd_rehash.h | 2 +- include/commands/cmd_reloadmodule.h | 2 +- include/commands/cmd_restart.h | 2 +- include/commands/cmd_rules.h | 2 +- include/commands/cmd_server.h | 2 +- include/commands/cmd_squit.h | 2 +- include/commands/cmd_stats.h | 2 +- include/commands/cmd_time.h | 2 +- include/commands/cmd_topic.h | 2 +- include/commands/cmd_trace.h | 2 +- include/commands/cmd_unloadmodule.h | 2 +- include/commands/cmd_user.h | 2 +- include/commands/cmd_userhost.h | 2 +- include/commands/cmd_version.h | 2 +- include/commands/cmd_wallops.h | 2 +- include/commands/cmd_who.h | 2 +- include/commands/cmd_whois.h | 2 +- include/commands/cmd_zline.h | 2 +- include/ctables.h | 25 +++++++++++-------------- include/mode.h | 20 ++++++++++++++------ include/u_listmode.h | 6 +++--- 56 files changed, 84 insertions(+), 79 deletions(-) (limited to 'include') diff --git a/include/command_parse.h b/include/command_parse.h index 2cf403de1..f176394a7 100644 --- a/include/command_parse.h +++ b/include/command_parse.h @@ -68,7 +68,7 @@ class CoreExport CommandParser : public classbase /** Removes a command if the sources match. Used as a helper for * safe hash_map delete while iter in RemoveCommands(const char* source). */ - void RemoveCommand(nspace::hash_map::iterator safei, const char* source); + void RemoveCommand(nspace::hash_map::iterator safei, Module* source); public: @@ -178,9 +178,9 @@ class CoreExport CommandParser : public classbase void DoLines(User* current, bool one_only = false); /** Remove all commands relating to module 'source'. - * @param source A module name which has introduced new commands + * @param source A module which has introduced new commands */ - void RemoveCommands(const char* source); + void RemoveCommands(Module* source); /** Remove all core commands and unload their shared objects */ @@ -226,7 +226,7 @@ class CommandReload : public Command public: /** Standard constructor */ - CommandReload (InspIRCd* Instance) : Command(Instance,"RELOAD","o",1) { syntax = ""; } + CommandReload (InspIRCd* Instance) : Command(Instance,NULL,"RELOAD","o",1) { syntax = ""; } /** Handle RELOAD */ CmdResult Handle(const std::vector& parameters, User *user); diff --git a/include/commands/cmd_admin.h b/include/commands/cmd_admin.h index 25a77e845..b82331c39 100644 --- a/include/commands/cmd_admin.h +++ b/include/commands/cmd_admin.h @@ -27,7 +27,7 @@ class CommandAdmin : public Command public: /** Constructor for admin. */ - CommandAdmin (InspIRCd* Instance) : Command(Instance,"ADMIN",0,0) { syntax = "[]"; } + CommandAdmin (InspIRCd* Instance) : Command(Instance,NULL,"ADMIN",0,0) { syntax = "[]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_away.h b/include/commands/cmd_away.h index f6d1bc783..9cde32f57 100644 --- a/include/commands/cmd_away.h +++ b/include/commands/cmd_away.h @@ -29,7 +29,7 @@ class CommandAway : public Command public: /** Constructor for away. */ - CommandAway (InspIRCd* Instance) : Command(Instance,"AWAY",0,0) { syntax = "[]"; } + CommandAway (InspIRCd* Instance) : Command(Instance,NULL,"AWAY",0,0) { syntax = "[]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_clearcache.h b/include/commands/cmd_clearcache.h index 559c8cd45..00e41fce9 100644 --- a/include/commands/cmd_clearcache.h +++ b/include/commands/cmd_clearcache.h @@ -28,7 +28,7 @@ class CommandClearcache : public Command public: /** Constructor for clearcache. */ - CommandClearcache (InspIRCd* Instance) : Command(Instance,"CLEARCACHE","o",0) { } + CommandClearcache (InspIRCd* Instance) : Command(Instance,NULL,"CLEARCACHE","o",0) { } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_commands.h b/include/commands/cmd_commands.h index dbc7a162c..13c5ee075 100644 --- a/include/commands/cmd_commands.h +++ b/include/commands/cmd_commands.h @@ -29,7 +29,7 @@ class CommandCommands : public Command public: /** Constructor for commands. */ - CommandCommands (InspIRCd* Instance) : Command(Instance,"COMMANDS",0,0) { } + CommandCommands (InspIRCd* Instance) : Command(Instance,NULL,"COMMANDS",0,0) { } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_connect.h b/include/commands/cmd_connect.h index d7543a215..208844661 100644 --- a/include/commands/cmd_connect.h +++ b/include/commands/cmd_connect.h @@ -29,7 +29,7 @@ class CommandConnect : public Command public: /** Constructor for connect. */ - CommandConnect (InspIRCd* Instance) : Command(Instance,"CONNECT","o",1,false,0) { syntax = " []"; } + CommandConnect (InspIRCd* Instance) : Command(Instance,NULL,"CONNECT","o",1,false,0) { syntax = " []"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_die.h b/include/commands/cmd_die.h index 42cb1860d..156a1508e 100644 --- a/include/commands/cmd_die.h +++ b/include/commands/cmd_die.h @@ -29,7 +29,7 @@ class CommandDie : public Command public: /** Constructor for die. */ - CommandDie (InspIRCd* Instance) : Command(Instance,"DIE","o",1,false,0) { syntax = ""; } + CommandDie (InspIRCd* Instance) : Command(Instance,NULL,"DIE","o",1,false,0) { syntax = ""; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_eline.h b/include/commands/cmd_eline.h index 7af325515..2ac9adeab 100644 --- a/include/commands/cmd_eline.h +++ b/include/commands/cmd_eline.h @@ -29,7 +29,7 @@ class CommandEline : public Command public: /** Constructor for eline. */ - CommandEline (InspIRCd* Instance) : Command(Instance,"ELINE","o",1,3,false,0) { syntax = " [ :]"; } + CommandEline (InspIRCd* Instance) : Command(Instance,NULL,"ELINE","o",1,3,false,0) { syntax = " [ :]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_gline.h b/include/commands/cmd_gline.h index 2a41d0f73..9548279d4 100644 --- a/include/commands/cmd_gline.h +++ b/include/commands/cmd_gline.h @@ -29,7 +29,7 @@ class CommandGline : public Command public: /** Constructor for gline. */ - CommandGline (InspIRCd* Instance) : Command(Instance,"GLINE","o",1,3,false,0) { syntax = " [ :]"; } + CommandGline (InspIRCd* Instance) : Command(Instance,NULL,"GLINE","o",1,3,false,0) { syntax = " [ :]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_info.h b/include/commands/cmd_info.h index 4c2cd1b50..85d7d4c84 100644 --- a/include/commands/cmd_info.h +++ b/include/commands/cmd_info.h @@ -29,7 +29,7 @@ class CommandInfo : public Command public: /** Constructor for info. */ - CommandInfo (InspIRCd* Instance) : Command(Instance,"INFO",0,0) { syntax = "[]"; } + CommandInfo (InspIRCd* Instance) : Command(Instance,NULL,"INFO",0,0) { syntax = "[]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_invite.h b/include/commands/cmd_invite.h index 4f36e1a57..ce048e712 100644 --- a/include/commands/cmd_invite.h +++ b/include/commands/cmd_invite.h @@ -29,7 +29,7 @@ class CommandInvite : public Command public: /** Constructor for invite. */ - CommandInvite (InspIRCd* Instance) : Command(Instance,"INVITE", 0, 0, false, 4) { syntax = "[ ]"; } + CommandInvite (InspIRCd* Instance) : Command(Instance,NULL,"INVITE", 0, 0, false, 4) { syntax = "[ ]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_ison.h b/include/commands/cmd_ison.h index 46810665e..93f3356d8 100644 --- a/include/commands/cmd_ison.h +++ b/include/commands/cmd_ison.h @@ -29,7 +29,7 @@ class CommandIson : public Command public: /** Constructor for ison. */ - CommandIson (InspIRCd* Instance) : Command(Instance,"ISON",0,0) { syntax = " {nick}"; } + CommandIson (InspIRCd* Instance) : Command(Instance,NULL,"ISON",0,0) { syntax = " {nick}"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_join.h b/include/commands/cmd_join.h index 21caa04c1..2ea32de1a 100644 --- a/include/commands/cmd_join.h +++ b/include/commands/cmd_join.h @@ -29,7 +29,7 @@ class CommandJoin : public Command public: /** Constructor for join. */ - CommandJoin (InspIRCd* Instance) : Command(Instance,"JOIN", 0, 1, false, 2) { syntax = "{,} {{,}}"; } + CommandJoin (InspIRCd* Instance) : Command(Instance,NULL,"JOIN", 0, 1, false, 2) { syntax = "{,} {{,}}"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_kick.h b/include/commands/cmd_kick.h index 716f1e221..be6a40b06 100644 --- a/include/commands/cmd_kick.h +++ b/include/commands/cmd_kick.h @@ -29,7 +29,7 @@ class CommandKick : public Command public: /** Constructor for kick. */ - CommandKick (InspIRCd* Instance) : Command(Instance,"KICK",0,2) { syntax = " {,} []"; } + CommandKick (InspIRCd* Instance) : Command(Instance,NULL,"KICK",0,2) { syntax = " {,} []"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_kill.h b/include/commands/cmd_kill.h index ab677fc8e..392975fab 100644 --- a/include/commands/cmd_kill.h +++ b/include/commands/cmd_kill.h @@ -29,7 +29,7 @@ class CommandKill : public Command public: /** Constructor for kill. */ - CommandKill (InspIRCd* Instance) : Command(Instance,"KILL","o",2,false,0) { syntax = " "; } + CommandKill (InspIRCd* Instance) : Command(Instance,NULL,"KILL","o",2,false,0) { syntax = " "; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_kline.h b/include/commands/cmd_kline.h index fca83aa46..5744de506 100644 --- a/include/commands/cmd_kline.h +++ b/include/commands/cmd_kline.h @@ -29,7 +29,7 @@ class CommandKline : public Command public: /** Constructor for kline. */ - CommandKline (InspIRCd* Instance) : Command(Instance,"KLINE","o",1,3,false,0) { syntax = " [ :]"; } + CommandKline (InspIRCd* Instance) : Command(Instance,NULL,"KLINE","o",1,3,false,0) { syntax = " [ :]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_links.h b/include/commands/cmd_links.h index e71d17834..fbfdb6201 100644 --- a/include/commands/cmd_links.h +++ b/include/commands/cmd_links.h @@ -29,7 +29,7 @@ class CommandLinks : public Command public: /** Constructor for links. */ - CommandLinks (InspIRCd* Instance) : Command(Instance,"LINKS",0,0) { } + CommandLinks (InspIRCd* Instance) : Command(Instance,NULL,"LINKS",0,0) { } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_list.h b/include/commands/cmd_list.h index 18cc6d299..8801b8c39 100644 --- a/include/commands/cmd_list.h +++ b/include/commands/cmd_list.h @@ -29,7 +29,7 @@ class CommandList : public Command public: /** Constructor for list. */ - CommandList (InspIRCd* Instance) : Command(Instance,"LIST", 0, 0, false, 5) { } + CommandList (InspIRCd* Instance) : Command(Instance,NULL,"LIST", 0, 0, false, 5) { } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_loadmodule.h b/include/commands/cmd_loadmodule.h index b48c11dfb..9d31f072b 100644 --- a/include/commands/cmd_loadmodule.h +++ b/include/commands/cmd_loadmodule.h @@ -29,7 +29,7 @@ class CommandLoadmodule : public Command public: /** Constructor for loadmodule. */ - CommandLoadmodule (InspIRCd* Instance) : Command(Instance,"LOADMODULE","o",1) { syntax = ""; } + CommandLoadmodule (InspIRCd* Instance) : Command(Instance,NULL,"LOADMODULE","o",1) { syntax = ""; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_lusers.h b/include/commands/cmd_lusers.h index eab09b1a5..2c5d3d454 100644 --- a/include/commands/cmd_lusers.h +++ b/include/commands/cmd_lusers.h @@ -29,7 +29,7 @@ class CommandLusers : public Command public: /** Constructor for lusers. */ - CommandLusers (InspIRCd* Instance) : Command(Instance,"LUSERS",0,0) { } + CommandLusers (InspIRCd* Instance) : Command(Instance,NULL,"LUSERS",0,0) { } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_map.h b/include/commands/cmd_map.h index b825bf18a..183d59751 100644 --- a/include/commands/cmd_map.h +++ b/include/commands/cmd_map.h @@ -29,7 +29,7 @@ class CommandMap : public Command public: /** Constructor for map. */ - CommandMap (InspIRCd* Instance) : Command(Instance,"MAP",0,0,false,2) { } + CommandMap (InspIRCd* Instance) : Command(Instance,NULL,"MAP",0,0,false,2) { } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_mode.h b/include/commands/cmd_mode.h index 3c6eda5f5..83ab00bba 100644 --- a/include/commands/cmd_mode.h +++ b/include/commands/cmd_mode.h @@ -28,7 +28,7 @@ class CommandMode : public Command public: /** Constructor for mode. */ - CommandMode (InspIRCd* Instance) : Command(Instance,"MODE",0,1) { syntax = " {}"; } + CommandMode (InspIRCd* Instance) : Command(Instance,NULL,"MODE",0,1) { syntax = " {}"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_modules.h b/include/commands/cmd_modules.h index eb79f705f..18dc76cac 100644 --- a/include/commands/cmd_modules.h +++ b/include/commands/cmd_modules.h @@ -29,7 +29,7 @@ class CommandModules : public Command public: /** Constructor for modules. */ - CommandModules (InspIRCd* Instance) : Command(Instance,"MODULES",0,0) { syntax = "[debug]"; } + CommandModules (InspIRCd* Instance) : Command(Instance,NULL,"MODULES",0,0) { syntax = "[debug]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_motd.h b/include/commands/cmd_motd.h index 4ecebc12f..b57d851d9 100644 --- a/include/commands/cmd_motd.h +++ b/include/commands/cmd_motd.h @@ -32,7 +32,7 @@ class CommandMotd : public Command public: /** Constructor for motd. */ - CommandMotd (InspIRCd* Instance) : Command(Instance,"MOTD",0,0) { syntax = "[]"; } + CommandMotd (InspIRCd* Instance) : Command(Instance,NULL,"MOTD",0,0) { syntax = "[]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_names.h b/include/commands/cmd_names.h index bf31dd5bb..174b6aa20 100644 --- a/include/commands/cmd_names.h +++ b/include/commands/cmd_names.h @@ -29,7 +29,7 @@ class CommandNames : public Command public: /** Constructor for names. */ - CommandNames (InspIRCd* Instance) : Command(Instance,"NAMES",0,0) { syntax = "{{,}}"; } + CommandNames (InspIRCd* Instance) : Command(Instance,NULL,"NAMES",0,0) { syntax = "{{,}}"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_nick.h b/include/commands/cmd_nick.h index 566e94754..b3a8e12a8 100644 --- a/include/commands/cmd_nick.h +++ b/include/commands/cmd_nick.h @@ -30,7 +30,7 @@ class CommandNick : public Command public: /** Constructor for nick. */ - CommandNick (InspIRCd* Instance) : Command(Instance,"NICK", 0, 1, true, 3), allowinvalid(false) { syntax = ""; } + CommandNick (InspIRCd* Instance) : Command(Instance,NULL,"NICK", 0, 1, true, 3), allowinvalid(false) { syntax = ""; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_notice.h b/include/commands/cmd_notice.h index d83ca2121..580376f08 100644 --- a/include/commands/cmd_notice.h +++ b/include/commands/cmd_notice.h @@ -29,7 +29,7 @@ class CommandNotice : public Command public: /** Constructor for notice. */ - CommandNotice (InspIRCd* Instance) : Command(Instance,"NOTICE",0,2) { syntax = "{,} "; } + CommandNotice (InspIRCd* Instance) : Command(Instance,NULL,"NOTICE",0,2) { syntax = "{,} "; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_oper.h b/include/commands/cmd_oper.h index 90bfee162..dd0b6318d 100644 --- a/include/commands/cmd_oper.h +++ b/include/commands/cmd_oper.h @@ -31,7 +31,7 @@ class CommandOper : public Command public: /** Constructor for oper. */ - CommandOper (InspIRCd* Instance) : Command(Instance,"OPER",0,2,false,2) { syntax = " "; } + CommandOper (InspIRCd* Instance) : Command(Instance,NULL,"OPER",0,2,false,2) { syntax = " "; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_part.h b/include/commands/cmd_part.h index dfee41d9d..01284ccbd 100644 --- a/include/commands/cmd_part.h +++ b/include/commands/cmd_part.h @@ -29,7 +29,7 @@ class CommandPart : public Command public: /** Constructor for part. */ - CommandPart (InspIRCd* Instance) : Command(Instance,"PART", 0, 1, false, 5) { syntax = "{,} []"; } + CommandPart (InspIRCd* Instance) : Command(Instance,NULL,"PART", 0, 1, false, 5) { syntax = "{,} []"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_pass.h b/include/commands/cmd_pass.h index 0f24ff293..21eb378ab 100644 --- a/include/commands/cmd_pass.h +++ b/include/commands/cmd_pass.h @@ -32,7 +32,7 @@ class CommandPass : public Command public: /** Constructor for pass. */ - CommandPass (InspIRCd* Instance) : Command(Instance,"PASS",0,1,true,0) { syntax = ""; } + CommandPass (InspIRCd* Instance) : Command(Instance,NULL,"PASS",0,1,true,0) { syntax = ""; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_ping.h b/include/commands/cmd_ping.h index 5030aa775..56570d24e 100644 --- a/include/commands/cmd_ping.h +++ b/include/commands/cmd_ping.h @@ -29,7 +29,7 @@ class CommandPing : public Command public: /** Constructor for ping. */ - CommandPing (InspIRCd* Instance) : Command(Instance,"PING", 0, 1, false, 0) { syntax = " [:]"; } + CommandPing (InspIRCd* Instance) : Command(Instance,NULL,"PING", 0, 1, false, 0) { syntax = " [:]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_pong.h b/include/commands/cmd_pong.h index bcf4fe807..58d862a73 100644 --- a/include/commands/cmd_pong.h +++ b/include/commands/cmd_pong.h @@ -30,7 +30,7 @@ class CommandPong : public Command public: /** Constructor for pong. */ - CommandPong (InspIRCd* Instance) : Command(Instance,"PONG", 0, 1, false, 0) { syntax = ""; } + CommandPong (InspIRCd* Instance) : Command(Instance,NULL,"PONG", 0, 1, false, 0) { syntax = ""; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_privmsg.h b/include/commands/cmd_privmsg.h index 4fcc8284c..74990983c 100644 --- a/include/commands/cmd_privmsg.h +++ b/include/commands/cmd_privmsg.h @@ -29,7 +29,7 @@ class CommandPrivmsg : public Command public: /** Constructor for privmsg. */ - CommandPrivmsg (InspIRCd* Instance) : Command(Instance,"PRIVMSG",0,2) { syntax = "{,} "; } + CommandPrivmsg (InspIRCd* Instance) : Command(Instance,NULL,"PRIVMSG",0,2) { syntax = "{,} "; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_qline.h b/include/commands/cmd_qline.h index f36535cb1..352ebddda 100644 --- a/include/commands/cmd_qline.h +++ b/include/commands/cmd_qline.h @@ -29,7 +29,7 @@ class CommandQline : public Command public: /** Constructor for qline. */ - CommandQline (InspIRCd* Instance) : Command(Instance,"QLINE","o",1,3,false,0) { syntax = " [ :]"; } + CommandQline (InspIRCd* Instance) : Command(Instance,NULL,"QLINE","o",1,3,false,0) { syntax = " [ :]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_quit.h b/include/commands/cmd_quit.h index 62a3a59e3..f1430e46b 100644 --- a/include/commands/cmd_quit.h +++ b/include/commands/cmd_quit.h @@ -29,7 +29,7 @@ class CommandQuit : public Command public: /** Constructor for quit. */ - CommandQuit (InspIRCd* Instance) : Command(Instance,"QUIT",0,0,true) { syntax = "[]"; } + CommandQuit (InspIRCd* Instance) : Command(Instance,NULL,"QUIT",0,0,true) { syntax = "[]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_rehash.h b/include/commands/cmd_rehash.h index 6b35c2ae5..6c294ffb0 100644 --- a/include/commands/cmd_rehash.h +++ b/include/commands/cmd_rehash.h @@ -29,7 +29,7 @@ class CommandRehash : public Command public: /** Constructor for rehash. */ - CommandRehash (InspIRCd* Instance) : Command(Instance,"REHASH","o",0,false,3) { syntax = "[]"; } + CommandRehash (InspIRCd* Instance) : Command(Instance,NULL,"REHASH","o",0,false,3) { syntax = "[]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_reloadmodule.h b/include/commands/cmd_reloadmodule.h index f76106ebf..d75ec568f 100644 --- a/include/commands/cmd_reloadmodule.h +++ b/include/commands/cmd_reloadmodule.h @@ -29,7 +29,7 @@ class CommandReloadmodule : public Command public: /** Constructor for reloadmodule. */ - CommandReloadmodule (InspIRCd* Instance) : Command(Instance,"RELOADMODULE","o",1) { syntax = ""; } + CommandReloadmodule (InspIRCd* Instance) : Command(Instance,NULL,"RELOADMODULE","o",1) { syntax = ""; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_restart.h b/include/commands/cmd_restart.h index ab7986ab7..cd55ed15d 100644 --- a/include/commands/cmd_restart.h +++ b/include/commands/cmd_restart.h @@ -32,7 +32,7 @@ class CommandRestart : public Command public: /** Constructor for restart. */ - CommandRestart (InspIRCd* Instance) : Command(Instance,"RESTART","o",1,false,0) { syntax = ""; } + CommandRestart (InspIRCd* Instance) : Command(Instance,NULL,"RESTART","o",1,false,0) { syntax = ""; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_rules.h b/include/commands/cmd_rules.h index 533ee2a37..f0d6a395f 100644 --- a/include/commands/cmd_rules.h +++ b/include/commands/cmd_rules.h @@ -32,7 +32,7 @@ class CommandRules : public Command public: /** Constructor for rules. */ - CommandRules (InspIRCd* Instance) : Command(Instance,"RULES",0,0) { syntax = "[]"; } + CommandRules (InspIRCd* Instance) : Command(Instance,NULL,"RULES",0,0) { syntax = "[]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_server.h b/include/commands/cmd_server.h index 5f69adcff..f3469552d 100644 --- a/include/commands/cmd_server.h +++ b/include/commands/cmd_server.h @@ -29,7 +29,7 @@ class CommandServer : public Command public: /** Constructor for server. */ - CommandServer (InspIRCd* Instance) : Command(Instance,"SERVER",0,0,true) { } + CommandServer (InspIRCd* Instance) : Command(Instance,NULL,"SERVER",0,0,true) { } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_squit.h b/include/commands/cmd_squit.h index b9b9c0188..6090831be 100644 --- a/include/commands/cmd_squit.h +++ b/include/commands/cmd_squit.h @@ -32,7 +32,7 @@ class CommandSquit : public Command public: /** Constructor for squit. */ - CommandSquit (InspIRCd* Instance) : Command(Instance,"SQUIT","o",1) { syntax = " []"; } + CommandSquit (InspIRCd* Instance) : Command(Instance,NULL,"SQUIT","o",1) { syntax = " []"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_stats.h b/include/commands/cmd_stats.h index 70791670f..8df7def88 100644 --- a/include/commands/cmd_stats.h +++ b/include/commands/cmd_stats.h @@ -32,7 +32,7 @@ class CommandStats : public Command public: /** Constructor for stats. */ - CommandStats (InspIRCd* Instance) : Command(Instance,"STATS",0,1) { syntax = " []"; } + CommandStats (InspIRCd* Instance) : Command(Instance,NULL,"STATS",0,1) { syntax = " []"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_time.h b/include/commands/cmd_time.h index 78cd8f1af..688618901 100644 --- a/include/commands/cmd_time.h +++ b/include/commands/cmd_time.h @@ -29,7 +29,7 @@ class CommandTime : public Command public: /** Constructor for time. */ - CommandTime (InspIRCd* Instance) : Command(Instance,"TIME",0,0) { syntax = "[]"; } + CommandTime (InspIRCd* Instance) : Command(Instance,NULL,"TIME",0,0) { syntax = "[]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_topic.h b/include/commands/cmd_topic.h index e03ea28ee..dc5ce1c77 100644 --- a/include/commands/cmd_topic.h +++ b/include/commands/cmd_topic.h @@ -29,7 +29,7 @@ class CommandTopic : public Command public: /** Constructor for topic. */ - CommandTopic (InspIRCd* Instance) : Command(Instance,"TOPIC",0,1,false,2) { syntax = " []"; } + CommandTopic (InspIRCd* Instance) : Command(Instance,NULL,"TOPIC",0,1,false,2) { syntax = " []"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_trace.h b/include/commands/cmd_trace.h index 110bc7176..871d150fd 100644 --- a/include/commands/cmd_trace.h +++ b/include/commands/cmd_trace.h @@ -29,7 +29,7 @@ class CommandTrace : public Command public: /** Constructor for trace. */ - CommandTrace (InspIRCd* Instance) : Command(Instance,"TRACE","o",0) { syntax = "[]"; } + CommandTrace (InspIRCd* Instance) : Command(Instance,NULL,"TRACE","o",0) { syntax = "[]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_unloadmodule.h b/include/commands/cmd_unloadmodule.h index e7e8523e2..dd60bfd79 100644 --- a/include/commands/cmd_unloadmodule.h +++ b/include/commands/cmd_unloadmodule.h @@ -29,7 +29,7 @@ class CommandUnloadmodule : public Command public: /** Constructor for unloadmodule. */ - CommandUnloadmodule (InspIRCd* Instance) : Command(Instance,"UNLOADMODULE","o",1) { syntax = ""; } + CommandUnloadmodule (InspIRCd* Instance) : Command(Instance,NULL,"UNLOADMODULE","o",1) { syntax = ""; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_user.h b/include/commands/cmd_user.h index 346730878..9bc28b912 100644 --- a/include/commands/cmd_user.h +++ b/include/commands/cmd_user.h @@ -29,7 +29,7 @@ class CommandUser : public Command public: /** Constructor for user. */ - CommandUser (InspIRCd* Instance) : Command(Instance,"USER",0,4,true,0) { syntax = " "; } + CommandUser (InspIRCd* Instance) : Command(Instance,NULL,"USER",0,4,true,0) { syntax = " "; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_userhost.h b/include/commands/cmd_userhost.h index 65d1cc334..1ba15f5a8 100644 --- a/include/commands/cmd_userhost.h +++ b/include/commands/cmd_userhost.h @@ -29,7 +29,7 @@ class CommandUserhost : public Command public: /** Constructor for userhost. */ - CommandUserhost (InspIRCd* Instance) : Command(Instance,"USERHOST",0,1) { syntax = "{,}"; } + CommandUserhost (InspIRCd* Instance) : Command(Instance,NULL,"USERHOST",0,1) { syntax = "{,}"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_version.h b/include/commands/cmd_version.h index 559d7841b..f093591a4 100644 --- a/include/commands/cmd_version.h +++ b/include/commands/cmd_version.h @@ -29,7 +29,7 @@ class CommandVersion : public Command public: /** Constructor for version. */ - CommandVersion (InspIRCd* Instance) : Command(Instance,"VERSION",0,0) { syntax = "[]"; } + CommandVersion (InspIRCd* Instance) : Command(Instance,NULL,"VERSION",0,0) { syntax = "[]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_wallops.h b/include/commands/cmd_wallops.h index b3b42fc02..34089cdae 100644 --- a/include/commands/cmd_wallops.h +++ b/include/commands/cmd_wallops.h @@ -29,7 +29,7 @@ class CommandWallops : public Command public: /** Constructor for wallops. */ - CommandWallops (InspIRCd* Instance) : Command(Instance,"WALLOPS","o",1,1) { syntax = ""; } + CommandWallops (InspIRCd* Instance) : Command(Instance,NULL,"WALLOPS","o",1,1) { syntax = ""; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_who.h b/include/commands/cmd_who.h index a6afd425f..65adc549c 100644 --- a/include/commands/cmd_who.h +++ b/include/commands/cmd_who.h @@ -43,7 +43,7 @@ class CommandWho : public Command public: /** Constructor for who. */ - CommandWho (InspIRCd* Instance) : Command(Instance,"WHO", 0, 1, false, 2) { syntax = "|||||0 [ohurmMiaplf]"; } + CommandWho (InspIRCd* Instance) : Command(Instance,NULL,"WHO", 0, 1, false, 2) { syntax = "|||||0 [ohurmMiaplf]"; } void SendWhoLine(User* user, const std::string &initial, Channel* ch, User* u, std::vector &whoresults); /** Handle command. * @param parameters The parameters to the comamnd diff --git a/include/commands/cmd_whois.h b/include/commands/cmd_whois.h index bf6658b7a..494095e07 100644 --- a/include/commands/cmd_whois.h +++ b/include/commands/cmd_whois.h @@ -32,7 +32,7 @@ class CommandWhois : public Command public: /** Constructor for whois. */ - CommandWhois (InspIRCd* Instance) : Command(Instance,"WHOIS",0,1,false,2) { syntax = "{,}"; } + CommandWhois (InspIRCd* Instance) : Command(Instance,NULL,"WHOIS",0,1,false,2) { syntax = "{,}"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/commands/cmd_zline.h b/include/commands/cmd_zline.h index fdca7c9dc..fa45ef154 100644 --- a/include/commands/cmd_zline.h +++ b/include/commands/cmd_zline.h @@ -29,7 +29,7 @@ class CommandZline : public Command public: /** Constructor for zline. */ - CommandZline (InspIRCd* Instance) : Command(Instance,"ZLINE","o",1,3,false,0) { syntax = " [ :]"; } + CommandZline (InspIRCd* Instance) : Command(Instance,NULL,"ZLINE","o",1,3,false,0) { syntax = " [ :]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/ctables.h b/include/ctables.h index a543b7e37..315b38f43 100644 --- a/include/ctables.h +++ b/include/ctables.h @@ -79,7 +79,10 @@ class CoreExport Command : public Extensible public: /** Command name */ - std::string command; + std::string command; + + /** Creator module, NULL for core commands */ + Module* creator; /** User flags needed to execute the command or 0 */ @@ -100,12 +103,8 @@ class CoreExport Command : public Extensible long double use_count; /** used by /stats m - */ - long double total_bytes; - - /** used for resource tracking between modules */ - std::string source; + long double total_bytes; /** True if the command is disabled to non-opers */ @@ -140,22 +139,20 @@ class CoreExport Command : public Extensible * be allowed before the user is 'registered' (has sent USER, * NICK, optionally PASS, and been resolved). */ - Command(InspIRCd* Instance, const std::string &cmd, const char *flags, int minpara, bool before_reg = false, int penalty = 1) : ServerInstance(Instance), command(cmd), flags_needed(flags ? *flags : 0), min_params(minpara), max_params(0), disabled(false), works_before_reg(before_reg), Penalty(penalty) + Command(InspIRCd* Instance, Module* me, const std::string &cmd, const char *flags, int minpara, bool before_reg = false, int penalty = 1) : + ServerInstance(Instance), command(cmd), creator(me), flags_needed(flags ? *flags : 0), + min_params(minpara), max_params(0), disabled(false), works_before_reg(before_reg), Penalty(penalty) { use_count = 0; total_bytes = 0; - source = ""; - syntax = ""; - translation.clear(); } - Command(InspIRCd* Instance, const std::string &cmd, const char *flags, int minpara, int maxpara, bool before_reg = false, int penalty = 1) : ServerInstance(Instance), command(cmd), flags_needed(flags ? *flags : 0), min_params(minpara), max_params(maxpara), disabled(false), works_before_reg(before_reg), Penalty(penalty) + Command(InspIRCd* Instance, Module* me, const std::string &cmd, const char *flags, int minpara, int maxpara, bool before_reg = false, int penalty = 1) : + ServerInstance(Instance), command(cmd), creator(me), flags_needed(flags ? *flags : 0), + min_params(minpara), max_params(maxpara), disabled(false), works_before_reg(before_reg), Penalty(penalty) { use_count = 0; total_bytes = 0; - source = ""; - syntax = ""; - translation.clear(); } /** Handle the command from a user. diff --git a/include/mode.h b/include/mode.h index da202c236..0f43d6db4 100644 --- a/include/mode.h +++ b/include/mode.h @@ -150,6 +150,9 @@ class CoreExport ModeHandler : public classbase char prefixneeded; public: + /** Module that created this mode. NULL for core modes */ + Module* creator; + /** * The constructor for ModeHandler initalizes the mode handler. * The constructor of any class you derive from ModeHandler should @@ -165,9 +168,12 @@ class CoreExport ModeHandler : public classbase * In the core, the only modes to implement prefixes are +ovh (ops, voice, halfop) which define the prefix characters @, % and + * and the rank values OP_VALUE, HALFOP_VALUE and VOICE_VALUE respectively. Any prefixes you define should have unique values proportional * to these three defaults or proportional to another mode in a module you depend on. See src/cmode_o.cpp as an example. + * @param prefixrequired The prefix required to change this mode + * @param translate The translation type for the argument(s) of this mode */ - ModeHandler(InspIRCd* Instance, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly, - char mprefix = 0, char prefixrequired = '%', TranslateType translate = TR_TEXT); + ModeHandler(InspIRCd* Instance, Module* me, char modeletter, int parameters_on, int parameters_off, + bool listmode, ModeType type, bool operonly, char mprefix = 0, + char prefixrequired = '%', TranslateType translate = TR_TEXT); /** * The default destructor does nothing */ @@ -321,8 +327,9 @@ class CoreExport ModeHandler : public classbase class CoreExport SimpleUserModeHandler : public ModeHandler { public: - SimpleUserModeHandler(InspIRCd* Instance, char modeletter); - virtual ~SimpleUserModeHandler(); + SimpleUserModeHandler(InspIRCd* Instance, Module* Creator, char modeletter) + : ModeHandler(Instance, Creator, modeletter, 0, 0, false, MODETYPE_USER, false) {} + virtual ~SimpleUserModeHandler() {} virtual ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode = false); }; @@ -334,8 +341,9 @@ class CoreExport SimpleUserModeHandler : public ModeHandler class CoreExport SimpleChannelModeHandler : public ModeHandler { public: - SimpleChannelModeHandler(InspIRCd* Instance, char modeletter); - virtual ~SimpleChannelModeHandler(); + SimpleChannelModeHandler(InspIRCd* Instance, Module* Creator, char modeletter) + : ModeHandler(Instance, Creator, modeletter, 0, 0, false, MODETYPE_CHANNEL, false) {} + virtual ~SimpleChannelModeHandler() {} virtual ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode = false); }; diff --git a/include/u_listmode.h b/include/u_listmode.h index 0a2c25710..d6e534e07 100644 --- a/include/u_listmode.h +++ b/include/u_listmode.h @@ -124,7 +124,7 @@ class ListModeBase : public ModeHandler bool tidy; /** Config tag to check for max items per channel */ - std::string configtag; + std::string configtag; /** Limits on a per-channel basis read from the tag * specified in ListModeBase::configtag */ @@ -140,8 +140,8 @@ class ListModeBase : public ModeHandler * @param autotidy Automatically tidy list entries on add * @param ctag Configuration tag to get limits from */ - ListModeBase(InspIRCd* Instance, char modechar, const std::string &eolstr, unsigned int lnum, unsigned int eolnum, bool autotidy, const std::string &ctag = "banlist") - : ModeHandler(Instance, modechar, 1, 1, true, MODETYPE_CHANNEL, false), listnumeric(lnum), endoflistnumeric(eolnum), endofliststring(eolstr), tidy(autotidy), configtag(ctag) + ListModeBase(InspIRCd* Instance, Module* Creator, char modechar, const std::string &eolstr, unsigned int lnum, unsigned int eolnum, bool autotidy, const std::string &ctag = "banlist") + : ModeHandler(Instance, Creator, modechar, 1, 1, true, MODETYPE_CHANNEL, false), listnumeric(lnum), endoflistnumeric(eolnum), endofliststring(eolstr), tidy(autotidy), configtag(ctag) { this->DoRehash(); infokey = "listbase_mode_" + std::string(1, mode) + "_list"; -- cgit v1.2.3