Add Module* creator to Command and ModeHandler

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11631 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
danieldg 2009-09-02 00:48:48 +00:00
parent 79f9faeec8
commit 24731c63b6
171 changed files with 347 additions and 432 deletions

View File

@ -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<std::string,Command*>::iterator safei, const char* source);
void RemoveCommand(nspace::hash_map<std::string,Command*>::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 = "<core-command>"; }
CommandReload (InspIRCd* Instance) : Command(Instance,NULL,"RELOAD","o",1) { syntax = "<core-command>"; }
/** Handle RELOAD
*/
CmdResult Handle(const std::vector<std::string>& parameters, User *user);

View File

@ -27,7 +27,7 @@ class CommandAdmin : public Command
public:
/** Constructor for admin.
*/
CommandAdmin (InspIRCd* Instance) : Command(Instance,"ADMIN",0,0) { syntax = "[<servername>]"; }
CommandAdmin (InspIRCd* Instance) : Command(Instance,NULL,"ADMIN",0,0) { syntax = "[<servername>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandAway : public Command
public:
/** Constructor for away.
*/
CommandAway (InspIRCd* Instance) : Command(Instance,"AWAY",0,0) { syntax = "[<message>]"; }
CommandAway (InspIRCd* Instance) : Command(Instance,NULL,"AWAY",0,0) { syntax = "[<message>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -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

View File

@ -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

View File

@ -29,7 +29,7 @@ class CommandConnect : public Command
public:
/** Constructor for connect.
*/
CommandConnect (InspIRCd* Instance) : Command(Instance,"CONNECT","o",1,false,0) { syntax = "<servername> [<remote-server>]"; }
CommandConnect (InspIRCd* Instance) : Command(Instance,NULL,"CONNECT","o",1,false,0) { syntax = "<servername> [<remote-server>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandDie : public Command
public:
/** Constructor for die.
*/
CommandDie (InspIRCd* Instance) : Command(Instance,"DIE","o",1,false,0) { syntax = "<password>"; }
CommandDie (InspIRCd* Instance) : Command(Instance,NULL,"DIE","o",1,false,0) { syntax = "<password>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandEline : public Command
public:
/** Constructor for eline.
*/
CommandEline (InspIRCd* Instance) : Command(Instance,"ELINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; }
CommandEline (InspIRCd* Instance) : Command(Instance,NULL,"ELINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandGline : public Command
public:
/** Constructor for gline.
*/
CommandGline (InspIRCd* Instance) : Command(Instance,"GLINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; }
CommandGline (InspIRCd* Instance) : Command(Instance,NULL,"GLINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandInfo : public Command
public:
/** Constructor for info.
*/
CommandInfo (InspIRCd* Instance) : Command(Instance,"INFO",0,0) { syntax = "[<servermask>]"; }
CommandInfo (InspIRCd* Instance) : Command(Instance,NULL,"INFO",0,0) { syntax = "[<servermask>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandInvite : public Command
public:
/** Constructor for invite.
*/
CommandInvite (InspIRCd* Instance) : Command(Instance,"INVITE", 0, 0, false, 4) { syntax = "[<nick> <channel>]"; }
CommandInvite (InspIRCd* Instance) : Command(Instance,NULL,"INVITE", 0, 0, false, 4) { syntax = "[<nick> <channel>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandIson : public Command
public:
/** Constructor for ison.
*/
CommandIson (InspIRCd* Instance) : Command(Instance,"ISON",0,0) { syntax = "<nick> {nick}"; }
CommandIson (InspIRCd* Instance) : Command(Instance,NULL,"ISON",0,0) { syntax = "<nick> {nick}"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandJoin : public Command
public:
/** Constructor for join.
*/
CommandJoin (InspIRCd* Instance) : Command(Instance,"JOIN", 0, 1, false, 2) { syntax = "<channel>{,<channel>} {<key>{,<key>}}"; }
CommandJoin (InspIRCd* Instance) : Command(Instance,NULL,"JOIN", 0, 1, false, 2) { syntax = "<channel>{,<channel>} {<key>{,<key>}}"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandKick : public Command
public:
/** Constructor for kick.
*/
CommandKick (InspIRCd* Instance) : Command(Instance,"KICK",0,2) { syntax = "<channel> <nick>{,<nick>} [<reason>]"; }
CommandKick (InspIRCd* Instance) : Command(Instance,NULL,"KICK",0,2) { syntax = "<channel> <nick>{,<nick>} [<reason>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandKill : public Command
public:
/** Constructor for kill.
*/
CommandKill (InspIRCd* Instance) : Command(Instance,"KILL","o",2,false,0) { syntax = "<nickname> <reason>"; }
CommandKill (InspIRCd* Instance) : Command(Instance,NULL,"KILL","o",2,false,0) { syntax = "<nickname> <reason>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandKline : public Command
public:
/** Constructor for kline.
*/
CommandKline (InspIRCd* Instance) : Command(Instance,"KLINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; }
CommandKline (InspIRCd* Instance) : Command(Instance,NULL,"KLINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -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

View File

@ -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

View File

@ -29,7 +29,7 @@ class CommandLoadmodule : public Command
public:
/** Constructor for loadmodule.
*/
CommandLoadmodule (InspIRCd* Instance) : Command(Instance,"LOADMODULE","o",1) { syntax = "<modulename>"; }
CommandLoadmodule (InspIRCd* Instance) : Command(Instance,NULL,"LOADMODULE","o",1) { syntax = "<modulename>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -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

View File

@ -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

View File

@ -28,7 +28,7 @@ class CommandMode : public Command
public:
/** Constructor for mode.
*/
CommandMode (InspIRCd* Instance) : Command(Instance,"MODE",0,1) { syntax = "<target> <modes> {<mode-parameters>}"; }
CommandMode (InspIRCd* Instance) : Command(Instance,NULL,"MODE",0,1) { syntax = "<target> <modes> {<mode-parameters>}"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -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

View File

@ -32,7 +32,7 @@ class CommandMotd : public Command
public:
/** Constructor for motd.
*/
CommandMotd (InspIRCd* Instance) : Command(Instance,"MOTD",0,0) { syntax = "[<servername>]"; }
CommandMotd (InspIRCd* Instance) : Command(Instance,NULL,"MOTD",0,0) { syntax = "[<servername>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandNames : public Command
public:
/** Constructor for names.
*/
CommandNames (InspIRCd* Instance) : Command(Instance,"NAMES",0,0) { syntax = "{<channel>{,<channel>}}"; }
CommandNames (InspIRCd* Instance) : Command(Instance,NULL,"NAMES",0,0) { syntax = "{<channel>{,<channel>}}"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -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 = "<newnick>"; }
CommandNick (InspIRCd* Instance) : Command(Instance,NULL,"NICK", 0, 1, true, 3), allowinvalid(false) { syntax = "<newnick>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandNotice : public Command
public:
/** Constructor for notice.
*/
CommandNotice (InspIRCd* Instance) : Command(Instance,"NOTICE",0,2) { syntax = "<target>{,<target>} <message>"; }
CommandNotice (InspIRCd* Instance) : Command(Instance,NULL,"NOTICE",0,2) { syntax = "<target>{,<target>} <message>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -31,7 +31,7 @@ class CommandOper : public Command
public:
/** Constructor for oper.
*/
CommandOper (InspIRCd* Instance) : Command(Instance,"OPER",0,2,false,2) { syntax = "<username> <password>"; }
CommandOper (InspIRCd* Instance) : Command(Instance,NULL,"OPER",0,2,false,2) { syntax = "<username> <password>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandPart : public Command
public:
/** Constructor for part.
*/
CommandPart (InspIRCd* Instance) : Command(Instance,"PART", 0, 1, false, 5) { syntax = "<channel>{,<channel>} [<reason>]"; }
CommandPart (InspIRCd* Instance) : Command(Instance,NULL,"PART", 0, 1, false, 5) { syntax = "<channel>{,<channel>} [<reason>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -32,7 +32,7 @@ class CommandPass : public Command
public:
/** Constructor for pass.
*/
CommandPass (InspIRCd* Instance) : Command(Instance,"PASS",0,1,true,0) { syntax = "<password>"; }
CommandPass (InspIRCd* Instance) : Command(Instance,NULL,"PASS",0,1,true,0) { syntax = "<password>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandPing : public Command
public:
/** Constructor for ping.
*/
CommandPing (InspIRCd* Instance) : Command(Instance,"PING", 0, 1, false, 0) { syntax = "<servername> [:<servername>]"; }
CommandPing (InspIRCd* Instance) : Command(Instance,NULL,"PING", 0, 1, false, 0) { syntax = "<servername> [:<servername>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -30,7 +30,7 @@ class CommandPong : public Command
public:
/** Constructor for pong.
*/
CommandPong (InspIRCd* Instance) : Command(Instance,"PONG", 0, 1, false, 0) { syntax = "<ping-text>"; }
CommandPong (InspIRCd* Instance) : Command(Instance,NULL,"PONG", 0, 1, false, 0) { syntax = "<ping-text>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandPrivmsg : public Command
public:
/** Constructor for privmsg.
*/
CommandPrivmsg (InspIRCd* Instance) : Command(Instance,"PRIVMSG",0,2) { syntax = "<target>{,<target>} <message>"; }
CommandPrivmsg (InspIRCd* Instance) : Command(Instance,NULL,"PRIVMSG",0,2) { syntax = "<target>{,<target>} <message>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandQline : public Command
public:
/** Constructor for qline.
*/
CommandQline (InspIRCd* Instance) : Command(Instance,"QLINE","o",1,3,false,0) { syntax = "<nick> [<duration> :<reason>]"; }
CommandQline (InspIRCd* Instance) : Command(Instance,NULL,"QLINE","o",1,3,false,0) { syntax = "<nick> [<duration> :<reason>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandQuit : public Command
public:
/** Constructor for quit.
*/
CommandQuit (InspIRCd* Instance) : Command(Instance,"QUIT",0,0,true) { syntax = "[<message>]"; }
CommandQuit (InspIRCd* Instance) : Command(Instance,NULL,"QUIT",0,0,true) { syntax = "[<message>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandRehash : public Command
public:
/** Constructor for rehash.
*/
CommandRehash (InspIRCd* Instance) : Command(Instance,"REHASH","o",0,false,3) { syntax = "[<servermask>]"; }
CommandRehash (InspIRCd* Instance) : Command(Instance,NULL,"REHASH","o",0,false,3) { syntax = "[<servermask>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandReloadmodule : public Command
public:
/** Constructor for reloadmodule.
*/
CommandReloadmodule (InspIRCd* Instance) : Command(Instance,"RELOADMODULE","o",1) { syntax = "<modulename>"; }
CommandReloadmodule (InspIRCd* Instance) : Command(Instance,NULL,"RELOADMODULE","o",1) { syntax = "<modulename>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -32,7 +32,7 @@ class CommandRestart : public Command
public:
/** Constructor for restart.
*/
CommandRestart (InspIRCd* Instance) : Command(Instance,"RESTART","o",1,false,0) { syntax = "<password>"; }
CommandRestart (InspIRCd* Instance) : Command(Instance,NULL,"RESTART","o",1,false,0) { syntax = "<password>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -32,7 +32,7 @@ class CommandRules : public Command
public:
/** Constructor for rules.
*/
CommandRules (InspIRCd* Instance) : Command(Instance,"RULES",0,0) { syntax = "[<servername>]"; }
CommandRules (InspIRCd* Instance) : Command(Instance,NULL,"RULES",0,0) { syntax = "[<servername>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -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

View File

@ -32,7 +32,7 @@ class CommandSquit : public Command
public:
/** Constructor for squit.
*/
CommandSquit (InspIRCd* Instance) : Command(Instance,"SQUIT","o",1) { syntax = "<servername> [<reason>]"; }
CommandSquit (InspIRCd* Instance) : Command(Instance,NULL,"SQUIT","o",1) { syntax = "<servername> [<reason>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -32,7 +32,7 @@ class CommandStats : public Command
public:
/** Constructor for stats.
*/
CommandStats (InspIRCd* Instance) : Command(Instance,"STATS",0,1) { syntax = "<stats-symbol> [<servername>]"; }
CommandStats (InspIRCd* Instance) : Command(Instance,NULL,"STATS",0,1) { syntax = "<stats-symbol> [<servername>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandTime : public Command
public:
/** Constructor for time.
*/
CommandTime (InspIRCd* Instance) : Command(Instance,"TIME",0,0) { syntax = "[<servername>]"; }
CommandTime (InspIRCd* Instance) : Command(Instance,NULL,"TIME",0,0) { syntax = "[<servername>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandTopic : public Command
public:
/** Constructor for topic.
*/
CommandTopic (InspIRCd* Instance) : Command(Instance,"TOPIC",0,1,false,2) { syntax = "<channel> [<topic>]"; }
CommandTopic (InspIRCd* Instance) : Command(Instance,NULL,"TOPIC",0,1,false,2) { syntax = "<channel> [<topic>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandTrace : public Command
public:
/** Constructor for trace.
*/
CommandTrace (InspIRCd* Instance) : Command(Instance,"TRACE","o",0) { syntax = "[<object>]"; }
CommandTrace (InspIRCd* Instance) : Command(Instance,NULL,"TRACE","o",0) { syntax = "[<object>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandUnloadmodule : public Command
public:
/** Constructor for unloadmodule.
*/
CommandUnloadmodule (InspIRCd* Instance) : Command(Instance,"UNLOADMODULE","o",1) { syntax = "<modulename>"; }
CommandUnloadmodule (InspIRCd* Instance) : Command(Instance,NULL,"UNLOADMODULE","o",1) { syntax = "<modulename>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandUser : public Command
public:
/** Constructor for user.
*/
CommandUser (InspIRCd* Instance) : Command(Instance,"USER",0,4,true,0) { syntax = "<username> <localhost> <remotehost> <GECOS>"; }
CommandUser (InspIRCd* Instance) : Command(Instance,NULL,"USER",0,4,true,0) { syntax = "<username> <localhost> <remotehost> <GECOS>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandUserhost : public Command
public:
/** Constructor for userhost.
*/
CommandUserhost (InspIRCd* Instance) : Command(Instance,"USERHOST",0,1) { syntax = "<nick>{,<nick>}"; }
CommandUserhost (InspIRCd* Instance) : Command(Instance,NULL,"USERHOST",0,1) { syntax = "<nick>{,<nick>}"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandVersion : public Command
public:
/** Constructor for version.
*/
CommandVersion (InspIRCd* Instance) : Command(Instance,"VERSION",0,0) { syntax = "[<servername>]"; }
CommandVersion (InspIRCd* Instance) : Command(Instance,NULL,"VERSION",0,0) { syntax = "[<servername>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandWallops : public Command
public:
/** Constructor for wallops.
*/
CommandWallops (InspIRCd* Instance) : Command(Instance,"WALLOPS","o",1,1) { syntax = "<any-text>"; }
CommandWallops (InspIRCd* Instance) : Command(Instance,NULL,"WALLOPS","o",1,1) { syntax = "<any-text>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -43,7 +43,7 @@ class CommandWho : public Command
public:
/** Constructor for who.
*/
CommandWho (InspIRCd* Instance) : Command(Instance,"WHO", 0, 1, false, 2) { syntax = "<server>|<nickname>|<channel>|<realname>|<host>|0 [ohurmMiaplf]"; }
CommandWho (InspIRCd* Instance) : Command(Instance,NULL,"WHO", 0, 1, false, 2) { syntax = "<server>|<nickname>|<channel>|<realname>|<host>|0 [ohurmMiaplf]"; }
void SendWhoLine(User* user, const std::string &initial, Channel* ch, User* u, std::vector<std::string> &whoresults);
/** Handle command.
* @param parameters The parameters to the comamnd

View File

@ -32,7 +32,7 @@ class CommandWhois : public Command
public:
/** Constructor for whois.
*/
CommandWhois (InspIRCd* Instance) : Command(Instance,"WHOIS",0,1,false,2) { syntax = "<nick>{,<nick>}"; }
CommandWhois (InspIRCd* Instance) : Command(Instance,NULL,"WHOIS",0,1,false,2) { syntax = "<nick>{,<nick>}"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -29,7 +29,7 @@ class CommandZline : public Command
public:
/** Constructor for zline.
*/
CommandZline (InspIRCd* Instance) : Command(Instance,"ZLINE","o",1,3,false,0) { syntax = "<ipmask> [<duration> :<reason>]"; }
CommandZline (InspIRCd* Instance) : Command(Instance,NULL,"ZLINE","o",1,3,false,0) { syntax = "<ipmask> [<duration> :<reason>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command

View File

@ -81,6 +81,9 @@ class CoreExport Command : public Extensible
*/
std::string command;
/** Creator module, NULL for core commands */
Module* creator;
/** User flags needed to execute the command or 0
*/
char flags_needed;
@ -103,10 +106,6 @@ class CoreExport Command : public Extensible
*/
long double total_bytes;
/** used for resource tracking between modules
*/
std::string source;
/** True if the command is disabled to non-opers
*/
bool disabled;
@ -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 = "<core>";
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 = "<core>";
syntax = "";
translation.clear();
}
/** Handle the command from a user.

View File

@ -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 &parameter, 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 &parameter, bool adding, bool servermode = false);
};

View File

@ -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";

View File

@ -161,7 +161,7 @@ bool CommandParser::IsValidCommand(const std::string &commandname, unsigned int
if (n != cmdlist.end())
{
if ((pcnt >= n->second->min_params) && (n->second->source != "<core>"))
if ((pcnt >= n->second->min_params) && (n->second->creator != NULL))
{
if (IS_LOCAL(user) && n->second->flags_needed)
{
@ -414,7 +414,7 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
}
}
void CommandParser::RemoveCommands(const char* source)
void CommandParser::RemoveCommands(Module* source)
{
Commandtable::iterator i,safei;
for (i = cmdlist.begin(); i != cmdlist.end();)
@ -441,10 +441,10 @@ void CommandParser::RemoveRFCCommands()
delete reload;
}
void CommandParser::RemoveCommand(Commandtable::iterator safei, const char* source)
void CommandParser::RemoveCommand(Commandtable::iterator safei, Module* source)
{
Command* x = safei->second;
if (x->source == std::string(source))
if (x->creator == source)
{
cmdlist.erase(safei);
}

View File

@ -25,10 +25,11 @@ CmdResult CommandCommands::Handle (const std::vector<std::string>&, User *user)
{
for (Commandtable::iterator i = ServerInstance->Parser->cmdlist.begin(); i != ServerInstance->Parser->cmdlist.end(); i++)
{
Module* src = i->second->creator;
user->WriteNumeric(RPL_COMMANDS, "%s :%s %s %d %d",
user->nick.c_str(),
i->second->command.c_str(),
i->second->source.c_str(),
src ? src->ModuleSourceFile.c_str() : "<core>",
i->second->min_params,
i->second->Penalty);
}

View File

@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandWhowas(Instance);
}
CommandWhowas::CommandWhowas(InspIRCd* Instance) : Command(Instance, "WHOWAS", 0, 1, false, 2)
CommandWhowas::CommandWhowas(InspIRCd* Instance) : Command(Instance, NULL, "WHOWAS", 0, 1, false, 2)
{
syntax = "<nick>{,<nick>}";
timer = new WhoWasMaintainTimer(Instance, 3600);

View File

@ -49,8 +49,8 @@
/* +s (server notice masks) */
#include "modes/umode_s.h"
ModeHandler::ModeHandler(InspIRCd* Instance, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly, char mprefix, char prefixrequired, TranslateType translate)
: ServerInstance(Instance), mode(modeletter), n_params_on(parameters_on), n_params_off(parameters_off), list(listmode), m_type(type), m_paramtype(translate), oper(operonly), prefix(mprefix), count(0), prefixneeded(prefixrequired)
ModeHandler::ModeHandler(InspIRCd* Instance, Module* Creator, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly, char mprefix, char prefixrequired, TranslateType translate)
: ServerInstance(Instance), mode(modeletter), n_params_on(parameters_on), n_params_off(parameters_off), list(listmode), m_type(type), m_paramtype(translate), oper(operonly), prefix(mprefix), count(0), prefixneeded(prefixrequired), creator(Creator)
{
}
@ -160,22 +160,6 @@ bool ModeHandler::CheckTimeStamp(std::string& theirs, const std::string& ours, C
return (theirs < ours);
}
SimpleUserModeHandler::SimpleUserModeHandler(InspIRCd* Instance, char modeletter) : ModeHandler(Instance, modeletter, 0, 0, false, MODETYPE_USER, false)
{
}
SimpleUserModeHandler::~SimpleUserModeHandler()
{
}
SimpleChannelModeHandler::~SimpleChannelModeHandler()
{
}
SimpleChannelModeHandler::SimpleChannelModeHandler(InspIRCd* Instance, char modeletter) : ModeHandler(Instance, modeletter, 0, 0, false, MODETYPE_CHANNEL, false)
{
}
ModeAction SimpleUserModeHandler::OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool servermode)
{
if (adding)

View File

@ -25,7 +25,7 @@
#include "hashcomp.h"
#include "modes/cmode_b.h"
ModeChannelBan::ModeChannelBan(InspIRCd* Instance) : ModeHandler(Instance, 'b', 1, 1, true, MODETYPE_CHANNEL, false)
ModeChannelBan::ModeChannelBan(InspIRCd* Instance) : ModeHandler(Instance, NULL, 'b', 1, 1, true, MODETYPE_CHANNEL, false)
{
}

View File

@ -19,7 +19,7 @@
#include "modules.h"
#include "modes/cmode_h.h"
ModeChannelHalfOp::ModeChannelHalfOp(InspIRCd* Instance) : ModeHandler(Instance, 'h', 1, 1, true, MODETYPE_CHANNEL, false, '%', '@', TR_NICK)
ModeChannelHalfOp::ModeChannelHalfOp(InspIRCd* Instance) : ModeHandler(Instance, NULL, 'h', 1, 1, true, MODETYPE_CHANNEL, false, '%', '@', TR_NICK)
{
}

View File

@ -17,7 +17,7 @@
#include "users.h"
#include "modes/cmode_i.h"
ModeChannelInviteOnly::ModeChannelInviteOnly(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'i')
ModeChannelInviteOnly::ModeChannelInviteOnly(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, NULL, 'i')
{
}

View File

@ -17,7 +17,7 @@
#include "users.h"
#include "modes/cmode_k.h"
ModeChannelKey::ModeChannelKey(InspIRCd* Instance) : ModeHandler(Instance, 'k', 1, 1, false, MODETYPE_CHANNEL, false)
ModeChannelKey::ModeChannelKey(InspIRCd* Instance) : ModeHandler(Instance, NULL, 'k', 1, 1, false, MODETYPE_CHANNEL, false)
{
}

View File

@ -17,7 +17,7 @@
#include "users.h"
#include "modes/cmode_l.h"
ModeChannelLimit::ModeChannelLimit(InspIRCd* Instance) : ModeHandler(Instance, 'l', 1, 0, false, MODETYPE_CHANNEL, false)
ModeChannelLimit::ModeChannelLimit(InspIRCd* Instance) : ModeHandler(Instance, NULL, 'l', 1, 0, false, MODETYPE_CHANNEL, false)
{
}

View File

@ -17,7 +17,7 @@
#include "users.h"
#include "modes/cmode_m.h"
ModeChannelModerated::ModeChannelModerated(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'm')
ModeChannelModerated::ModeChannelModerated(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, NULL, 'm')
{
}

View File

@ -17,7 +17,7 @@
#include "users.h"
#include "modes/cmode_n.h"
ModeChannelNoExternal::ModeChannelNoExternal(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'n')
ModeChannelNoExternal::ModeChannelNoExternal(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, NULL, 'n')
{
}

View File

@ -19,7 +19,7 @@
#include "modules.h"
#include "modes/cmode_o.h"
ModeChannelOp::ModeChannelOp(InspIRCd* Instance) : ModeHandler(Instance, 'o', 1, 1, true, MODETYPE_CHANNEL, false, '@', '@', TR_NICK)
ModeChannelOp::ModeChannelOp(InspIRCd* Instance) : ModeHandler(Instance, NULL, 'o', 1, 1, true, MODETYPE_CHANNEL, false, '@', '@', TR_NICK)
{
}

View File

@ -17,7 +17,7 @@
#include "users.h"
#include "modes/cmode_p.h"
ModeChannelPrivate::ModeChannelPrivate(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'p')
ModeChannelPrivate::ModeChannelPrivate(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, NULL, 'p')
{
}

View File

@ -17,7 +17,7 @@
#include "users.h"
#include "modes/cmode_s.h"
ModeChannelSecret::ModeChannelSecret(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 's')
ModeChannelSecret::ModeChannelSecret(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, NULL, 's')
{
}

View File

@ -17,7 +17,7 @@
#include "users.h"
#include "modes/cmode_t.h"
ModeChannelTopicOps::ModeChannelTopicOps(InspIRCd* Instance) : ModeHandler(Instance, 't', 0, 0, false, MODETYPE_CHANNEL, false)
ModeChannelTopicOps::ModeChannelTopicOps(InspIRCd* Instance) : ModeHandler(Instance, NULL, 't', 0, 0, false, MODETYPE_CHANNEL, false)
{
}

View File

@ -20,7 +20,7 @@
#include "modules.h"
#include "modes/cmode_v.h"
ModeChannelVoice::ModeChannelVoice(InspIRCd* Instance) : ModeHandler(Instance, 'v', 1, 1, true, MODETYPE_CHANNEL, false, '+', '%', TR_NICK)
ModeChannelVoice::ModeChannelVoice(InspIRCd* Instance) : ModeHandler(Instance, NULL, 'v', 1, 1, true, MODETYPE_CHANNEL, false, '+', '%', TR_NICK)
{
}

View File

@ -17,7 +17,7 @@
#include "users.h"
#include "modes/umode_i.h"
ModeUserInvisible::ModeUserInvisible(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'i')
ModeUserInvisible::ModeUserInvisible(InspIRCd* Instance) : SimpleUserModeHandler(Instance, NULL, 'i')
{
}

View File

@ -17,7 +17,7 @@
#include "users.h"
#include "modes/umode_o.h"
ModeUserOperator::ModeUserOperator(InspIRCd* Instance) : ModeHandler(Instance, 'o', 0, 0, false, MODETYPE_USER, true)
ModeUserOperator::ModeUserOperator(InspIRCd* Instance) : ModeHandler(Instance, NULL, 'o', 0, 0, false, MODETYPE_USER, true)
{
}

View File

@ -17,7 +17,7 @@
#include "users.h"
#include "modes/umode_s.h"
ModeUserServerNoticeMask::ModeUserServerNoticeMask(InspIRCd* Instance) : ModeHandler(Instance, 's', 1, 0, false, MODETYPE_USER, true)
ModeUserServerNoticeMask::ModeUserServerNoticeMask(InspIRCd* Instance) : ModeHandler(Instance, NULL, 's', 1, 0, false, MODETYPE_USER, true)
{
}

View File

@ -17,7 +17,7 @@
#include "users.h"
#include "modes/umode_w.h"
ModeUserWallops::ModeUserWallops(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'w')
ModeUserWallops::ModeUserWallops(InspIRCd* Instance) : SimpleUserModeHandler(Instance, NULL, 'w')
{
}

View File

@ -555,7 +555,7 @@ bool ModuleManager::Unload(const char* filename)
this->DetachAll(modfind->second.second);
Instance->Parser->RemoveCommands(filename);
Instance->Parser->RemoveCommands(modfind->second.second);
delete modfind->second.second;
delete modfind->second.first;

View File

@ -47,11 +47,9 @@ public:
class CommandStartTLS : public Command
{
Module* Caller;
public:
CommandStartTLS (InspIRCd* Instance, Module* mod) : Command(Instance,"STARTTLS", 0, 0, true), Caller(mod)
CommandStartTLS (InspIRCd* Instance, Module* mod) : Command(Instance, mod, "STARTTLS", 0, 0, true)
{
this->source = "m_ssl_gnutls.so";
}
CmdResult Handle (const std::vector<std::string> &parameters, User *user)
@ -69,8 +67,8 @@ class CommandStartTLS : public Command
if (!user->GetIOHook())
{
user->WriteNumeric(670, "%s :STARTTLS successful, go ahead with TLS handshake", user->nick.c_str());
user->AddIOHook(Caller);
Caller->OnRawSocketAccept(user->GetFd(), NULL, NULL);
user->AddIOHook(creator);
creator->OnRawSocketAccept(user->GetFd(), NULL, NULL);
}
else
user->WriteNumeric(691, "%s :STARTTLS failure", user->nick.c_str());

View File

@ -18,7 +18,7 @@
class AllowInvite : public SimpleChannelModeHandler
{
public:
AllowInvite(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'A') { }
AllowInvite(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'A') { }
};
class ModuleAllowInvite : public Module
@ -26,7 +26,7 @@ class ModuleAllowInvite : public Module
AllowInvite ni;
public:
ModuleAllowInvite(InspIRCd* Me) : Module(Me), ni(Me)
ModuleAllowInvite(InspIRCd* Me) : Module(Me), ni(Me, this)
{
if (!ServerInstance->Modes->AddMode(&ni))
throw ModuleException("Could not add new modes!");

View File

@ -18,9 +18,8 @@
class CommandAlltime : public Command
{
public:
CommandAlltime(InspIRCd *Instance) : Command(Instance, "ALLTIME", "o", 0)
CommandAlltime(InspIRCd *Instance, Module* Creator) : Command(Instance, Creator, "ALLTIME", "o", 0)
{
this->source = "m_alltime.so";
syntax.clear();
translation.push_back(TR_END);
}
@ -53,7 +52,7 @@ class Modulealltime : public Module
CommandAlltime mycommand;
public:
Modulealltime(InspIRCd *Me)
: Module(Me), mycommand(Me)
: Module(Me), mycommand(Me, this)
{
ServerInstance->AddCommand(&mycommand);
}

View File

@ -18,7 +18,7 @@
class AuditoriumMode : public ModeHandler
{
public:
AuditoriumMode(InspIRCd* Instance) : ModeHandler(Instance, 'u', 0, 0, false, MODETYPE_CHANNEL, false, 0, '@') { }
AuditoriumMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'u', 0, 0, false, MODETYPE_CHANNEL, false, 0, '@') { }
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
{
@ -42,7 +42,7 @@ class ModuleAuditorium : public Module
bool OperOverride;
public:
ModuleAuditorium(InspIRCd* Me)
: Module(Me), aum(Me)
: Module(Me), aum(Me, this)
{
if (!ServerInstance->Modes->AddMode(&aum))
throw ModuleException("Could not add new modes!");

View File

@ -31,7 +31,7 @@
class BanException : public ListModeBase
{
public:
BanException(InspIRCd* Instance) : ListModeBase(Instance, 'e', "End of Channel Exception List", 348, 349, true) { }
BanException(InspIRCd* Instance, Module* Creator) : ListModeBase(Instance, Creator, 'e', "End of Channel Exception List", 348, 349, true) { }
};
@ -40,7 +40,7 @@ class ModuleBanException : public Module
BanException be;
public:
ModuleBanException(InspIRCd* Me) : Module(Me), be(Me)
ModuleBanException(InspIRCd* Me) : Module(Me), be(Me, this)
{
if (!ServerInstance->Modes->AddMode(&be))
throw ModuleException("Could not add new modes!");

View File

@ -38,8 +38,7 @@ typedef std::deque<std::string> StringDeque;
class BanRedirect : public ModeWatcher
{
public:
BanRedirect(InspIRCd* Instance)
: ModeWatcher(Instance, 'b', MODETYPE_CHANNEL)
BanRedirect(InspIRCd* Instance) : ModeWatcher(Instance, 'b', MODETYPE_CHANNEL)
{
}

View File

@ -21,7 +21,7 @@
class BlockCaps : public SimpleChannelModeHandler
{
public:
BlockCaps(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'B') { }
BlockCaps(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'B') { }
};
class ModuleBlockCAPS : public Module
@ -32,7 +32,7 @@ class ModuleBlockCAPS : public Module
char capsmap[256];
public:
ModuleBlockCAPS(InspIRCd* Me) : Module(Me), bc(Me)
ModuleBlockCAPS(InspIRCd* Me) : Module(Me), bc(Me, this)
{
OnRehash(NULL);
if (!ServerInstance->Modes->AddMode(&bc))

View File

@ -20,7 +20,7 @@
class BlockColor : public SimpleChannelModeHandler
{
public:
BlockColor(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'c') { }
BlockColor(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'c') { }
};
class ModuleBlockColour : public Module
@ -29,7 +29,7 @@ class ModuleBlockColour : public Module
BlockColor bc;
public:
ModuleBlockColour(InspIRCd* Me) : Module(Me), bc(Me)
ModuleBlockColour(InspIRCd* Me) : Module(Me), bc(Me, this)
{
if (!ServerInstance->Modes->AddMode(&bc))
throw ModuleException("Could not add new modes!");

View File

@ -20,7 +20,7 @@
class BotMode : public SimpleUserModeHandler
{
public:
BotMode(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'B') { }
BotMode(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Instance, Creator, 'B') { }
};
class ModuleBotMode : public Module
@ -28,7 +28,7 @@ class ModuleBotMode : public Module
BotMode bm;
public:
ModuleBotMode(InspIRCd* Me)
: Module(Me), bm(Me)
: Module(Me), bm(Me, this)
{
if (!ServerInstance->Modes->AddMode(&bm))
throw ModuleException("Could not add new modes!");

View File

@ -127,17 +127,15 @@ void RemoveData(User* who)
class User_g : public SimpleUserModeHandler
{
public:
User_g(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'g') { }
User_g(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Instance, Creator, 'g') { }
};
class CommandAccept : public Command
{
private:
unsigned int& maxaccepts;
public:
CommandAccept(InspIRCd* Instance, unsigned int& max) : Command(Instance, "ACCEPT", 0, 1), maxaccepts(max)
unsigned int maxaccepts;
CommandAccept(InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "ACCEPT", 0, 1)
{
source = "m_callerid.so";
syntax = "{[+|-]<nicks>}|*}";
TRANSLATE2(TR_CUSTOM, TR_END);
}
@ -311,7 +309,6 @@ private:
User_g myumode;
// Configuration variables:
unsigned int maxaccepts; // Maximum ACCEPT entries.
bool operoverride; // Operators can override callerid.
bool tracknick; // Allow ACCEPT entries to update with nick changes.
unsigned int notify_cooldown; // Seconds between notifications.
@ -342,7 +339,7 @@ private:
}
public:
ModuleCallerID(InspIRCd* Me) : Module(Me), mycommand(Me, maxaccepts), myumode(Me)
ModuleCallerID(InspIRCd* Me) : Module(Me), mycommand(Me, this), myumode(Me, this)
{
OnRehash(NULL);
@ -466,7 +463,7 @@ public:
virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
maxaccepts = Conf.ReadInteger("callerid", "maxaccepts", "16", 0, true);
mycommand.maxaccepts = Conf.ReadInteger("callerid", "maxaccepts", "16", 0, true);
operoverride = Conf.ReadFlag("callerid", "operoverride", "0", 0);
tracknick = Conf.ReadFlag("callerid", "tracknick", "0", 0);
notify_cooldown = Conf.ReadInteger("callerid", "cooldown", "60", 0, true);

View File

@ -34,11 +34,9 @@ CAP END
*/
class CommandCAP : public Command
{
Module* Creator;
public:
CommandCAP (InspIRCd* Instance, Module* mod) : Command(Instance,"CAP", 0, 1, true), Creator(mod)
CommandCAP (InspIRCd* Instance, Module* mod) : Command(Instance, mod, "CAP", 0, 1, true)
{
this->source = "m_cap.so";
}
CmdResult Handle (const std::vector<std::string> &parameters, User *user)
@ -51,7 +49,7 @@ class CommandCAP : public Command
Data.type = subcommand;
Data.user = user;
Data.creator = this->Creator;
Data.creator = this->creator;
if (parameters.size() < 2)
return CMD_FAILURE;
@ -67,7 +65,7 @@ class CommandCAP : public Command
}
user->Extend("CAP_REGHOLD");
Event event((char*) &Data, (Module*)this->Creator, "cap_req");
Event event((char*) &Data, this->creator, "cap_req");
event.Send(this->ServerInstance);
if (Data.ack.size() > 0)
@ -92,10 +90,10 @@ class CommandCAP : public Command
Data.type = subcommand;
Data.user = user;
Data.creator = this->Creator;
Data.creator = this->creator;
user->Extend("CAP_REGHOLD");
Event event((char*) &Data, (Module*)this->Creator, subcommand == "LS" ? "cap_ls" : "cap_list");
Event event((char*) &Data, this->creator, subcommand == "LS" ? "cap_ls" : "cap_list");
event.Send(this->ServerInstance);
std::string Result;
@ -112,10 +110,10 @@ class CommandCAP : public Command
Data.type = subcommand;
Data.user = user;
Data.creator = this->Creator;
Data.creator = this->creator;
user->Extend("CAP_REGHOLD");
Event event((char*) &Data, (Module*)this->Creator, "cap_clear");
Event event((char*) &Data, this->creator, "cap_clear");
event.Send(this->ServerInstance);
std::string Result = irc::stringjoiner(" ", Data.ack, 0, Data.ack.size() - 1).GetJoined();

View File

@ -84,9 +84,8 @@ class CBanFactory : public XLineFactory
class CommandCBan : public Command
{
public:
CommandCBan(InspIRCd* Me) : Command(Me, "CBAN", "o", 1, 3)
CommandCBan(InspIRCd* Me, Module* Creator) : Command(Me, Creator, "CBAN", "o", 1, 3)
{
this->source = "m_cban.so";
this->syntax = "<channel> [<duration> :<reason>]";
TRANSLATE4(TR_TEXT,TR_TEXT,TR_TEXT,TR_END);
}
@ -162,7 +161,7 @@ class ModuleCBan : public Module
CBanFactory f;
public:
ModuleCBan(InspIRCd* Me) : Module(Me), mycommand(Me), f(Me)
ModuleCBan(InspIRCd* Me) : Module(Me), mycommand(Me, this), f(Me)
{
ServerInstance->XLines->RegisterFactory(&f);

View File

@ -26,7 +26,7 @@ typedef std::map<irc::string,irc::string> censor_t;
class CensorUser : public SimpleUserModeHandler
{
public:
CensorUser(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'G') { }
CensorUser(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Instance, Creator, 'G') { }
};
/** Handles channel mode +G
@ -34,7 +34,7 @@ class CensorUser : public SimpleUserModeHandler
class CensorChannel : public SimpleChannelModeHandler
{
public:
CensorChannel(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'G') { }
CensorChannel(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'G') { }
};
class ModuleCensor : public Module
@ -45,7 +45,7 @@ class ModuleCensor : public Module
public:
ModuleCensor(InspIRCd* Me)
: Module(Me), cu(Me), cc(Me)
: Module(Me), cu(Me, this), cc(Me, this)
{
/* Read the configuration file on startup.
*/

View File

@ -56,9 +56,9 @@ class CommandWebirc : public Command
bool notify;
public:
CGIHostlist Hosts;
CommandWebirc(InspIRCd* Instance, bool bnotify) : Command(Instance, "WEBIRC", 0, 4, true), notify(bnotify)
CommandWebirc(InspIRCd* Instance, Module* Creator, bool bnotify)
: Command(Instance, Creator, "WEBIRC", 0, 4, true), notify(bnotify)
{
this->source = "m_cgiirc.so";
this->syntax = "password client hostname ip";
}
CmdResult Handle(const std::vector<std::string> &parameters, User *user)
@ -138,7 +138,7 @@ class ModuleCgiIRC : public Module
CommandWebirc cmd;
bool NotifyOpers;
public:
ModuleCgiIRC(InspIRCd* Me) : Module(Me), cmd(Me, NotifyOpers)
ModuleCgiIRC(InspIRCd* Me) : Module(Me), cmd(Me, this, NotifyOpers)
{
OnRehash(NULL);
ServerInstance->AddCommand(&cmd);

View File

@ -25,7 +25,7 @@
class ChanFilter : public ListModeBase
{
public:
ChanFilter(InspIRCd* Instance) : ListModeBase(Instance, 'g', "End of channel spamfilter list", 941, 940, false, "chanfilter") { }
ChanFilter(InspIRCd* Instance, Module* Creator) : ListModeBase(Instance, Creator, 'g', "End of channel spamfilter list", 941, 940, false, "chanfilter") { }
virtual bool ValidateParam(User* user, Channel* chan, std::string &word)
{
@ -63,7 +63,7 @@ class ModuleChanFilter : public Module
public:
ModuleChanFilter(InspIRCd* Me)
: Module(Me), cf(Me)
: Module(Me), cf(Me, this)
{
if (!ServerInstance->Modes->AddMode(&cf))
throw ModuleException("Could not add new modes!");

View File

@ -156,8 +156,8 @@ class FounderProtectBase
class ChanFounder : public ModeHandler, public FounderProtectBase
{
public:
ChanFounder(InspIRCd* Instance, char my_prefix, bool &depriv_self, bool &depriv_others)
: ModeHandler(Instance, 'q', 1, 1, true, MODETYPE_CHANNEL, false, my_prefix, 0, TR_NICK),
ChanFounder(InspIRCd* Instance, Module* Creator, char my_prefix, bool &depriv_self, bool &depriv_others)
: ModeHandler(Instance, Creator, 'q', 1, 1, true, MODETYPE_CHANNEL, false, my_prefix, 0, TR_NICK),
FounderProtectBase(Instance, "cm_founder_", "founder", 386, 387, depriv_self, depriv_others) { }
unsigned int GetPrefixRank()
@ -232,8 +232,8 @@ class ChanFounder : public ModeHandler, public FounderProtectBase
class ChanProtect : public ModeHandler, public FounderProtectBase
{
public:
ChanProtect(InspIRCd* Instance, char my_prefix, bool &depriv_self, bool &depriv_others)
: ModeHandler(Instance, 'a', 1, 1, true, MODETYPE_CHANNEL, false, my_prefix, 0, TR_NICK),
ChanProtect(InspIRCd* Instance, Module* Creator, char my_prefix, bool &depriv_self, bool &depriv_others)
: ModeHandler(Instance, Creator, 'a', 1, 1, true, MODETYPE_CHANNEL, false, my_prefix, 0, TR_NICK),
FounderProtectBase(Instance,"cm_protect_","protected user", 388, 389, depriv_self, depriv_others) { }
unsigned int GetPrefixRank()
@ -328,8 +328,8 @@ class ModuleChanProtect : public Module
/* Initialise module variables */
cp = new ChanProtect(ServerInstance, APrefix, DeprivSelf, DeprivOthers);
cf = new ChanFounder(ServerInstance, QPrefix, DeprivSelf, DeprivOthers);
cp = new ChanProtect(ServerInstance, this, APrefix, DeprivSelf, DeprivOthers);
cf = new ChanFounder(ServerInstance, this, QPrefix, DeprivSelf, DeprivOthers);
if (!ServerInstance->Modes->AddMode(cp) || !ServerInstance->Modes->AddMode(cf))
{

View File

@ -19,12 +19,10 @@
*/
class CommandCheck : public Command
{
Module* Parent;
public:
std::set<std::string> meta_seen;
CommandCheck (InspIRCd* Instance, Module* parent) : Command(Instance,"CHECK", "o", 1), Parent(parent)
CommandCheck (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"CHECK", "o", 1)
{
this->source = "m_check.so";
syntax = "<nickname>|<ip>|<hostmask>|<channel>";
}
@ -114,7 +112,7 @@ class CommandCheck : public Command
ServerInstance->DumpText(user,checkstr + " onchans ", dump);
FOREACH_MOD_I(ServerInstance,I_OnSyncUser,OnSyncUser(targuser,Parent,(void*)user));
FOREACH_MOD_I(ServerInstance,I_OnSyncUser,OnSyncUser(targuser,creator,(void*)user));
dumpExtra(user, checkstr, targuser);
}
else if (targchan)
@ -148,7 +146,7 @@ class CommandCheck : public Command
user->WriteServ(checkstr + " member " + tmpbuf);
}
FOREACH_MOD_I(ServerInstance,I_OnSyncChannel,OnSyncChannel(targchan,Parent,(void*)user));
FOREACH_MOD_I(ServerInstance,I_OnSyncChannel,OnSyncChannel(targchan,creator,(void*)user));
dumpExtra(user, checkstr, targchan);
}
else

View File

@ -22,9 +22,8 @@ class CommandChghost : public Command
private:
char* hostmap;
public:
CommandChghost (InspIRCd* Instance, char* hmap) : Command(Instance,"CHGHOST","o",2), hostmap(hmap)
CommandChghost (InspIRCd* Instance, Module* Creator, char* hmap) : Command(Instance,Creator,"CHGHOST","o",2), hostmap(hmap)
{
this->source = "m_chghost.so";
syntax = "<nick> <newhost>";
TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
}
@ -85,7 +84,7 @@ class ModuleChgHost : public Module
char hostmap[256];
public:
ModuleChgHost(InspIRCd* Me)
: Module(Me), cmd(Me, hostmap)
: Module(Me), cmd(Me, this, hostmap)
{
OnRehash(NULL);
ServerInstance->AddCommand(&cmd);

View File

@ -20,9 +20,8 @@
class CommandChgident : public Command
{
public:
CommandChgident (InspIRCd* Instance) : Command(Instance,"CHGIDENT", "o", 2)
CommandChgident (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CHGIDENT", "o", 2)
{
this->source = "m_chgident.so";
syntax = "<nick> <newident>";
TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
}
@ -71,7 +70,7 @@ class ModuleChgIdent : public Module
CommandChgident cmd;
public:
ModuleChgIdent(InspIRCd* Me) : Module(Me), cmd(Me)
ModuleChgIdent(InspIRCd* Me) : Module(Me), cmd(Me, this)
{
ServerInstance->AddCommand(&cmd);
}

View File

@ -20,9 +20,8 @@
class CommandChgname : public Command
{
public:
CommandChgname (InspIRCd* Instance) : Command(Instance,"CHGNAME", "o", 2, 2)
CommandChgname (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CHGNAME", "o", 2, 2)
{
this->source = "m_chgname.so";
syntax = "<nick> <newname>";
TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
}
@ -66,7 +65,7 @@ class ModuleChgName : public Module
CommandChgname cmd;
public:
ModuleChgName(InspIRCd* Me) : Module(Me), cmd(Me)
ModuleChgName(InspIRCd* Me) : Module(Me), cmd(Me, this)
{
ServerInstance->AddCommand(&cmd);
}

View File

@ -28,7 +28,6 @@ class CloakUser : public ModeHandler
unsigned int key3;
unsigned int key4;
bool ipalways;
Module* Sender;
Module* HashProvider;
const char *xtab[4];
@ -63,7 +62,8 @@ class CloakUser : public ModeHandler
return host.substr(splitdot);
}
CloakUser(InspIRCd* Instance, Module* source, Module* Hash) : ModeHandler(Instance, 'x', 0, 0, false, MODETYPE_USER, false), Sender(source), HashProvider(Hash)
CloakUser(InspIRCd* Instance, Module* source, Module* Hash)
: ModeHandler(Instance, source, 'x', 0, 0, false, MODETYPE_USER, false), HashProvider(Hash)
{
}
@ -100,7 +100,7 @@ class CloakUser : public ModeHandler
if (!dest->GetExt("cloaked_host", cloak))
{
/* Force creation of missing cloak */
Sender->OnUserConnect(dest);
creator->OnUserConnect(dest);
}
if (dest->GetExt("cloaked_host", cloak))
{
@ -145,14 +145,14 @@ class CloakUser : public ModeHandler
octet[1] = octet[0] + "." + octet[1];
/* Reset the Hash module and send it our IV */
HashResetRequest(Sender, HashProvider).Send();
HashKeyRequest(Sender, HashProvider, iv).Send();
HashResetRequest(creator, HashProvider).Send();
HashKeyRequest(creator, HashProvider, iv).Send();
/* Send the Hash module a different hex table for each octet group's Hash sum */
for (int k = 0; k < 4; k++)
{
HashHexRequest(Sender, HashProvider, xtab[(iv[k]+i[k]) % 4]).Send();
ra[k] = std::string(HashSumRequest(Sender, HashProvider, octet[k]).Send()).substr(0,6);
HashHexRequest(creator, HashProvider, xtab[(iv[k]+i[k]) % 4]).Send();
ra[k] = std::string(HashSumRequest(creator, HashProvider, octet[k]).Send()).substr(0,6);
}
/* Stick them all together */
return std::string().append(ra[0]).append(".").append(ra[1]).append(".").append(ra[2]).append(".").append(ra[3]);
@ -166,8 +166,8 @@ class CloakUser : public ModeHandler
int rounds = 0;
/* Reset the Hash module and send it our IV */
HashResetRequest(Sender, HashProvider).Send();
HashKeyRequest(Sender, HashProvider, iv).Send();
HashResetRequest(creator, HashProvider).Send();
HashKeyRequest(creator, HashProvider, iv).Send();
for (const char* input = ip; *input; input++)
{
@ -175,8 +175,8 @@ class CloakUser : public ModeHandler
if (item.length() > 7)
{
/* Send the Hash module a different hex table for each octet group's Hash sum */
HashHexRequest(Sender, HashProvider, xtab[(key1+rounds) % 4]).Send();
hashies.push_back(std::string(HashSumRequest(Sender, HashProvider, item).Send()).substr(0,8));
HashHexRequest(creator, HashProvider, xtab[(key1+rounds) % 4]).Send();
hashies.push_back(std::string(HashSumRequest(creator, HashProvider, item).Send()).substr(0,8));
item.clear();
}
rounds++;
@ -184,8 +184,8 @@ class CloakUser : public ModeHandler
if (!item.empty())
{
/* Send the Hash module a different hex table for each octet group's Hash sum */
HashHexRequest(Sender, HashProvider, xtab[(key1+rounds) % 4]).Send();
hashies.push_back(std::string(HashSumRequest(Sender, HashProvider, item).Send()).substr(0,8));
HashHexRequest(creator, HashProvider, xtab[(key1+rounds) % 4]).Send();
hashies.push_back(std::string(HashSumRequest(creator, HashProvider, item).Send()).substr(0,8));
item.clear();
}
/* Stick them all together */

View File

@ -20,9 +20,8 @@
class CommandClones : public Command
{
public:
CommandClones (InspIRCd* Instance) : Command(Instance,"CLONES", "o", 1)
CommandClones (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CLONES", "o", 1)
{
this->source = "m_clones.so";
syntax = "<limit>";
}
@ -62,7 +61,7 @@ class ModuleClones : public Module
private:
CommandClones cmd;
public:
ModuleClones(InspIRCd* Me) : Module(Me), cmd(Me)
ModuleClones(InspIRCd* Me) : Module(Me), cmd(Me, this)
{
ServerInstance->AddCommand(&cmd);
}

View File

@ -29,9 +29,8 @@ class CommandClose : public Command
{
public:
/* Command 'close', needs operator */
CommandClose (InspIRCd* Instance) : Command(Instance,"CLOSE", "o", 0)
CommandClose (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CLOSE", "o", 0)
{
this->source = "m_close.so";
}
CmdResult Handle (const std::vector<std::string> &parameters, User *user)
@ -68,7 +67,7 @@ class ModuleClose : public Module
CommandClose cmd;
public:
ModuleClose(InspIRCd* Me)
: Module(Me), cmd(Me)
: Module(Me), cmd(Me, this)
{
ServerInstance->AddCommand(&cmd);
}

Some files were not shown because too many files have changed in this diff Show More