diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-26 14:13:13 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-26 14:13:13 +0000 |
commit | 6d03943426dcce76ba66567a9b18425a5ebb4c0c (patch) | |
tree | bedffa6d2a65a9ef556405224a6d7a181c8a1ba5 | |
parent | 810c662c9b55908101ca085293c52c3239ef22d1 (diff) |
Remove InspIRCd* parameters and fields
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11763 e03df62e-2008-0410-955e-edbf42e46eb7
286 files changed, 987 insertions, 1221 deletions
diff --git a/include/bancache.h b/include/bancache.h index 1d56decc1..c9c469e4f 100644 --- a/include/bancache.h +++ b/include/bancache.h @@ -23,8 +23,6 @@ */ class CoreExport BanCacheHit : public classbase { - private: - InspIRCd *ServerInstance; public: /** Type of cached ban */ @@ -39,9 +37,8 @@ class CoreExport BanCacheHit : public classbase */ time_t Expiry; - BanCacheHit(InspIRCd *Instance, const std::string &ip, const std::string &type, const std::string &reason) + BanCacheHit(const std::string &ip, const std::string &type, const std::string &reason) { - ServerInstance = Instance; this->Type = type; this->Reason = reason; this->IP = ip; @@ -49,9 +46,8 @@ class CoreExport BanCacheHit : public classbase } // overridden to allow custom time - BanCacheHit(InspIRCd *Instance, const std::string &ip, const std::string &type, const std::string &reason, time_t seconds) + BanCacheHit(const std::string &ip, const std::string &type, const std::string &reason, time_t seconds) { - ServerInstance = Instance; this->Type = type; this->Reason = reason; this->IP = ip; @@ -74,7 +70,6 @@ class CoreExport BanCacheManager : public classbase { private: BanCacheHash* BanHash; - InspIRCd* ServerInstance; public: /** Creates and adds a Ban Cache item. @@ -95,9 +90,8 @@ class CoreExport BanCacheManager : public classbase */ unsigned int RemoveEntries(const std::string &type, bool positive); - BanCacheManager(InspIRCd *Instance) + BanCacheManager() { - this->ServerInstance = Instance; this->BanHash = new BanCacheHash(); } ~BanCacheManager() diff --git a/include/caller.h b/include/caller.h index 5a27dc707..666035752 100644 --- a/include/caller.h +++ b/include/caller.h @@ -253,30 +253,30 @@ template <typename ReturnType, typename Param1, typename Param2, typename Param3 * parameters, to prevent mistakes. */ #define DEFINE_HANDLER0(NAME, RETURN) \ - class CoreExport NAME : public HandlerBase0<RETURN> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(); } + class CoreExport NAME : public HandlerBase0<RETURN> { public: NAME() { } virtual ~NAME() { } virtual RETURN Call(); } #define DEFINE_HANDLER1(NAME, RETURN, V1) \ - class CoreExport NAME : public HandlerBase1<RETURN, V1> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1); } + class CoreExport NAME : public HandlerBase1<RETURN, V1> { public: NAME() { } virtual ~NAME() { } virtual RETURN Call(V1); } #define DEFINE_HANDLER2(NAME, RETURN, V1, V2) \ - class CoreExport NAME : public HandlerBase2<RETURN, V1, V2> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2); } + class CoreExport NAME : public HandlerBase2<RETURN, V1, V2> { public: NAME() { } virtual ~NAME() { } virtual RETURN Call(V1, V2); } #define DEFINE_HANDLER3(NAME, RETURN, V1, V2, V3) \ - class CoreExport NAME : public HandlerBase3<RETURN, V1, V2, V3> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3); } + class CoreExport NAME : public HandlerBase3<RETURN, V1, V2, V3> { public: NAME() { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3); } #define DEFINE_HANDLER4(NAME, RETURN, V1, V2, V3, V4) \ - class CoreExport NAME : public HandlerBase4<RETURN, V1, V2, V3, V4> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4); } + class CoreExport NAME : public HandlerBase4<RETURN, V1, V2, V3, V4> { public: NAME() { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4); } #define DEFINE_HANDLER5(NAME, RETURN, V1, V2, V3, V4, V5) \ - class CoreExport NAME : public HandlerBase5<RETURN, V1, V2, V3, V4, V5> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4, V5); } + class CoreExport NAME : public HandlerBase5<RETURN, V1, V2, V3, V4, V5> { public: NAME() { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4, V5); } #define DEFINE_HANDLER6(NAME, RETURN, V1, V2, V3, V4, V5, V6) \ - class CoreExport NAME : public HandlerBase6<RETURN, V1, V2, V3, V4, V5, V6> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4, V5, V6); } + class CoreExport NAME : public HandlerBase6<RETURN, V1, V2, V3, V4, V5, V6> { public: NAME() { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4, V5, V6); } #define DEFINE_HANDLER7(NAME, RETURN, V1, V2, V3, V4, V5, V6, V7) \ - class CoreExport NAME : public HandlerBase7<RETURN, V1, V2, V3, V4, V5, V6, V7> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4, V5, V6, V7); } + class CoreExport NAME : public HandlerBase7<RETURN, V1, V2, V3, V4, V5, V6, V7> { public: NAME() { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4, V5, V6, V7); } #define DEFINE_HANDLER8(NAME, RETURN, V1, V2, V3, V4, V5, V6, V7, V8) \ - class CoreExport NAME : public HandlerBase8<RETURN, V1, V2, V3, V4, V5, V6, V7, V8> { InspIRCd* Server; public: NAME(InspIRCd* Srv) : Server(Srv) { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4, V5, V6, V7, V8); } + class CoreExport NAME : public HandlerBase8<RETURN, V1, V2, V3, V4, V5, V6, V7, V8> { public: NAME() { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4, V5, V6, V7, V8); } #endif diff --git a/include/channelmanager.h b/include/channelmanager.h index a4a56b632..94f119e63 100644 --- a/include/channelmanager.h +++ b/include/channelmanager.h @@ -20,12 +20,10 @@ */ class CoreExport ChannelManager { - private: - InspIRCd *ServerInstance; public: /** Constructor */ - ChannelManager(InspIRCd *Instance) : ServerInstance(Instance) + ChannelManager() { } }; diff --git a/include/channels.h b/include/channels.h index 416a34a50..ec09cbbca 100644 --- a/include/channels.h +++ b/include/channels.h @@ -83,7 +83,7 @@ class CoreExport Channel : public Extensible { /** Connect a Channel to a User */ - static Channel* ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const std::string &privs, bool bursting, bool created); + static Channel* ForceChan(Channel* Ptr, User* user, const std::string &privs, bool bursting, bool created); /** Set default modes for the channel on creation */ @@ -97,7 +97,7 @@ class CoreExport Channel : public Extensible /** Creates a channel record and initialises it with default values * @throw Nothing at present. */ - Channel(InspIRCd* Instance, const std::string &name, time_t ts); + Channel(const std::string &name, time_t ts); /** The channel's name. */ @@ -261,7 +261,7 @@ class CoreExport Channel : public Extensible * been created if the channel did not exist before the user was joined to it. * If the user could not be joined to a channel, the return value may be NULL. */ - static Channel* JoinUser(InspIRCd* ServerInstance, User *user, const char* cn, bool override, const char* key, bool bursting, time_t TS = 0); + static Channel* JoinUser(User *user, const char* cn, bool override, const char* key, bool bursting, time_t TS = 0); /** Write to a channel, from a user, using va_args for text * @param user User whos details to prefix the line with diff --git a/include/command_parse.h b/include/command_parse.h index 7ee0e8a07..10dbef58d 100644 --- a/include/command_parse.h +++ b/include/command_parse.h @@ -26,10 +26,6 @@ typedef std::map<std::string, void*> SharedObjectList; class CoreExport CommandParser : public classbase { private: - /** The creator of this class - */ - InspIRCd* ServerInstance; - /** Parameter buffer */ std::vector<std::string> para; @@ -61,7 +57,7 @@ class CoreExport CommandParser : public classbase /** Default constructor. * @param Instance The creator of this class */ - CommandParser(InspIRCd* Instance); + CommandParser(); /** Calls the handler for a given command. * @param commandname The command to find. This should be in uppercase. diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h index 5109ab54a..99d12cca4 100644 --- a/include/commands/cmd_whowas.h +++ b/include/commands/cmd_whowas.h @@ -126,11 +126,9 @@ class WhoWasGroup : public classbase class WhoWasMaintainTimer : public Timer { - private: - InspIRCd* ServerInstance; public: - WhoWasMaintainTimer(InspIRCd* Instance, long interval) - : Timer(interval, Instance->Time(), true), ServerInstance(Instance) + WhoWasMaintainTimer(long interval) + : Timer(interval, ServerInstance->Time(), true) { } virtual void Tick(time_t TIME); diff --git a/include/configreader.h b/include/configreader.h index 783af0942..28138edd6 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -19,7 +19,7 @@ /** Determines if a channel op is exempt from given mode m, * in config of server instance s. */ -#define CHANOPS_EXEMPT(s, m) (s->Config->ExemptChanOps[(unsigned char)m]) +#define CHANOPS_EXEMPT(m) (ServerInstance->Config->ExemptChanOps[(unsigned char)m]) #include <sstream> #include <string> @@ -122,10 +122,6 @@ class ServerLimits class CoreExport ServerConfig : public classbase { private: - /** Creator/owner pointer - */ - InspIRCd* ServerInstance; - /** This variable holds the names of all * files included from the main one. This * is used to make sure that no files are @@ -172,10 +168,6 @@ class CoreExport ServerConfig : public classbase /** Used to indicate who we announce invites to on a channel */ enum InviteAnnounceState { INVITE_ANNOUNCE_NONE, INVITE_ANNOUNCE_ALL, INVITE_ANNOUNCE_OPS, INVITE_ANNOUNCE_DYNAMIC }; - /** Returns the creator InspIRCd pointer - */ - InspIRCd* GetInstance(); - /** Not used any more as it is named, can probably be removed or renamed. */ int DoDownloads(); @@ -582,7 +574,7 @@ class CoreExport ServerConfig : public classbase /** Construct a new ServerConfig */ - ServerConfig(InspIRCd* Instance); + ServerConfig(); /** Get server ID as string with required leading zeroes */ diff --git a/include/dns.h b/include/dns.h index a780505d0..1bce4f11a 100644 --- a/include/dns.h +++ b/include/dns.h @@ -185,10 +185,6 @@ class CoreExport Resolver : public Extensible { protected: /** - * Pointer to creator - */ - InspIRCd* ServerInstance; - /** * Pointer to creator module (if any, or NULL) */ Module* Creator; @@ -255,7 +251,7 @@ class CoreExport Resolver : public Extensible * whilst lookups are in progress, they can be safely removed and your module will not * crash the server. */ - Resolver(InspIRCd* Instance, const std::string &source, QueryType qt, bool &cached, Module* creator = NULL); + Resolver(const std::string &source, QueryType qt, bool &cached, Module* creator = NULL); /** * The default destructor does nothing. @@ -313,11 +309,6 @@ class CoreExport DNS : public EventHandler private: /** - * Creator/Owner object - */ - InspIRCd* ServerInstance; - - /** * The maximum value of a dns request id, * 16 bits wide, 0xFFFF. */ @@ -447,7 +438,7 @@ class CoreExport DNS : public EventHandler * The constructor initialises the dns socket, * and clears the request lists. */ - DNS(InspIRCd* Instance); + DNS(); /** * Re-initialize the DNS subsystem. diff --git a/include/dynamic.h b/include/dynamic.h index 4b8c7a456..19ff7bdaf 100644 --- a/include/dynamic.h +++ b/include/dynamic.h @@ -27,11 +27,10 @@ class CoreExport DLLManager public: /** This constructor loads the module using dlopen() - * @param ServerInstance The creator class of this object * @param fname The filename to load. This should be within * the modules dir. */ - DLLManager(InspIRCd* ServerInstance, const char *fname); + DLLManager(const char *fname); virtual ~DLLManager(); /** Get a symbol using dynamic linking. @@ -102,16 +101,12 @@ template <typename ReturnType> class CoreExport DLLFactory : public DLLManager * The init_module function is the only exported extern "C" declaration * in any module file. In a cmd_*.cpp file the equivilant is init_command */ - typedef ReturnType * (initfunctype) (InspIRCd*); + typedef ReturnType * (initfunctype) (); /** Pointer to the init function. */ initfunctype* init_func; - /** Instance pointer to be passed to init_*() when it is called. - */ - InspIRCd* ServerInstance; - public: /** Default constructor. * This constructor passes its paramerers down through DLLFactoryBase and then DLLManager @@ -119,8 +114,8 @@ template <typename ReturnType> class CoreExport DLLFactory : public DLLManager * class. It is then down to the core to call the ModuleFactory::CreateModule() method and * receive a Module* which it can insert into its module lists. */ - DLLFactory(InspIRCd* Instance, const char *fname, const char *func_name) - : DLLManager(Instance, fname), init_func(NULL), ServerInstance(Instance) + DLLFactory(const char *fname, const char *func_name) + : DLLManager(fname), init_func(NULL) { const char* error = LastError(); @@ -144,7 +139,7 @@ template <typename ReturnType> class CoreExport DLLFactory : public DLLManager { if(init_func) { - return init_func(ServerInstance); + return init_func(); } else { diff --git a/include/fakeuser.h b/include/fakeuser.h index 60e645d65..a46971091 100644 --- a/include/fakeuser.h +++ b/include/fakeuser.h @@ -19,7 +19,7 @@ class CoreExport FakeUser : public User { public: - FakeUser(InspIRCd* Instance, const std::string &uid) : User(Instance, uid) + FakeUser(const std::string &uid) : User(uid) { SetFd(FD_FAKEUSER_NUMBER); } diff --git a/include/filelogger.h b/include/filelogger.h index 85005940d..fba103dd6 100644 --- a/include/filelogger.h +++ b/include/filelogger.h @@ -38,7 +38,7 @@ class CoreExport FileLogStream : public LogStream private: FileWriter *f; public: - FileLogStream(InspIRCd *Instance, int loglevel, FileWriter *fw); + FileLogStream(int loglevel, FileWriter *fw); virtual ~FileLogStream(); diff --git a/include/hashcomp.h b/include/hashcomp.h index c5d849529..6cbc14850 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -251,8 +251,6 @@ namespace irc class CoreExport modestacker : public classbase { private: - InspIRCd* ServerInstance; - /** The mode sequence and its parameters */ std::deque<std::string> sequence; @@ -268,7 +266,7 @@ namespace irc * @param add True if the stack is adding modes, * false if it is removing them */ - modestacker(InspIRCd* Instance, bool add); + modestacker(bool add); /** Push a modeletter and its parameter onto the stack. * No checking is performed as to if this mode actually diff --git a/include/inspircd.h b/include/inspircd.h index 4c3aba95b..a5e40102a 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -293,13 +293,12 @@ class BanCacheManager; */ class CoreExport ConfigReaderThread : public Thread { - InspIRCd* ServerInstance; ServerConfig* Config; bool done; public: std::string TheUserUID; - ConfigReaderThread(InspIRCd* Instance, const std::string &useruid) - : Thread(), ServerInstance(Instance), done(false), TheUserUID(useruid) + ConfigReaderThread(const std::string &useruid) + : Thread(), done(false), TheUserUID(useruid) { } @@ -927,7 +926,7 @@ class CommandModule : public Module { Cmd cmd; public: - CommandModule(InspIRCd*) : cmd(this) + CommandModule() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/include/logger.h b/include/logger.h index d6bd07498..37020a4ff 100644 --- a/include/logger.h +++ b/include/logger.h @@ -29,10 +29,6 @@ class CoreExport FileWriter : public EventHandler { protected: - /** The creator/owner of this object - */ - InspIRCd* ServerInstance; - /** The log file (fd is inside this somewhere, * we get it out with fileno()) */ @@ -45,7 +41,7 @@ class CoreExport FileWriter : public EventHandler public: /** The constructor takes an already opened logfile. */ - FileWriter(InspIRCd* Instance, FILE* logfile); + FileWriter(FILE* logfile); /** Handle pending write events. * This will flush any waiting data to disk. @@ -96,10 +92,9 @@ class CoreExport FileWriter : public EventHandler class CoreExport LogStream : public classbase { protected: - InspIRCd *ServerInstance; int loglvl; public: - LogStream(InspIRCd *Instance, int loglevel) : ServerInstance(Instance), loglvl(loglevel) + LogStream(int loglevel) : loglvl(loglevel) { } @@ -133,8 +128,6 @@ class CoreExport LogManager : public classbase */ LogStream* noforkstream; - InspIRCd *ServerInstance; - /** Map of active log types and what LogStreams will receive them. */ std::map<std::string, std::vector<LogStream *> > LogStreams; @@ -154,10 +147,9 @@ class CoreExport LogManager : public classbase public: - LogManager(InspIRCd *Instance) + LogManager() { noforkstream = NULL; - ServerInstance = Instance; Logging = false; } diff --git a/include/mode.h b/include/mode.h index c0cb5b0fc..e118a161b 100644 --- a/include/mode.h +++ b/include/mode.h @@ -348,7 +348,7 @@ class CoreExport SimpleUserModeHandler : public ModeHandler class CoreExport SimpleChannelModeHandler : public ModeHandler { public: - SimpleChannelModeHandler(InspIRCd* Instance, Module* Creator, char modeletter) + SimpleChannelModeHandler(Module* Creator, char modeletter) : ModeHandler(Creator, modeletter, PARAM_NONE, MODETYPE_CHANNEL) {} virtual ~SimpleChannelModeHandler() {} virtual ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); @@ -364,10 +364,6 @@ class CoreExport ModeWatcher : public classbase { protected: /** - * Creator/owner pointer - */ - InspIRCd* ServerInstance; - /** * The mode letter this class is watching */ char mode; @@ -380,7 +376,7 @@ class CoreExport ModeWatcher : public classbase /** * The constructor initializes the mode and the mode type */ - ModeWatcher(InspIRCd* Instance, char modeletter, ModeType type); + ModeWatcher(char modeletter, ModeType type); /** * The default destructor does nothing. */ @@ -474,7 +470,7 @@ class CoreExport ModeParser : public classbase /** The constructor initializes all the RFC basic modes by using ModeParserAddMode(). */ - ModeParser(InspIRCd* Instance); + ModeParser(); ~ModeParser(); /** Used to check if user 'd' should be allowed to do operation 'MASK' on channel 'chan'. diff --git a/include/modes/cmode_b.h b/include/modes/cmode_b.h index 3e4683840..0fdbaee3b 100644 --- a/include/modes/cmode_b.h +++ b/include/modes/cmode_b.h @@ -23,7 +23,7 @@ class ModeChannelBan : public ModeHandler private: BanItem b; public: - ModeChannelBan(InspIRCd* Instance); + ModeChannelBan(); ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); std::string& AddBan(User *user,std::string& dest,Channel *chan,int status); std::string& DelBan(User *user,std::string& dest,Channel *chan,int status); diff --git a/include/modes/cmode_h.h b/include/modes/cmode_h.h index dd188626c..aea56ba32 100644 --- a/include/modes/cmode_h.h +++ b/include/modes/cmode_h.h @@ -22,7 +22,7 @@ class ModeChannelHalfOp : public ModeHandler { private: public: - ModeChannelHalfOp(InspIRCd* Instance); + ModeChannelHalfOp(); ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter); unsigned int GetPrefixRank(); diff --git a/include/modes/cmode_i.h b/include/modes/cmode_i.h index 486ee0e1a..74495869a 100644 --- a/include/modes/cmode_i.h +++ b/include/modes/cmode_i.h @@ -20,6 +20,6 @@ class InspIRCd; class ModeChannelInviteOnly : public SimpleChannelModeHandler { public: - ModeChannelInviteOnly(InspIRCd* Instance); + ModeChannelInviteOnly(); }; diff --git a/include/modes/cmode_k.h b/include/modes/cmode_k.h index a84adff5f..bb3597923 100644 --- a/include/modes/cmode_k.h +++ b/include/modes/cmode_k.h @@ -20,7 +20,7 @@ class InspIRCd; class ModeChannelKey : public ModeHandler { public: - ModeChannelKey(InspIRCd* Instance); + ModeChannelKey(); ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter); void RemoveMode(Channel* channel, irc::modestacker* stack = NULL); diff --git a/include/modes/cmode_l.h b/include/modes/cmode_l.h index a2f1030a2..94313ec52 100644 --- a/include/modes/cmode_l.h +++ b/include/modes/cmode_l.h @@ -20,7 +20,7 @@ class InspIRCd; class ModeChannelLimit : public ModeHandler { public: - ModeChannelLimit(InspIRCd* Instance); + ModeChannelLimit(); ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter); bool CheckTimeStamp(std::string &their_param, const std::string &our_param, Channel* channel); diff --git a/include/modes/cmode_m.h b/include/modes/cmode_m.h index 6435b833b..c36e28355 100644 --- a/include/modes/cmode_m.h +++ b/include/modes/cmode_m.h @@ -20,5 +20,5 @@ class InspIRCd; class ModeChannelModerated : public SimpleChannelModeHandler { public: - ModeChannelModerated(InspIRCd* Instance); + ModeChannelModerated(); }; diff --git a/include/modes/cmode_n.h b/include/modes/cmode_n.h index 20a0631fc..70ccfdf9a 100644 --- a/include/modes/cmode_n.h +++ b/include/modes/cmode_n.h @@ -20,5 +20,5 @@ class InspIRCd; class ModeChannelNoExternal : public SimpleChannelModeHandler { public: - ModeChannelNoExternal(InspIRCd* Instance); + ModeChannelNoExternal(); }; diff --git a/include/modes/cmode_o.h b/include/modes/cmode_o.h index 60772eb5f..524d254ee 100644 --- a/include/modes/cmode_o.h +++ b/include/modes/cmode_o.h @@ -22,7 +22,7 @@ class ModeChannelOp : public ModeHandler { private: public: - ModeChannelOp(InspIRCd* Instance); + ModeChannelOp(); ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter); unsigned int GetPrefixRank(); diff --git a/include/modes/cmode_p.h b/include/modes/cmode_p.h index c00a9f1d3..64a4c0b3f 100644 --- a/include/modes/cmode_p.h +++ b/include/modes/cmode_p.h @@ -20,5 +20,5 @@ class InspIRCd; class ModeChannelPrivate : public SimpleChannelModeHandler { public: - ModeChannelPrivate(InspIRCd* Instance); + ModeChannelPrivate(); }; diff --git a/include/modes/cmode_s.h b/include/modes/cmode_s.h index 7d428c9a9..2f0337127 100644 --- a/include/modes/cmode_s.h +++ b/include/modes/cmode_s.h @@ -20,5 +20,5 @@ class InspIRCd; class ModeChannelSecret : public SimpleChannelModeHandler { public: - ModeChannelSecret(InspIRCd* Instance); + ModeChannelSecret(); }; diff --git a/include/modes/cmode_t.h b/include/modes/cmode_t.h index b7f87e614..6d0ce4777 100644 --- a/include/modes/cmode_t.h +++ b/include/modes/cmode_t.h @@ -20,6 +20,6 @@ class InspIRCd; class ModeChannelTopicOps : public ModeHandler { public: - ModeChannelTopicOps(InspIRCd* Instance); + ModeChannelTopicOps(); ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); }; diff --git a/include/modes/cmode_v.h b/include/modes/cmode_v.h index 26304d64d..77e8562f2 100644 --- a/include/modes/cmode_v.h +++ b/include/modes/cmode_v.h @@ -22,7 +22,7 @@ class ModeChannelVoice : public ModeHandler { private: public: - ModeChannelVoice(InspIRCd* Instance); + ModeChannelVoice(); ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter); unsigned int GetPrefixRank(); diff --git a/include/modes/umode_i.h b/include/modes/umode_i.h index 864547d51..58ec2d4ca 100644 --- a/include/modes/umode_i.h +++ b/include/modes/umode_i.h @@ -20,6 +20,6 @@ class InspIRCd; class ModeUserInvisible : public SimpleUserModeHandler { public: - ModeUserInvisible(InspIRCd* Instance); + ModeUserInvisible(); unsigned int GetCount(); }; diff --git a/include/modes/umode_o.h b/include/modes/umode_o.h index 9a3439ba7..a58c55670 100644 --- a/include/modes/umode_o.h +++ b/include/modes/umode_o.h @@ -20,7 +20,7 @@ class InspIRCd; class ModeUserOperator : public ModeHandler { public: - ModeUserOperator(InspIRCd* Instance); + ModeUserOperator(); ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); unsigned int GetCount(); }; diff --git a/include/modes/umode_s.h b/include/modes/umode_s.h index ac85050f8..d36c46deb 100644 --- a/include/modes/umode_s.h +++ b/include/modes/umode_s.h @@ -20,7 +20,7 @@ class InspIRCd; class ModeUserServerNoticeMask : public ModeHandler { public: - ModeUserServerNoticeMask(InspIRCd* Instance); + ModeUserServerNoticeMask(); ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); void OnParameterMissing(User* user, User* dest, Channel* channel); std::string GetUserParameter(User* user); diff --git a/include/modes/umode_w.h b/include/modes/umode_w.h index 566753ba0..ddda3db83 100644 --- a/include/modes/umode_w.h +++ b/include/modes/umode_w.h @@ -20,6 +20,6 @@ class InspIRCd; class ModeUserWallops : public SimpleUserModeHandler { public: - ModeUserWallops(InspIRCd* Instance); + ModeUserWallops(); unsigned int GetCount(); }; diff --git a/include/modules.h b/include/modules.h index 8ae1aa8e1..d4c549730 100644 --- a/include/modules.h +++ b/include/modules.h @@ -158,39 +158,15 @@ typedef std::map<std::string, std::pair<int, modulelist> > interfacelist; } while (0); /** - * This #define allows us to call a method in all - * loaded modules in a readable simple way and pass - * an instance pointer to the macro. e.g.: - * 'FOREACH_MOD_I(Instance, OnConnect, OnConnect(user));' - */ -#define FOREACH_MOD_I(z,y,x) do { \ - EventHandlerIter safei; \ - for (EventHandlerIter _i = z->Modules->EventHandlers[y].begin(); _i != z->Modules->EventHandlers[y].end(); ) \ - { \ - safei = _i; \ - ++safei; \ - try \ - { \ - (*_i)->x ; \ - } \ - catch (CoreException& modexcept) \ - { \ - z->Logs->Log("MODULE",DEFAULT,"Exception caught: %s",modexcept.GetReason()); \ - } \ - _i = safei; \ - } \ -} while (0); - -/** * Custom module result handling loop. This is a paired macro, and should only * be used with while_each_hook. * * See src/channels.cpp for an example of use. */ -#define DO_EACH_HOOK(z,n,v,args) \ +#define DO_EACH_HOOK(n,v,args) \ do { \ - EventHandlerIter iter_ ## n = z->Modules->EventHandlers[I_ ## n].begin(); \ - while (iter_ ## n != z->Modules->EventHandlers[I_ ## n].end()) \ + EventHandlerIter iter_ ## n = ServerInstance->Modules->EventHandlers[I_ ## n].begin(); \ + while (iter_ ## n != ServerInstance->Modules->EventHandlers[I_ ## n].end()) \ { \ Module* mod_ ## n = *iter_ ## n; \ iter_ ## n ++; \ @@ -198,11 +174,11 @@ do { \ { \ v = (mod_ ## n)->n args; -#define WHILE_EACH_HOOK(z,n) \ +#define WHILE_EACH_HOOK(n) \ } \ catch (CoreException& except_ ## n) \ { \ - z->Logs->Log("MODULE",DEFAULT,"Exception caught: %s", (except_ ## n).GetReason()); \ + ServerInstance->Logs->Log("MODULE",DEFAULT,"Exception caught: %s", (except_ ## n).GetReason()); \ (void) mod_ ## n; /* catch mismatched pairs */ \ } \ } \ @@ -213,16 +189,16 @@ do { \ * Runs the given hook until some module returns a useful result. * * Example: ModResult result; - * FIRST_MOD_RESULT(ServerInstance, OnUserPreNick, result, (user, newnick)) + * FIRST_MOD_RESULT(OnUserPreNick, result, (user, newnick)) */ -#define FIRST_MOD_RESULT(z,n,v,args) do { \ +#define FIRST_MOD_RESULT(n,v,args) do { \ v = MOD_RES_PASSTHRU; \ - DO_EACH_HOOK(z,n,v,args) \ + DO_EACH_HOOK(n,v,args) \ { \ if (v != MOD_RES_PASSTHRU) \ break; \ } \ - WHILE_EACH_HOOK(z,n); \ + WHILE_EACH_HOOK(n); \ } while (0) /** Represents a non-local user. @@ -387,7 +363,7 @@ class CoreExport Event : public ModuleMessage * The return result of an Event::Send() will always be NULL as * no replies are expected. */ - char* Send(InspIRCd* ServerInstance); + char* Send(); }; /** Priority types which can be returned from Module::Prioritize() @@ -437,7 +413,7 @@ class CoreExport Module : public Extensible * @param Me An instance of the InspIRCd class which will be saved into ServerInstance for your use * \exception ModuleException Throwing this class, or any class derived from ModuleException, causes loading of the module to abort. */ - Module(InspIRCd* Me = ServerInstance); + Module(); /** Default destructor. * destroys a module class @@ -1392,7 +1368,7 @@ class CoreExport ConfigReader : public classbase * This constructor initialises the ConfigReader class to read the inspircd.conf file * as specified when running ./configure. */ - ConfigReader(InspIRCd* Instance = ServerInstance); + ConfigReader(); /** Default destructor. * This method destroys the ConfigReader class. */ @@ -1491,14 +1467,14 @@ class CoreExport FileReader : public classbase * This method does not load any file into memory, you must use the LoadFile method * after constructing the class this way. */ - FileReader(InspIRCd* Instance = ServerInstance); + FileReader(); /** Secondary constructor. * This method initialises the class with a file loaded into it ready for GetLine and * and other methods to be called. If the file could not be loaded, FileReader::FileSize * returns 0. */ - FileReader(InspIRCd* Instance, const std::string &filename); + FileReader(const std::string &filename); /** Default destructor. * This deletes the memory allocated to the file. @@ -1827,9 +1803,9 @@ class CoreExport ModuleManager : public classbase #ifdef WINDOWS #define MODULE_INIT(y) \ - extern "C" DllExport Module * init_module(InspIRCd* Me) \ + extern "C" DllExport Module * init_module() \ { \ - return new y(Me); \ + return new y; \ } \ BOOLEAN WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) \ { \ @@ -1845,9 +1821,9 @@ class CoreExport ModuleManager : public classbase #else #define MODULE_INIT(y) \ - extern "C" DllExport Module * init_module(InspIRCd* Me) \ + extern "C" DllExport Module * init_module() \ { \ - return new y(Me); \ + return new y; \ } #endif diff --git a/include/protocol.h b/include/protocol.h index bd437c76f..a3afe9fb3 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -16,7 +16,6 @@ #include "hashcomp.h" -class InspIRCd; class User; typedef std::vector<std::string> parameterlist; @@ -36,10 +35,8 @@ typedef std::list<ProtoServer> ProtoServerList; class ProtocolInterface : public Extensible { - protected: - InspIRCd* ServerInstance; public: - ProtocolInterface(InspIRCd* Instance) : ServerInstance(Instance) { } + ProtocolInterface() { } virtual ~ProtocolInterface() { } /** Send an ENCAP message to one or more linked servers. diff --git a/include/snomasks.h b/include/snomasks.h index c35fc92b7..dddde1ff9 100644 --- a/include/snomasks.h +++ b/include/snomasks.h @@ -16,9 +16,6 @@ class Snomask : public Extensible { - private: - InspIRCd *ServerInstance; - public: char MySnomask; std::string Description; @@ -28,7 +25,7 @@ class Snomask : public Extensible /** Create a new Snomask */ - Snomask(InspIRCd* Instance, char snomask, const std::string &description) : ServerInstance(Instance), MySnomask(snomask), Description(description), LastMessage(""), Count(0) + Snomask(char snomask, const std::string &description) : MySnomask(snomask), Description(description), LastMessage(""), Count(0) { } @@ -52,10 +49,6 @@ typedef std::map<char, Snomask *> SnoList; class CoreExport SnomaskManager { private: - /** Creator/owner - */ - InspIRCd* ServerInstance; - /** Currently active snomask list */ SnoList SnoMasks; @@ -66,7 +59,7 @@ class CoreExport SnomaskManager public: /** Create a new SnomaskManager */ - SnomaskManager(InspIRCd* Instance); + SnomaskManager(); /** Delete SnomaskManager */ diff --git a/include/socket.h b/include/socket.h index af3eccea2..6e4bf9dbd 100644 --- a/include/socket.h +++ b/include/socket.h @@ -133,9 +133,6 @@ namespace irc class CoreExport ListenSocketBase : public EventHandler { protected: - /** The creator/owner of this object - */ - InspIRCd* ServerInstance; /** Socket description (shown in stats p) */ std::string desc; @@ -160,7 +157,7 @@ class CoreExport ListenSocketBase : public EventHandler public: /** Create a new listening socket */ - ListenSocketBase(InspIRCd* Instance, int port, const std::string &addr); + ListenSocketBase(int port, const std::string &addr); /** Handle an I/O event */ void HandleEvent(EventType et, int errornum = 0); @@ -200,7 +197,7 @@ class CoreExport ClientListenSocket : public ListenSocketBase { virtual void OnAcceptReady(int fd); public: - ClientListenSocket(InspIRCd* Instance, int port, const std::string &addr) : ListenSocketBase(Instance, port, addr) { } + ClientListenSocket(int port, const std::string &addr) : ListenSocketBase(port, addr) { } }; #endif diff --git a/include/testsuite.h b/include/testsuite.h index 384f1b438..89318e32f 100644 --- a/include/testsuite.h +++ b/include/testsuite.h @@ -14,14 +14,10 @@ #ifndef __TESTSUITE_H__ #define __TESTSUITE_H__ -class InspIRCd; - class TestSuite : public Extensible { - private: - InspIRCd* ServerInstance; public: - TestSuite(InspIRCd* Instance); + TestSuite(); ~TestSuite(); bool DoThreadTests(); diff --git a/include/threadengine.h b/include/threadengine.h index 10f3fed13..41e3fc686 100644 --- a/include/threadengine.h +++ b/include/threadengine.h @@ -134,7 +134,7 @@ class CoreExport SocketThread : public Thread */ void NotifyParent(); public: - SocketThread(InspIRCd* SI); + SocketThread(); virtual ~SocketThread(); /** Lock queue. */ diff --git a/include/threadengines/threadengine_pthread.h b/include/threadengines/threadengine_pthread.h index 79b00e629..4952ea3e8 100644 --- a/include/threadengines/threadengine_pthread.h +++ b/include/threadengines/threadengine_pthread.h @@ -18,7 +18,6 @@ #include "inspircd_config.h" #include "base.h" -class InspIRCd; class Thread; /** The ThreadEngine class has the responsibility of initialising @@ -38,7 +37,7 @@ class CoreExport ThreadEngine /** Constructor. * @param Instance Creator object */ - ThreadEngine(InspIRCd* Instance); + ThreadEngine(); /** Destructor */ diff --git a/include/threadengines/threadengine_win32.h b/include/threadengines/threadengine_win32.h index 64ad87ab8..a88a0c815 100644 --- a/include/threadengines/threadengine_win32.h +++ b/include/threadengines/threadengine_win32.h @@ -17,7 +17,6 @@ #include "inspircd_config.h" #include "base.h" -class InspIRCd; class Thread; /** The ThreadEngine class has the responsibility of initialising @@ -34,7 +33,7 @@ class CoreExport ThreadEngine { public: - ThreadEngine(InspIRCd* Instance); + ThreadEngine(); virtual ~ThreadEngine(); diff --git a/include/timer.h b/include/timer.h index 9c46b4f81..cc5364f67 100644 --- a/include/timer.h +++ b/include/timer.h @@ -14,8 +14,6 @@ #ifndef INSPIRCD_TIMER_H #define INSPIRCD_TIMER_H -//class InspIRCd; - /** Timer class for one-second resolution timers * Timer provides a facility which allows module * developers to create one-shot timers. The timer @@ -118,13 +116,10 @@ class CoreExport TimerManager */ std::vector<Timer *> Timers; - /** Creating server instance - */ - InspIRCd* ServerInstance; public: /** Constructor */ - TimerManager(InspIRCd* Instance); + TimerManager(); ~TimerManager(); /** Tick all pending Timers diff --git a/include/u_listmode.h b/include/u_listmode.h index 4b8ffe9e0..cb211c9be 100644 --- a/include/u_listmode.h +++ b/include/u_listmode.h @@ -16,10 +16,10 @@ /** Get the time as a string */ -inline std::string stringtime(InspIRCd* Instance) +inline std::string stringtime() { std::ostringstream TIME; - TIME << Instance->Time(); + TIME << ServerInstance->Time(); return TIME.str(); } @@ -141,7 +141,7 @@ class ListModeBase : public ModeHandler * @param autotidy Automatically tidy list entries on add * @param ctag Configuration tag to get limits from */ - ListModeBase(InspIRCd* Instance, Module* Creator, char modechar, const std::string &eolstr, unsigned int lnum, unsigned int eolnum, bool autotidy, const std::string &ctag = "banlist") + ListModeBase(Module* Creator, char modechar, const std::string &eolstr, unsigned int lnum, unsigned int eolnum, bool autotidy, const std::string &ctag = "banlist") : ModeHandler(Creator, modechar, PARAM_ALWAYS, MODETYPE_CHANNEL), listnumeric(lnum), endoflistnumeric(eolnum), endofliststring(eolstr), tidy(autotidy), configtag(ctag), extItem("listbase_mode_" + std::string(1, mode) + "_list", Creator) @@ -200,7 +200,7 @@ class ListModeBase : public ModeHandler modelist* el = extItem.get(channel); if (el) { - irc::modestacker modestack(ServerInstance, false); + irc::modestacker modestack(false); for (modelist::iterator it = el->begin(); it != el->end(); it++) { @@ -235,7 +235,7 @@ class ListModeBase : public ModeHandler */ virtual void DoRehash() { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; chanlimits.clear(); @@ -327,7 +327,7 @@ class ListModeBase : public ModeHandler ListItem e; e.mask = parameter; e.nick = source->nick; - e.time = stringtime(ServerInstance); + e.time = stringtime(); el->push_back(e); return MODEACTION_ALLOW; @@ -392,7 +392,7 @@ class ListModeBase : public ModeHandler virtual void DoSyncChannel(Channel* chan, Module* proto, void* opaque) { modelist* mlist = extItem.get(chan); - irc::modestacker modestack(ServerInstance, true); + irc::modestacker modestack(true); std::vector<std::string> stackresult; std::vector<TranslateType> types; types.push_back(TR_TEXT); diff --git a/include/usermanager.h b/include/usermanager.h index 72b10b224..93f0476e3 100644 --- a/include/usermanager.h +++ b/include/usermanager.h @@ -22,16 +22,10 @@ typedef std::map<irc::string, unsigned int> clonemap; class CoreExport UserManager : public Extensible { private: - InspIRCd *ServerInstance; - /** Map of local ip addresses for clone counting */ clonemap local_clones; public: - UserManager(InspIRCd *Instance) : ServerInstance(Instance) - { - } - ~UserManager() { for (user_hash::iterator i = clientlist->begin();i != clientlist->end();i++) @@ -80,7 +74,7 @@ class CoreExport UserManager : public Extensible * @param server The server IP address and port used by the user * @return This function has no return value, but a call to AddClient may remove the user. */ - void AddUser(InspIRCd* Instance, int socket, ClientListenSocket* via, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server); + void AddUser(int socket, ClientListenSocket* via, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server); /** Disconnect a user gracefully * @param user The user to remove diff --git a/include/users.h b/include/users.h index 7ec35535f..763d45c57 100644 --- a/include/users.h +++ b/include/users.h @@ -470,7 +470,7 @@ class CoreExport User : public StreamSocket * @param Instance Creator instance * @param uid User UUID, or empty to allocate one automatically */ - User(InspIRCd* Instance, const std::string &uid = ""); + User(const std::string &uid = ""); /** Check if the user matches a G or K line, and disconnect them if they do. * @param doZline True if ZLines should be checked (if IP has changed since initial connect) @@ -880,7 +880,7 @@ class CoreExport UserResolver : public Resolver * @param qt The query type * @param cache Modified by the constructor if the result was cached */ - UserResolver(InspIRCd* Instance, User* user, std::string to_resolve, QueryType qt, bool &cache); + UserResolver(User* user, std::string to_resolve, QueryType qt, bool &cache); /** Called on successful lookup * @param result Result string diff --git a/include/xline.h b/include/xline.h index e2915e024..7ac4aa7f1 100644 --- a/include/xline.h +++ b/include/xline.h @@ -29,9 +29,6 @@ class CoreExport XLine : public classbase { protected: - /** Creator */ - InspIRCd* ServerInstance; - /** Default 'apply' action. Quits the user. * @param u User to apply the line against * @param line The line typed, used for display purposes in the quit message @@ -48,8 +45,8 @@ class CoreExport XLine : public classbase * @param re The reason of the xline * @param t The line type, should be set by the derived class constructor */ - XLine(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, const std::string &t) - : ServerInstance(Instance), set_time(s_time), duration(d), source(src), reason(re), type(t) + XLine(time_t s_time, long d, std::string src, std::string re, const std::string &t) + : set_time(s_time), duration(d), source(src), reason(re), type(t) { expiry = set_time + duration; } @@ -156,8 +153,8 @@ class CoreExport KLine : public XLine * @param ident Ident to match * @param host Host to match */ - KLine(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string ident, std::string host) - : XLine(Instance, s_time, d, src, re, "K"), identmask(ident), hostmask(host) + KLine(time_t s_time, long d, std::string src, std::string re, std::string ident, std::string host) + : XLine(s_time, d, src, re, "K"), identmask(ident), hostmask(host) { matchtext = this->identmask; matchtext.append("@").append(this->hostmask); @@ -204,8 +201,8 @@ class CoreExport GLine : public XLine * @param ident Ident to match * @param host Host to match */ - GLine(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string ident, std::string host) - : XLine(Instance, s_time, d, src, re, "G"), identmask(ident), hostmask(host) + GLine(time_t s_time, long d, std::string src, std::string re, std::string ident, std::string host) + : XLine(s_time, d, src, re, "G"), identmask(ident), hostmask(host) { matchtext = this->identmask; matchtext.append("@").append(this->hostmask); @@ -250,8 +247,8 @@ class CoreExport ELine : public XLine * @param ident Ident to match * @param host Host to match */ - ELine(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string ident, std::string host) - : XLine(Instance, s_time, d, src, re, "E"), identmask(ident), hostmask(host) + ELine(time_t s_time, long d, std::string src, std::string re, std::string ident, std::string host) + : XLine(s_time, d, src, re, "E"), identmask(ident), hostmask(host) { matchtext = this->identmask; matchtext.append("@").append(this->hostmask); @@ -295,8 +292,8 @@ class CoreExport ZLine : public XLine * @param re The reason of the xline * @param ip IP to match */ - ZLine(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string ip) - : XLine(Instance, s_time, d, src, re, "Z"), ipaddr(ip) + ZLine(time_t s_time, long d, std::string src, std::string re, std::string ip) + : XLine(s_time, d, src, re, "Z"), ipaddr(ip) { } @@ -333,8 +330,8 @@ class CoreExport QLine : public XLine * @param re The reason of the xline * @param nickname Nickname to match */ - QLine(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string nickname) - : XLine(Instance, s_time, d, src, re, "Q"), nick(nickname) + QLine(time_t s_time, long d, std::string src, std::string re, std::string nickname) + : XLine(s_time, d, src, re, "Q"), nick(nickname) { } @@ -373,7 +370,6 @@ class CoreExport XLineFactory : public classbase { protected: - InspIRCd* ServerInstance; std::string type; public: @@ -382,7 +378,7 @@ class CoreExport XLineFactory : public classbase * @param Instance creator * @param t Type of XLine this factory generates */ - XLineFactory(InspIRCd* Instance, const std::string &t) : ServerInstance(Instance), type(t) { } + XLineFactory(const std::string &t) : type(t) { } /** Return the type of XLine this factory generates * @return The type of XLine this factory generates @@ -409,7 +405,6 @@ class CoreExport XLineFactory : public classbase /* Required forward declarations */ class ServerConfig; -class InspIRCd; class GLineFactory; class ELineFactory; @@ -444,10 +439,6 @@ typedef XLineLookup::iterator LookupIter; class CoreExport XLineManager : public classbase { protected: - /** The owner/creator of this class - */ - InspIRCd* ServerInstance; - /** Used to hold XLines which have not yet been applied. */ std::vector<XLine *> pending_lines; @@ -478,7 +469,7 @@ class CoreExport XLineManager : public classbase /** Constructor * @param Instance A pointer to the creator object */ - XLineManager(InspIRCd* Instance); + XLineManager(); /** Destructor */ @@ -591,14 +582,14 @@ class CoreExport XLineManager : public classbase class CoreExport GLineFactory : public XLineFactory { public: - GLineFactory(InspIRCd* Instance) : XLineFactory(Instance, "G") { } + GLineFactory() : XLineFactory("G") { } /** Generate a GLine */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask); - return new GLine(ServerInstance, set_time, duration, source, reason, ih.first, ih.second); + return new GLine(set_time, duration, source, reason, ih.first, ih.second); } }; @@ -607,14 +598,14 @@ class CoreExport GLineFactory : public XLineFactory class CoreExport ELineFactory : public XLineFactory { public: - ELineFactory(InspIRCd* Instance) : XLineFactory(Instance, "E") { } + ELineFactory() : XLineFactory("E") { } /** Generate an ELine */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask); - return new ELine(ServerInstance, set_time, duration, source, reason, ih.first, ih.second); + return new ELine(set_time, duration, source, reason, ih.first, ih.second); } }; @@ -623,14 +614,14 @@ class CoreExport ELineFactory : public XLineFactory class CoreExport KLineFactory : public XLineFactory { public: - KLineFactory(InspIRCd* Instance) : XLineFactory(Instance, "K") { } + KLineFactory() : XLineFactory("K") { } /** Generate a KLine */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask); - return new KLine(ServerInstance, set_time, duration, source, reason, ih.first, ih.second); + return new KLine(set_time, duration, source, reason, ih.first, ih.second); } }; @@ -639,13 +630,13 @@ class CoreExport KLineFactory : public XLineFactory class CoreExport QLineFactory : public XLineFactory { public: - QLineFactory(InspIRCd* Instance) : XLineFactory(Instance, "Q") { } + QLineFactory() : XLineFactory("Q") { } /** Generate a QLine */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { - return new QLine(ServerInstance, set_time, duration, source, reason, xline_specific_mask); + return new QLine(set_time, duration, source, reason, xline_specific_mask); } }; @@ -654,13 +645,13 @@ class CoreExport QLineFactory : public XLineFactory class CoreExport ZLineFactory : public XLineFactory { public: - ZLineFactory(InspIRCd* Instance) : XLineFactory(Instance, "Z") { } + ZLineFactory() : XLineFactory("Z") { } /** Generate a ZLine */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { - return new ZLine(ServerInstance, set_time, duration, source, reason, xline_specific_mask); + return new ZLine(set_time, duration, source, reason, xline_specific_mask); } }; diff --git a/src/bancache.cpp b/src/bancache.cpp index 524baaad2..0ca2d693f 100644 --- a/src/bancache.cpp +++ b/src/bancache.cpp @@ -23,7 +23,7 @@ BanCacheHit *BanCacheManager::AddHit(const std::string &ip, const std::string &t if (this->BanHash->find(ip) != this->BanHash->end()) // can't have two cache entries on the same IP, sorry.. return NULL; - b = new BanCacheHit(ServerInstance, ip, type, reason); + b = new BanCacheHit(ip, type, reason); this->BanHash->insert(std::make_pair(ip, b)); return b; @@ -36,7 +36,7 @@ BanCacheHit *BanCacheManager::AddHit(const std::string &ip, const std::string &t if (this->BanHash->find(ip) != this->BanHash->end()) // can't have two cache entries on the same IP, sorry.. return NULL; - b = new BanCacheHit(ServerInstance, ip, type, reason, seconds); + b = new BanCacheHit(ip, type, reason, seconds); this->BanHash->insert(std::make_pair(ip, b)); return b; diff --git a/src/channels.cpp b/src/channels.cpp index c60ec2890..1375ffa30 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -17,10 +17,10 @@ #include <cstdarg> #include "mode.h" -Channel::Channel(InspIRCd* Instance, const std::string &cname, time_t ts) +Channel::Channel(const std::string &cname, time_t ts) { chan_hash::iterator findchan = ServerInstance->chanlist->find(cname); - if (findchan != Instance->chanlist->end()) + if (findchan != ServerInstance->chanlist->end()) throw CoreException("Cannot create duplicate channel " + cname); (*(ServerInstance->chanlist))[cname.c_str()] = this; @@ -70,7 +70,7 @@ int Channel::SetTopic(User *u, std::string &ntopic, bool forceset) ModResult res; /* 0: check status, 1: don't, -1: disallow change silently */ - FIRST_MOD_RESULT(ServerInstance, OnPreTopicChange, res, (u,this,ntopic)); + FIRST_MOD_RESULT(OnPreTopicChange, res, (u,this,ntopic)); if (res == MOD_RES_DENY) return CMD_FAILURE; @@ -184,7 +184,7 @@ void Channel::SetDefaultModes() * add a channel to a user, creating the record for it if needed and linking * it to the user record */ -Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool override, const char* key, bool bursting, time_t TS) +Channel* Channel::JoinUser(User *user, const char* cn, bool override, const char* key, bool bursting, time_t TS) { // Fix: unregistered users could be joined using /SAJOIN if (!user || !cn || user->registered != REG_ALL) @@ -207,7 +207,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool { if (user->HasPrivPermission("channels/high-join-limit")) { - if (user->chans.size() >= Instance->Config->OperMaxChans) + if (user->chans.size() >= ServerInstance->Config->OperMaxChans) { user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cn); return NULL; @@ -224,8 +224,8 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool } } - strlcpy(cname, cn, Instance->Config->Limits.ChanMax); - Ptr = Instance->FindChan(cname); + strlcpy(cname, cn, ServerInstance->Config->Limits.ChanMax); + Ptr = ServerInstance->FindChan(cname); bool created_by_local = false; if (!Ptr) @@ -236,7 +236,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool if (!IS_LOCAL(user)) { if (!TS) - Instance->Logs->Log("CHANNEL",DEBUG,"*** BUG *** Channel::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick.c_str(), cn); + ServerInstance->Logs->Log("CHANNEL",DEBUG,"*** BUG *** Channel::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick.c_str(), cn); } else { @@ -247,12 +247,12 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool if (IS_LOCAL(user) && override == false) { ModResult MOD_RESULT; - FIRST_MOD_RESULT(Instance, OnUserPreJoin, MOD_RESULT, (user, NULL, cname, privs, key ? key : "")); + FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (user, NULL, cname, privs, key ? key : "")); if (MOD_RESULT == MOD_RES_DENY) return NULL; } - Ptr = new Channel(Instance, cname, TS); + Ptr = new Channel(cname, TS); } else { @@ -267,7 +267,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool if (IS_LOCAL(user) && override == false) { ModResult MOD_RESULT; - FIRST_MOD_RESULT(Instance, OnUserPreJoin, MOD_RESULT, (user, Ptr, cname, privs, key ? key : "")); + FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (user, Ptr, cname, privs, key ? key : "")); if (MOD_RESULT == MOD_RES_DENY) { return NULL; @@ -276,11 +276,11 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool { std::string ckey = Ptr->GetModeParameter('k'); bool invited = user->IsInvited(Ptr->name.c_str()); - bool can_bypass = Instance->Config->InvBypassModes && invited; + bool can_bypass = ServerInstance->Config->InvBypassModes && invited; if (!ckey.empty()) { - FIRST_MOD_RESULT(Instance, OnCheckKey, MOD_RESULT, (user, Ptr, key ? key : "")); + FIRST_MOD_RESULT(OnCheckKey, MOD_RESULT, (user, Ptr, key ? key : "")); if (!MOD_RESULT.check((key && ckey == key) || can_bypass)) { // If no key provided, or key is not the right one, and can't bypass +k (not invited or option not enabled) @@ -291,7 +291,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool if (Ptr->IsModeSet('i')) { - FIRST_MOD_RESULT(Instance, OnCheckInvite, MOD_RESULT, (user, Ptr)); + FIRST_MOD_RESULT(OnCheckInvite, MOD_RESULT, (user, Ptr)); if (!MOD_RESULT.check(invited)) { user->WriteNumeric(ERR_INVITEONLYCHAN, "%s %s :Cannot join channel (Invite only)",user->nick.c_str(), Ptr->name.c_str()); @@ -302,7 +302,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool std::string limit = Ptr->GetModeParameter('l'); if (!limit.empty()) { - FIRST_MOD_RESULT(Instance, OnCheckLimit, MOD_RESULT, (user, Ptr)); + FIRST_MOD_RESULT(OnCheckLimit, MOD_RESULT, (user, Ptr)); if (!MOD_RESULT.check((Ptr->GetUserCounter() < atol(limit.c_str()) || can_bypass))) { user->WriteNumeric(ERR_CHANNELISFULL, "%s %s :Cannot join channel (Channel is full)",user->nick.c_str(), Ptr->name.c_str()); @@ -334,10 +334,10 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool Ptr->SetDefaultModes(); } - return Channel::ForceChan(Instance, Ptr, user, privs, bursting, created_by_local); + return Channel::ForceChan(Ptr, user, privs, bursting, created_by_local); } -Channel* Channel::ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const std::string &privs, bool bursting, bool created) +Channel* Channel::ForceChan(Channel* Ptr, User* user, const std::string &privs, bool bursting, bool created) { std::string nick = user->nick; @@ -347,22 +347,22 @@ Channel* Channel::ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const for (std::string::const_iterator x = privs.begin(); x != privs.end(); x++) { const char status = *x; - ModeHandler* mh = Instance->Modes->FindMode(status, MODETYPE_CHANNEL); + ModeHandler* mh = ServerInstance->Modes->FindMode(status, MODETYPE_CHANNEL); if (mh) { /* Set, and make sure that the mode handler knows this mode was now set */ Ptr->SetPrefix(user, mh->GetModeChar(), true); - mh->OnModeChange(Instance->FakeClient, Instance->FakeClient, Ptr, nick, true); + mh->OnModeChange(ServerInstance->FakeClient, ServerInstance->FakeClient, Ptr, nick, true); } } CUList except_list; - FOREACH_MOD_I(Instance,I_OnUserJoin,OnUserJoin(memb, bursting, created, except_list)); + FOREACH_MOD(I_OnUserJoin,OnUserJoin(memb, bursting, created, except_list)); Ptr->WriteAllExcept(user, false, 0, except_list, "JOIN :%s", Ptr->name.c_str()); /* Theyre not the first ones in here, make sure everyone else sees the modes we gave the user */ - std::string ms = Instance->Modes->ModeString(user, Ptr); + std::string ms = ServerInstance->Modes->ModeString(user, Ptr); if ((Ptr->GetUserCounter() > 1) && (ms.length())) Ptr->WriteAllExceptSender(user, true, 0, "MODE %s +%s", Ptr->name.c_str(), ms.c_str()); @@ -376,14 +376,14 @@ Channel* Channel::ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const } Ptr->UserList(user); } - FOREACH_MOD_I(Instance,I_OnPostJoin,OnPostJoin(memb)); + FOREACH_MOD(I_OnPostJoin,OnPostJoin(memb)); return Ptr; } bool Channel::IsBanned(User* user) { ModResult result; - FIRST_MOD_RESULT(ServerInstance, OnCheckChannelBan, result, (user, this)); + FIRST_MOD_RESULT(OnCheckChannelBan, result, (user, this)); if (result != MOD_RES_PASSTHRU) return (result == MOD_RES_DENY); @@ -399,7 +399,7 @@ bool Channel::IsBanned(User* user) bool Channel::CheckBan(User* user, const std::string& mask) { ModResult result; - FIRST_MOD_RESULT(ServerInstance, OnCheckBan, result, (user, this, mask)); + FIRST_MOD_RESULT(OnCheckBan, result, (user, this, mask)); if (result != MOD_RES_PASSTHRU) return (result == MOD_RES_DENY); @@ -428,7 +428,7 @@ bool Channel::CheckBan(User* user, const std::string& mask) ModResult Channel::GetExtBanStatus(User *user, char type) { ModResult rv; - FIRST_MOD_RESULT(ServerInstance, OnExtBanCheck, rv, (user, this, type)); + FIRST_MOD_RESULT(OnExtBanCheck, rv, (user, this, type)); if (rv != MOD_RES_PASSTHRU) return rv; for (BanList::iterator i = this->bans.begin(); i != this->bans.end(); i++) @@ -472,7 +472,7 @@ long Channel::PartUser(User *user, std::string &reason) if (iter != ServerInstance->chanlist->end()) { ModResult res; - FIRST_MOD_RESULT(ServerInstance, OnChannelPreDelete, res, (this)); + FIRST_MOD_RESULT(OnChannelPreDelete, res, (this)); if (res == MOD_RES_DENY) return 1; // delete halted by module FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(this)); @@ -516,7 +516,7 @@ long Channel::KickUser(User *src, User *user, const char* reason) if (ServerInstance->ULine(src->server)) res = MOD_RES_ALLOW; else - FIRST_MOD_RESULT(ServerInstance, OnUserPreKick, res, (src,memb,reason)); + FIRST_MOD_RESULT(OnUserPreKick, res, (src,memb,reason)); if (res == MOD_RES_DENY) return this->GetUserCounter(); @@ -553,7 +553,7 @@ long Channel::KickUser(User *src, User *user, const char* reason) if (iter != ServerInstance->chanlist->end()) { ModResult res; - FIRST_MOD_RESULT(ServerInstance, OnChannelPreDelete, res, (this)); + FIRST_MOD_RESULT(OnChannelPreDelete, res, (this)); if (res == MOD_RES_DENY) return 1; // delete halted by module FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(this)); @@ -783,7 +783,7 @@ void Channel::UserList(User *user) if (!IS_LOCAL(user)) return; - FIRST_MOD_RESULT(ServerInstance, OnUserList, call_modules, (user, this)); + FIRST_MOD_RESULT(OnUserList, call_modules, (user, this)); if (call_modules != MOD_RES_ALLOW) { diff --git a/src/command_parse.cpp b/src/command_parse.cpp index cbf6a1005..c8ca7d59e 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -29,7 +29,7 @@ int InspIRCd::PassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype) { ModResult res; - FIRST_MOD_RESULT(this, OnPassCompare, res, (ex, data, input, hashtype)); + FIRST_MOD_RESULT(OnPassCompare, res, (ex, data, input, hashtype)); /* Module matched */ if (res == MOD_RES_ALLOW) @@ -262,7 +262,7 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) if (cm == cmdlist.end()) { ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnPreCommand, MOD_RESULT, (command, command_p, user, false, cmd)); + FIRST_MOD_RESULT(OnPreCommand, MOD_RESULT, (command, command_p, user, false, cmd)); if (MOD_RESULT == MOD_RES_DENY) return true; @@ -325,7 +325,7 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) * truncate to max_params if necessary. -- w00t */ ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnPreCommand, MOD_RESULT, (command, command_p, user, false, cmd)); + FIRST_MOD_RESULT(OnPreCommand, MOD_RESULT, (command, command_p, user, false, cmd)); if (MOD_RESULT == MOD_RES_DENY) return true; @@ -382,7 +382,7 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) cm->second->total_bytes += cmd.length(); /* module calls too */ - FIRST_MOD_RESULT(ServerInstance, OnPreCommand, MOD_RESULT, (command, command_p, user, true, cmd)); + FIRST_MOD_RESULT(OnPreCommand, MOD_RESULT, (command, command_p, user, true, cmd)); if (MOD_RESULT == MOD_RES_DENY) return do_more; @@ -437,7 +437,7 @@ bool CommandParser::CreateCommand(Command *f) return false; } -CommandParser::CommandParser(InspIRCd* Instance) : ServerInstance(Instance) +CommandParser::CommandParser() { para.resize(128); } diff --git a/src/commands/cmd_away.cpp b/src/commands/cmd_away.cpp index d93f74559..b0d432f29 100644 --- a/src/commands/cmd_away.cpp +++ b/src/commands/cmd_away.cpp @@ -52,7 +52,7 @@ CmdResult CommandAway::Handle (const std::vector<std::string>& parameters, User if ((parameters.size()) && (!parameters[0].empty())) { - FIRST_MOD_RESULT(ServerInstance, OnSetAway, MOD_RESULT, (user, parameters[0])); + FIRST_MOD_RESULT(OnSetAway, MOD_RESULT, (user, parameters[0])); if (MOD_RESULT == MOD_RES_DENY && IS_LOCAL(user)) return CMD_FAILURE; @@ -64,7 +64,7 @@ CmdResult CommandAway::Handle (const std::vector<std::string>& parameters, User } else { - FIRST_MOD_RESULT(ServerInstance, OnSetAway, MOD_RESULT, (user, "")); + FIRST_MOD_RESULT(OnSetAway, MOD_RESULT, (user, "")); if (MOD_RESULT == MOD_RES_DENY && IS_LOCAL(user)) return CMD_FAILURE; diff --git a/src/commands/cmd_eline.cpp b/src/commands/cmd_eline.cpp index 7845fa2f1..6ea3df7c5 100644 --- a/src/commands/cmd_eline.cpp +++ b/src/commands/cmd_eline.cpp @@ -87,7 +87,7 @@ CmdResult CommandEline::Handle (const std::vector<std::string>& parameters, User long duration = ServerInstance->Duration(parameters[1].c_str()); - ELine* el = new ELine(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ih.first.c_str(), ih.second.c_str()); + ELine* el = new ELine(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ih.first.c_str(), ih.second.c_str()); if (ServerInstance->XLines->AddLine(el, user)) { if (!duration) diff --git a/src/commands/cmd_gline.cpp b/src/commands/cmd_gline.cpp index ad3067428..ea2850f6f 100644 --- a/src/commands/cmd_gline.cpp +++ b/src/commands/cmd_gline.cpp @@ -70,7 +70,7 @@ CmdResult CommandGline::Handle (const std::vector<std::string>& parameters, User } long duration = ServerInstance->Duration(parameters[1].c_str()); - GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ih.first.c_str(), ih.second.c_str()); + GLine* gl = new GLine(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ih.first.c_str(), ih.second.c_str()); if (ServerInstance->XLines->AddLine(gl, user)) { if (!duration) diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp index 89437e252..9da6096a4 100644 --- a/src/commands/cmd_invite.cpp +++ b/src/commands/cmd_invite.cpp @@ -70,7 +70,7 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use return CMD_FAILURE; } - FIRST_MOD_RESULT(ServerInstance, OnUserPreInvite, MOD_RESULT, (user,u,c,timeout)); + FIRST_MOD_RESULT(OnUserPreInvite, MOD_RESULT, (user,u,c,timeout)); if (MOD_RESULT == MOD_RES_DENY) { diff --git a/src/commands/cmd_join.cpp b/src/commands/cmd_join.cpp index 73cae4746..806823f76 100644 --- a/src/commands/cmd_join.cpp +++ b/src/commands/cmd_join.cpp @@ -55,7 +55,7 @@ CmdResult CommandJoin::Handle (const std::vector<std::string>& parameters, User if (ServerInstance->IsChannel(parameters[0].c_str(), ServerInstance->Config->Limits.ChanMax)) { - Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), false, parameters[1].c_str(), false); + Channel::JoinUser(user, parameters[0].c_str(), false, parameters[1].c_str(), false); return CMD_SUCCESS; } } @@ -66,7 +66,7 @@ CmdResult CommandJoin::Handle (const std::vector<std::string>& parameters, User if (ServerInstance->IsChannel(parameters[0].c_str(), ServerInstance->Config->Limits.ChanMax)) { - Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), false, "", false); + Channel::JoinUser(user, parameters[0].c_str(), false, "", false); return CMD_SUCCESS; } } diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp index 1001d4c8a..88db2764d 100644 --- a/src/commands/cmd_kill.cpp +++ b/src/commands/cmd_kill.cpp @@ -60,7 +60,7 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User * Moved this event inside the IS_LOCAL check also, we don't want half the network killing a user * and the other half not. This would be a bad thing. ;p -- w00t */ - FIRST_MOD_RESULT(ServerInstance, OnKill, MOD_RESULT, (user, u, parameters[1])); + FIRST_MOD_RESULT(OnKill, MOD_RESULT, (user, u, parameters[1])); if (MOD_RESULT == MOD_RES_DENY) return CMD_FAILURE; diff --git a/src/commands/cmd_kline.cpp b/src/commands/cmd_kline.cpp index 3ec2461b4..9184a3505 100644 --- a/src/commands/cmd_kline.cpp +++ b/src/commands/cmd_kline.cpp @@ -70,7 +70,7 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User } long duration = ServerInstance->Duration(parameters[1].c_str()); - KLine* kl = new KLine(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ih.first.c_str(), ih.second.c_str()); + KLine* kl = new KLine(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ih.first.c_str(), ih.second.c_str()); if (ServerInstance->XLines->AddLine(kl,user)) { if (!duration) diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp index 99b8348ab..bdaff8723 100644 --- a/src/commands/cmd_nick.cpp +++ b/src/commands/cmd_nick.cpp @@ -84,7 +84,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User */ oldnick.assign(user->nick, 0, IS_LOCAL(user) ? ServerInstance->Config->Limits.NickMax : MAXBUF); ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnUserPreNick, MOD_RESULT, (user,parameters[0])); + FIRST_MOD_RESULT(OnUserPreNick, MOD_RESULT, (user,parameters[0])); if (MOD_RESULT == MOD_RES_DENY) return CMD_FAILURE; if (user->registered == REG_ALL) @@ -165,7 +165,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnUserPreNick, MOD_RESULT, (user, parameters[0])); + FIRST_MOD_RESULT(OnUserPreNick, MOD_RESULT, (user, parameters[0])); if (MOD_RESULT == MOD_RES_DENY) // if a module returns true, the nick change is silently forbidden. return CMD_FAILURE; @@ -191,7 +191,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User if (user->registered == REG_NICKUSER) { /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */ - FIRST_MOD_RESULT(ServerInstance, OnUserRegister, MOD_RESULT, (user)); + FIRST_MOD_RESULT(OnUserRegister, MOD_RESULT, (user)); if (MOD_RESULT == MOD_RES_DENY) return CMD_FAILURE; diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp index ced17072f..a14473643 100644 --- a/src/commands/cmd_notice.cpp +++ b/src/commands/cmd_notice.cpp @@ -51,7 +51,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use ModResult MOD_RESULT; std::string temp = parameters[1]; - FIRST_MOD_RESULT(ServerInstance, OnUserPreNotice, MOD_RESULT, (user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, exempt_list)); + FIRST_MOD_RESULT(OnUserPreNotice, MOD_RESULT, (user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, exempt_list)); if (MOD_RESULT == MOD_RES_DENY) return CMD_FAILURE; const char* text = temp.c_str(); @@ -97,7 +97,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use ModResult MOD_RESULT; std::string temp = parameters[1]; - FIRST_MOD_RESULT(ServerInstance, OnUserPreNotice, MOD_RESULT, (user,chan,TYPE_CHANNEL,temp,status, exempt_list)); + FIRST_MOD_RESULT(OnUserPreNotice, MOD_RESULT, (user,chan,TYPE_CHANNEL,temp,status, exempt_list)); if (MOD_RESULT == MOD_RES_DENY) return CMD_FAILURE; @@ -173,7 +173,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use ModResult MOD_RESULT; std::string temp = parameters[1]; - FIRST_MOD_RESULT(ServerInstance, OnUserPreNotice, MOD_RESULT, (user,dest,TYPE_USER,temp,0,exempt_list)); + FIRST_MOD_RESULT(OnUserPreNotice, MOD_RESULT, (user,dest,TYPE_USER,temp,0,exempt_list)); if (MOD_RESULT == MOD_RES_DENY) { return CMD_FAILURE; } diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp index 781ad8bac..0eacfd0bc 100644 --- a/src/commands/cmd_privmsg.cpp +++ b/src/commands/cmd_privmsg.cpp @@ -51,7 +51,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us ModResult MOD_RESULT; std::string temp = parameters[1]; - FIRST_MOD_RESULT(ServerInstance, OnUserPreMessage, MOD_RESULT, (user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, except_list)); + FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, except_list)); if (MOD_RESULT == MOD_RES_DENY) return CMD_FAILURE; @@ -108,7 +108,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us ModResult MOD_RESULT; std::string temp = parameters[1]; - FIRST_MOD_RESULT(ServerInstance, OnUserPreMessage, MOD_RESULT, (user,chan,TYPE_CHANNEL,temp,status,except_list)); + FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user,chan,TYPE_CHANNEL,temp,status,except_list)); if (MOD_RESULT == MOD_RES_DENY) return CMD_FAILURE; @@ -192,7 +192,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us ModResult MOD_RESULT; std::string temp = parameters[1]; - FIRST_MOD_RESULT(ServerInstance, OnUserPreMessage, MOD_RESULT, (user, dest, TYPE_USER, temp, 0, except_list)); + FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, dest, TYPE_USER, temp, 0, except_list)); if (MOD_RESULT == MOD_RES_DENY) return CMD_FAILURE; diff --git a/src/commands/cmd_qline.cpp b/src/commands/cmd_qline.cpp index ffe8c5ee6..762fd53c4 100644 --- a/src/commands/cmd_qline.cpp +++ b/src/commands/cmd_qline.cpp @@ -45,7 +45,7 @@ CmdResult CommandQline::Handle (const std::vector<std::string>& parameters, User } long duration = ServerInstance->Duration(parameters[1].c_str()); - QLine* ql = new QLine(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str()); + QLine* ql = new QLine(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str()); if (ServerInstance->XLines->AddLine(ql,user)) { if (!duration) diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp index b2a9fbde4..5d5caa32a 100644 --- a/src/commands/cmd_rehash.cpp +++ b/src/commands/cmd_rehash.cpp @@ -85,7 +85,7 @@ CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, Use FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect()); - ServerInstance->ConfigThread = new ConfigReaderThread(ServerInstance, user->uuid); + ServerInstance->ConfigThread = new ConfigReaderThread(user->uuid); ServerInstance->Threads->Start(ServerInstance->ConfigThread); return CMD_SUCCESS; diff --git a/src/commands/cmd_user.cpp b/src/commands/cmd_user.cpp index e2f81f33c..e396e0c84 100644 --- a/src/commands/cmd_user.cpp +++ b/src/commands/cmd_user.cpp @@ -71,7 +71,7 @@ CmdResult CommandUser::Handle (const std::vector<std::string>& parameters, User ModResult MOD_RESULT; /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */ - FIRST_MOD_RESULT(ServerInstance, OnUserRegister, MOD_RESULT, (user)); + FIRST_MOD_RESULT(OnUserRegister, MOD_RESULT, (user)); if (MOD_RESULT == MOD_RES_DENY) return CMD_FAILURE; diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp index 78a7e7544..4a9ac9499 100644 --- a/src/commands/cmd_whowas.cpp +++ b/src/commands/cmd_whowas.cpp @@ -20,7 +20,7 @@ CommandWhowas::CommandWhowas( Module* parent) : Command(parent, "WHOWAS", 1) { syntax = "<nick>{,<nick>}"; Penalty = 2; - timer = new WhoWasMaintainTimer(ServerInstance, 3600); + timer = new WhoWasMaintainTimer(3600); ServerInstance->Timers->AddTimer(timer); } @@ -309,7 +309,7 @@ class ModuleWhoWas : public Module { CommandWhowas cmd; public: - ModuleWhoWas(InspIRCd *Me) : Module(Me), cmd(this) + ModuleWhoWas() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/commands/cmd_zline.cpp b/src/commands/cmd_zline.cpp index e2cca7649..d37300974 100644 --- a/src/commands/cmd_zline.cpp +++ b/src/commands/cmd_zline.cpp @@ -66,7 +66,7 @@ CmdResult CommandZline::Handle (const std::vector<std::string>& parameters, User long duration = ServerInstance->Duration(parameters[1].c_str()); - ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ipaddr); + ZLine* zl = new ZLine(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ipaddr); if (ServerInstance->XLines->AddLine(zl,user)) { if (!duration) diff --git a/src/configreader.cpp b/src/configreader.cpp index 159ca598f..3fb60034d 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -32,7 +32,7 @@ #include "commands/cmd_whowas.h" #include "modes/cmode_h.h" -ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance) +ServerConfig::ServerConfig() { *sid = *ServerName = *Network = *ServerDesc = *AdminName = '\0'; *HideWhoisServer = *AdminEmail = *AdminNick = *diepass = *restartpass = *FixedQuit = *HideKillsServer = '\0'; @@ -45,7 +45,7 @@ ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance) dns_timeout = DieDelay = 5; MaxTargets = 20; NetBufferSize = 10240; - SoftLimit = Instance->SE->GetMaxFds(); + SoftLimit = ServerInstance->SE->GetMaxFds(); MaxConn = SOMAXCONN; MaxWhoResults = 0; debugging = 0; @@ -199,7 +199,7 @@ static bool ValidateMaxTargets(ServerConfig* conf, const char*, const char*, Val { if ((data.GetInteger() < 1) || (data.GetInteger() > 31)) { - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <security:maxtargets> value is greater than 31 or less than 1, set to 20."); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"WARNING: <security:maxtargets> value is greater than 31 or less than 1, set to 20."); data.Set(20); } return true; @@ -207,10 +207,10 @@ static bool ValidateMaxTargets(ServerConfig* conf, const char*, const char*, Val static bool ValidateSoftLimit(ServerConfig* conf, const char*, const char*, ValueItem &data) { - if ((data.GetInteger() < 1) || (data.GetInteger() > conf->GetInstance()->SE->GetMaxFds())) + if ((data.GetInteger() < 1) || (data.GetInteger() > ServerInstance->SE->GetMaxFds())) { - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <performance:softlimit> value is greater than %d or less than 0, set to %d.",conf->GetInstance()->SE->GetMaxFds(),conf->GetInstance()->SE->GetMaxFds()); - data.Set(conf->GetInstance()->SE->GetMaxFds()); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"WARNING: <performance:softlimit> value is greater than %d or less than 0, set to %d.",ServerInstance->SE->GetMaxFds(),ServerInstance->SE->GetMaxFds()); + data.Set(ServerInstance->SE->GetMaxFds()); } return true; } @@ -218,7 +218,7 @@ static bool ValidateSoftLimit(ServerConfig* conf, const char*, const char*, Valu static bool ValidateMaxConn(ServerConfig* conf, const char*, const char*, ValueItem &data) { if (data.GetInteger() > SOMAXCONN) - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <performance:somaxconn> value may be higher than the system-defined SOMAXCONN value!"); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"WARNING: <performance:somaxconn> value may be higher than the system-defined SOMAXCONN value!"); return true; } @@ -275,7 +275,7 @@ static bool ValidateDnsServer(ServerConfig* conf, const char*, const char*, Valu { std::string nameserver; // attempt to look up their nameserver from /etc/resolv.conf - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf..."); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf..."); std::ifstream resolv("/etc/resolv.conf"); bool found_server = false; @@ -288,19 +288,19 @@ static bool ValidateDnsServer(ServerConfig* conf, const char*, const char*, Valu resolv >> nameserver; data.Set(nameserver.c_str()); found_server = true; - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"<dns:server> set to '%s' as first resolver in /etc/resolv.conf.",nameserver.c_str()); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"<dns:server> set to '%s' as first resolver in /etc/resolv.conf.",nameserver.c_str()); } } if (!found_server) { - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!"); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!"); data.Set("127.0.0.1"); } } else { - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"/etc/resolv.conf can't be opened! Defaulting to nameserver '127.0.0.1'!"); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"/etc/resolv.conf can't be opened! Defaulting to nameserver '127.0.0.1'!"); data.Set("127.0.0.1"); } } @@ -310,11 +310,11 @@ static bool ValidateDnsServer(ServerConfig* conf, const char*, const char*, Valu static bool ValidateServerName(ServerConfig* conf, const char*, const char*, ValueItem &data) { - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"Validating server name"); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"Validating server name"); /* If we already have a servername, and they changed it, we should throw an exception. */ if (!strchr(data.GetString(), '.')) { - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <server:name> '%s' is not a fully-qualified domain name. Changed to '%s.'", + ServerInstance->Logs->Log("CONFIG",DEFAULT,"WARNING: <server:name> '%s' is not a fully-qualified domain name. Changed to '%s.'", data.GetString(),data.GetString()); std::string moo = data.GetValue(); data.Set(moo.append(".")); @@ -328,7 +328,7 @@ static bool ValidateNetBufferSize(ServerConfig* conf, const char*, const char*, // 65534 not 65535 because of null terminator if ((!data.GetInteger()) || (data.GetInteger() > 65534) || (data.GetInteger() < 1024)) { - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"No NetBufferSize specified or size out of range, setting to default of 10240."); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"No NetBufferSize specified or size out of range, setting to default of 10240."); data.Set(10240); } return true; @@ -338,7 +338,7 @@ static bool ValidateMaxWho(ServerConfig* conf, const char*, const char*, ValueIt { if ((data.GetInteger() > 65535) || (data.GetInteger() < 1)) { - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"<performance:maxwho> size out of range, setting to default of 128."); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"<performance:maxwho> size out of range, setting to default of 128."); data.Set(128); } return true; @@ -346,14 +346,14 @@ static bool ValidateMaxWho(ServerConfig* conf, const char*, const char*, ValueIt static bool ValidateHalfOp(ServerConfig* conf, const char*, const char*, ValueItem &data) { - ModeHandler* mh = conf->GetInstance()->Modes->FindMode('h', MODETYPE_CHANNEL); + ModeHandler* mh = ServerInstance->Modes->FindMode('h', MODETYPE_CHANNEL); if (data.GetBool() && !mh) { - conf->GetInstance()->Logs->Log("CONFIG", DEFAULT, "Enabling halfop mode."); - mh = new ModeChannelHalfOp(conf->GetInstance()); - conf->GetInstance()->Modes->AddMode(mh); + ServerInstance->Logs->Log("CONFIG", DEFAULT, "Enabling halfop mode."); + mh = new ModeChannelHalfOp; + ServerInstance->Modes->AddMode(mh); } else if (!data.GetBool() && mh) { - conf->GetInstance()->Logs->Log("CONFIG", DEFAULT, "Disabling halfop mode."); - conf->GetInstance()->Modes->DelMode(mh); + ServerInstance->Logs->Log("CONFIG", DEFAULT, "Disabling halfop mode."); + ServerInstance->Modes->DelMode(mh); delete mh; } return true; @@ -412,11 +412,11 @@ static bool ValidateInvite(ServerConfig* conf, const char*, const char*, ValueIt static bool ValidateSID(ServerConfig* conf, const char*, const char*, ValueItem &data) { - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"Validating server id"); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"Validating server id"); const char *sid = data.GetString(); - if (*sid && !conf->GetInstance()->IsSID(sid)) + if (*sid && !ServerInstance->IsSID(sid)) { throw CoreException(std::string(sid) + " is not a valid server ID. A server ID must be 3 characters long, with the first character a digit and the next two characters a digit or letter."); } @@ -428,7 +428,7 @@ static bool ValidateSID(ServerConfig* conf, const char*, const char*, ValueItem static bool ValidateWhoWas(ServerConfig* conf, const char*, const char*, ValueItem &data) { - conf->WhoWasMaxKeep = conf->GetInstance()->Duration(data.GetString()); + conf->WhoWasMaxKeep = ServerInstance->Duration(data.GetString()); if (conf->WhoWasGroupSize < 0) conf->WhoWasGroupSize = 0; @@ -439,10 +439,10 @@ static bool ValidateWhoWas(ServerConfig* conf, const char*, const char*, ValueIt if (conf->WhoWasMaxKeep < 3600) { conf->WhoWasMaxKeep = 3600; - conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <whowas:maxkeep> value less than 3600, setting to default 3600"); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"WARNING: <whowas:maxkeep> value less than 3600, setting to default 3600"); } - Module* whowas = conf->GetInstance()->Modules->Find("cmd_whowas.so"); + Module* whowas = ServerInstance->Modules->Find("cmd_whowas.so"); if (whowas) { WhowasRequest(NULL, whowas, WhowasRequest::WHOWAS_PRUNE).Send(); @@ -476,8 +476,8 @@ static bool DoZLine(ServerConfig* conf, const char* tag, const char** entries, V const char* reason = values[0].GetString(); const char* ipmask = values[1].GetString(); - ZLine* zl = new ZLine(conf->GetInstance(), conf->GetInstance()->Time(), 0, "<Config>", reason, ipmask); - if (!conf->GetInstance()->XLines->AddLine(zl, NULL)) + ZLine* zl = new ZLine(ServerInstance->Time(), 0, "<Config>", reason, ipmask); + if (!ServerInstance->XLines->AddLine(zl, NULL)) delete zl; return true; @@ -488,8 +488,8 @@ static bool DoQLine(ServerConfig* conf, const char* tag, const char** entries, V const char* reason = values[0].GetString(); const char* nick = values[1].GetString(); - QLine* ql = new QLine(conf->GetInstance(), conf->GetInstance()->Time(), 0, "<Config>", reason, nick); - if (!conf->GetInstance()->XLines->AddLine(ql, NULL)) + QLine* ql = new QLine(ServerInstance->Time(), 0, "<Config>", reason, nick); + if (!ServerInstance->XLines->AddLine(ql, NULL)) delete ql; return true; @@ -500,11 +500,11 @@ static bool DoKLine(ServerConfig* conf, const char* tag, const char** entries, V const char* reason = values[0].GetString(); const char* host = values[1].GetString(); - XLineManager* xlm = conf->GetInstance()->XLines; + XLineManager* xlm = ServerInstance->XLines; IdentHostPair ih = xlm->IdentSplit(host); - KLine* kl = new KLine(conf->GetInstance(), conf->GetInstance()->Time(), 0, "<Config>", reason, ih.first.c_str(), ih.second.c_str()); + KLine* kl = new KLine(ServerInstance->Time(), 0, "<Config>", reason, ih.first.c_str(), ih.second.c_str()); if (!xlm->AddLine(kl, NULL)) delete kl; return true; @@ -515,11 +515,11 @@ static bool DoELine(ServerConfig* conf, const char* tag, const char** entries, V const char* reason = values[0].GetString(); const char* host = values[1].GetString(); - XLineManager* xlm = conf->GetInstance()->XLines; + XLineManager* xlm = ServerInstance->XLines; IdentHostPair ih = xlm->IdentSplit(host); - ELine* el = new ELine(conf->GetInstance(), conf->GetInstance()->Time(), 0, "<Config>", reason, ih.first.c_str(), ih.second.c_str()); + ELine* el = new ELine(ServerInstance->Time(), 0, "<Config>", reason, ih.first.c_str(), ih.second.c_str()); if (!xlm->AddLine(el, NULL)) delete el; return true; @@ -2012,11 +2012,6 @@ std::string ServerConfig::GetFullProgDir() return "/"; } -InspIRCd* ServerConfig::GetInstance() -{ - return ServerInstance; -} - std::string ServerConfig::GetSID() { return sid; @@ -2068,7 +2063,7 @@ bool ValueItem::GetBool() void ConfigReaderThread::Run() { - Config = new ServerConfig(ServerInstance); + Config = new ServerConfig; Config->Read(); done = true; } @@ -2097,7 +2092,7 @@ void ConfigReaderThread::Finish() ServerInstance->ResetMaxBans(); Config->ApplyDisabledCommands(Config->DisabledCommands); User* user = TheUserUID.empty() ? ServerInstance->FindNick(TheUserUID) : NULL; - FOREACH_MOD_I(ServerInstance, I_OnRehash, OnRehash(user)); + FOREACH_MOD(I_OnRehash, OnRehash(user)); ServerInstance->BuildISupport(); delete old; diff --git a/src/dns.cpp b/src/dns.cpp index 3356700ef..a28881ad2 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -96,9 +96,8 @@ class DNSRequest DNS* dnsobj; /* DNS caller (where we get our FD from) */ unsigned long ttl; /* Time to live */ std::string orig; /* Original requested name/ip */ - InspIRCd* ServerInstance; - DNSRequest(InspIRCd* Instance, DNS* dns, int id, const std::string &original); + DNSRequest(DNS* dns, int id, const std::string &original); ~DNSRequest(); DNSInfo ResultIsReady(DNSHeader &h, int length); int SendRequests(const DNSHeader *header, const int length, QueryType qt); @@ -107,11 +106,10 @@ class DNSRequest class CacheTimer : public Timer { private: - InspIRCd* ServerInstance; DNS* dns; public: - CacheTimer(InspIRCd* Instance, DNS* thisdns) - : Timer(3600, Instance->Time(), true), ServerInstance(Instance), dns(thisdns) { } + CacheTimer(DNS* thisdns) + : Timer(3600, ServerInstance->Time(), true), dns(thisdns) { } virtual void Tick(time_t) { @@ -121,11 +119,10 @@ class CacheTimer : public Timer class RequestTimeout : public Timer { - InspIRCd* ServerInstance; DNSRequest* watch; int watchid; public: - RequestTimeout(unsigned long n, InspIRCd* SI, DNSRequest* watching, int id) : Timer(n, SI->Time()), ServerInstance(SI), watch(watching), watchid(id) + RequestTimeout(unsigned long n, DNSRequest* watching, int id) : Timer(n, ServerInstance->Time()), watch(watching), watchid(id) { } ~RequestTimeout() @@ -152,13 +149,13 @@ class RequestTimeout : public Timer }; /* Allocate the processing buffer */ -DNSRequest::DNSRequest(InspIRCd* Instance, DNS* dns, int rid, const std::string &original) : dnsobj(dns), ServerInstance(Instance) +DNSRequest::DNSRequest(DNS* dns, int rid, const std::string &original) : dnsobj(dns) { res = new unsigned char[512]; *res = 0; orig = original; - RequestTimeout* RT = new RequestTimeout(Instance->Config->dns_timeout ? Instance->Config->dns_timeout : 5, Instance, this, rid); - Instance->Timers->AddTimer(RT); /* The timer manager frees this */ + RequestTimeout* RT = new RequestTimeout(ServerInstance->Config->dns_timeout ? ServerInstance->Config->dns_timeout : 5, this, rid); + ServerInstance->Timers->AddTimer(RT); /* The timer manager frees this */ } /* Deallocate the processing buffer */ @@ -259,7 +256,7 @@ DNSRequest* DNS::AddQuery(DNSHeader *header, int &id, const char* original) while (requests[id]) id = this->PRNG() & DNS::MAX_REQUEST_ID; - DNSRequest* req = new DNSRequest(ServerInstance, this, id, original); + DNSRequest* req = new DNSRequest(this, id, original); header->id[0] = req->id[0] = id >> 8; header->id[1] = req->id[1] = id & 0xFF; @@ -386,7 +383,7 @@ void DNS::Rehash() } /** Initialise the DNS UDP socket so that we can send requests */ -DNS::DNS(InspIRCd* Instance) : ServerInstance(Instance) +DNS::DNS() { ServerInstance->Logs->Log("RESOLVER",DEBUG,"DNS::DNS"); /* Clear the Resolver class table */ @@ -412,7 +409,7 @@ DNS::DNS(InspIRCd* Instance) : ServerInstance(Instance) */ this->Rehash(); - this->PruneTimer = new CacheTimer(ServerInstance, this); + this->PruneTimer = new CacheTimer(this); ServerInstance->Timers->AddTimer(this->PruneTimer); } @@ -904,7 +901,7 @@ void Resolver::TriggerCachedResult() } /** High level abstraction of dns used by application at large */ -Resolver::Resolver(InspIRCd* Instance, const std::string &source, QueryType qt, bool &cached, Module* creator) : ServerInstance(Instance), Creator(creator), input(source), querytype(qt) +Resolver::Resolver(const std::string &source, QueryType qt, bool &cached, Module* creator) : Creator(creator), input(source), querytype(qt) { ServerInstance->Logs->Log("RESOLVER",DEBUG,"Resolver::Resolver"); cached = false; diff --git a/src/dynamic.cpp b/src/dynamic.cpp index 704c4d9dd..8731489c4 100644 --- a/src/dynamic.cpp +++ b/src/dynamic.cpp @@ -19,7 +19,7 @@ #include <dlfcn.h> #endif -DLLManager::DLLManager(InspIRCd*, const char *fname) +DLLManager::DLLManager(const char *fname) { err = NULL; diff --git a/src/filelogger.cpp b/src/filelogger.cpp index b99b9e5bb..1a88823c4 100644 --- a/src/filelogger.cpp +++ b/src/filelogger.cpp @@ -19,8 +19,8 @@ #include "inspircd_se_config.h" #include "filelogger.h" -FileLogStream::FileLogStream(InspIRCd *Instance, int loglevel, FileWriter *fw) - : LogStream(Instance, loglevel), f(fw) +FileLogStream::FileLogStream(int loglevel, FileWriter *fw) + : LogStream(loglevel), f(fw) { ServerInstance->Logs->AddLoggerRef(f); } diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 04c24418c..bf2a218a6 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -316,7 +316,7 @@ CoreExport const char* irc::Spacify(const char* n) } -irc::modestacker::modestacker(InspIRCd* Instance, bool add) : ServerInstance(Instance), adding(add) +irc::modestacker::modestacker(bool add) : adding(add) { sequence.clear(); sequence.push_back(""); diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 80feae464..155e29dd4 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -21,7 +21,7 @@ std::string InspIRCd::GetServerDescription(const char* servername) { std::string description; - FOREACH_MOD_I(this,I_OnGetServerDescription,OnGetServerDescription(servername,description)); + FOREACH_MOD(I_OnGetServerDescription,OnGetServerDescription(servername,description)); if (!description.empty()) { @@ -318,8 +318,8 @@ bool InspIRCd::OpenLog(char**, int) return false; } - FileWriter* fw = new FileWriter(this, Config->log_file); - FileLogStream *f = new FileLogStream(this, (Config->forcedebug ? DEBUG : DEFAULT), fw); + FileWriter* fw = new FileWriter(Config->log_file); + FileLogStream *f = new FileLogStream((Config->forcedebug ? DEBUG : DEFAULT), fw); this->Logs->AddLogType("*", f, true); @@ -341,9 +341,9 @@ void InspIRCd::SendWhoisLine(User* user, User* dest, int numeric, const std::str std::string copy_text = text; ModResult MOD_RESULT; - FIRST_MOD_RESULT(this, OnWhoisLine, MOD_RESULT, (user, dest, numeric, copy_text)); + FIRST_MOD_RESULT(OnWhoisLine, MOD_RESULT, (user, dest, numeric, copy_text)); - if (!MOD_RESULT) + if (MOD_RESULT != MOD_RES_DENY) user->WriteServ("%d %s", numeric, copy_text.c_str()); } diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 0fc3535e2..300d01650 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -317,20 +317,9 @@ void InspIRCd::WritePID(const std::string &filename) } InspIRCd::InspIRCd(int argc, char** argv) : - /* Functor initialisation. Note that the ordering here is very important. - * - * THIS MUST MATCH ORDER OF DECLARATION OF THE HandleWhateverFunc classes - * within class InspIRCd. - */ - HandleIsNick(this), - HandleIsIdent(this), - HandleFloodQuitUser(this), - HandleIsChannel(this), - HandleIsSID(this), - HandleRehash(this), ConfigFileName("inspircd.conf"), - /* Functor pointer initialisation. Must match the order of the list above + /* Functor pointer initialisation. * * THIS MUST MATCH THE ORDER OF DECLARATION OF THE FUNCTORS, e.g. the methods * themselves within the class. @@ -383,20 +372,20 @@ InspIRCd::InspIRCd(int argc, char** argv) : this->TIME = time(NULL); // This must be created first, so other parts of Insp can use it while starting up - this->Logs = new LogManager(this); + this->Logs = new LogManager; SocketEngineFactory SEF; SE = SEF.Create(); - this->Threads = new ThreadEngine(this); + this->Threads = new ThreadEngine; /* Default implementation does nothing */ - this->PI = new ProtocolInterface(this); + this->PI = new ProtocolInterface; this->s_signal = 0; // Create base manager classes early, so nothing breaks - this->Users = new UserManager(this); + this->Users = new UserManager; this->Users->unregistered_count = 0; @@ -404,14 +393,14 @@ InspIRCd::InspIRCd(int argc, char** argv) : this->Users->uuidlist = new user_hash(); this->chanlist = new chan_hash(); - this->Config = new ServerConfig(this); - this->SNO = new SnomaskManager(this); - this->BanCache = new BanCacheManager(this); + this->Config = new ServerConfig; + this->SNO = new SnomaskManager; + this->BanCache = new BanCacheManager; this->Modules = new ModuleManager(); this->stats = new serverstats(); - this->Timers = new TimerManager(this); - this->Parser = new CommandParser(this); - this->XLines = new XLineManager(this); + this->Timers = new TimerManager; + this->Parser = new CommandParser; + this->XLines = new XLineManager; this->Config->argv = argv; this->Config->argc = argc; @@ -484,7 +473,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : // Handle forking if(!do_nofork) { - DWORD ExitCode = WindowsForkStart(this); + DWORD ExitCode = WindowsForkStart(); if(ExitCode) exit(ExitCode); } @@ -492,7 +481,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : // Set up winsock WSADATA wsadata; WSAStartup(MAKEWORD(2,0), &wsadata); - ChangeWindowsSpecificPointers(this); + ChangeWindowsSpecificPointers(); #endif Config->MyExecutable = argv[0]; @@ -535,7 +524,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : printf_c("\t\033[1;32mpeavey, aquanight, psychon, dz, danieldg\033[0m\n\n"); printf_c("Others:\t\t\t\033[1;32mSee /INFO Output\033[0m\n"); - this->Modes = new ModeParser(this); + this->Modes = new ModeParser; if (!do_root) this->CheckRoot(); @@ -573,7 +562,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : this->Config->Apply(NULL, ""); Logs->OpenFileLogs(); - this->Res = new DNS(this); + this->Res = new DNS; this->AddServerName(Config->ServerName); @@ -600,7 +589,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : } /* set up fake client again this time with the correct uid */ - this->FakeClient = new FakeUser(this, "!"); + this->FakeClient = new FakeUser("!"); this->FakeClient->SetFakeServer(Config->ServerName); // Get XLine to do it's thing. @@ -660,10 +649,10 @@ InspIRCd::InspIRCd(int argc, char** argv) : } } #else - WindowsIPC = new IPC(this); + WindowsIPC = new IPC; if(!Config->nofork) { - WindowsForkKillOwner(this); + WindowsForkKillOwner(); FreeConsole(); } /* Set win32 service as running, if we are running as a service */ @@ -739,7 +728,7 @@ int InspIRCd::Run() /* See if we're supposed to be running the test suite rather than entering the mainloop */ if (Config->TestSuite) { - TestSuite* ts = new TestSuite(this); + TestSuite* ts = new TestSuite; delete ts; Exit(0); } @@ -793,7 +782,7 @@ int InspIRCd::Run() if ((TIME % 3600) == 0) { this->RehashUsersAndChans(); - FOREACH_MOD_I(this, I_OnGarbageCollect, OnGarbageCollect()); + FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect()); } Timers->TickTimers(TIME); @@ -801,7 +790,7 @@ int InspIRCd::Run() if ((TIME % 5) == 0) { - FOREACH_MOD_I(this,I_OnBackgroundTimer,OnBackgroundTimer(TIME)); + FOREACH_MOD(I_OnBackgroundTimer,OnBackgroundTimer(TIME)); SNO->FlushSnotices(); } #ifndef WIN32 @@ -852,7 +841,7 @@ int InspIRCd::Run() bool InspIRCd::AllModulesReportReady(User* user) { ModResult res; - FIRST_MOD_RESULT(this, OnCheckReady, res, (user)); + FIRST_MOD_RESULT(OnCheckReady, res, (user)); return (res == MOD_RES_PASSTHRU); } diff --git a/src/listensocket.cpp b/src/listensocket.cpp index dfd2f11f7..a8c713959 100644 --- a/src/listensocket.cpp +++ b/src/listensocket.cpp @@ -21,7 +21,7 @@ irc::sockets::sockaddrs ListenSocketBase::client; irc::sockets::sockaddrs ListenSocketBase::server; -ListenSocketBase::ListenSocketBase(InspIRCd* Instance, int port, const std::string &addr) : ServerInstance(Instance), desc("plaintext") +ListenSocketBase::ListenSocketBase(int port, const std::string &addr) : desc("plaintext") { irc::sockets::sockaddrs bind_to; @@ -44,20 +44,20 @@ ListenSocketBase::ListenSocketBase(InspIRCd* Instance, int port, const std::stri if (this->fd > -1) { - int rv = Instance->SE->Bind(this->fd, &bind_to.sa, sizeof(bind_to)); + int rv = ServerInstance->SE->Bind(this->fd, &bind_to.sa, sizeof(bind_to)); if (rv >= 0) - rv = Instance->SE->Listen(this->fd, Instance->Config->MaxConn); + rv = ServerInstance->SE->Listen(this->fd, ServerInstance->Config->MaxConn); if (rv < 0) { - Instance->SE->Shutdown(this, 2); - Instance->SE->Close(this); + ServerInstance->SE->Shutdown(this, 2); + ServerInstance->SE->Close(this); this->fd = -1; } else { - Instance->SE->NonBlocking(this->fd); - Instance->SE->AddFd(this, FD_WANT_POLL_READ | FD_WANT_NO_WRITE); + ServerInstance->SE->NonBlocking(this->fd); + ServerInstance->SE->AddFd(this, FD_WANT_POLL_READ | FD_WANT_NO_WRITE); } } } @@ -169,5 +169,5 @@ void ListenSocketBase::HandleEvent(EventType e, int err) void ClientListenSocket::OnAcceptReady(int nfd) { - ServerInstance->Users->AddUser(ServerInstance, nfd, this, &client, &server); + ServerInstance->Users->AddUser(nfd, this, &client, &server); } diff --git a/src/logger.cpp b/src/logger.cpp index 049b4b5e7..e2baa4b8d 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -48,8 +48,8 @@ void LogManager::SetupNoFork() { if (!noforkstream) { - FileWriter* fw = new FileWriter(ServerInstance, stdout); - noforkstream = new FileLogStream(ServerInstance, ServerInstance->Config->forcedebug ? DEBUG : DEFAULT, fw); + FileWriter* fw = new FileWriter(stdout); + noforkstream = new FileLogStream(ServerInstance->Config->forcedebug ? DEBUG : DEFAULT, fw); } else { @@ -70,7 +70,7 @@ void LogManager::OpenFileLogs() { return; } - ConfigReader* Conf = new ConfigReader(ServerInstance); + ConfigReader* Conf = new ConfigReader; std::map<std::string, FileWriter*> logmap; std::map<std::string, FileWriter*>::iterator i; for (int index = 0; index < Conf->Enumerate("log"); ++index) @@ -109,14 +109,14 @@ void LogManager::OpenFileLogs() if ((i = logmap.find(target)) == logmap.end()) { FILE* f = fopen(target.c_str(), "a"); - fw = new FileWriter(ServerInstance, f); + fw = new FileWriter(f); logmap.insert(std::make_pair(target, fw)); } else { fw = i->second; } - FileLogStream* fls = new FileLogStream(ServerInstance, loglevel, fw); + FileLogStream* fls = new FileLogStream(loglevel, fw); AddLogTypes(type, fls, true); } } @@ -330,8 +330,8 @@ void LogManager::Log(const std::string &type, int loglevel, const std::string &m } -FileWriter::FileWriter(InspIRCd* Instance, FILE* logfile) -: ServerInstance(Instance), log(logfile), writeops(0) +FileWriter::FileWriter(FILE* logfile) +: log(logfile), writeops(0) { } diff --git a/src/mode.cpp b/src/mode.cpp index b7ee7b385..4478dce73 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -188,7 +188,7 @@ ModeAction SimpleChannelModeHandler::OnModeChange(User* source, User* dest, Chan return MODEACTION_DENY; } -ModeWatcher::ModeWatcher(InspIRCd* Instance, char modeletter, ModeType type) : ServerInstance(Instance), mode(modeletter), m_type(type) +ModeWatcher::ModeWatcher(char modeletter, ModeType type) : mode(modeletter), m_type(type) { } @@ -268,7 +268,7 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool int pcnt = mh->GetNumParams(adding); ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnRawMode, MOD_RESULT, (user, chan, modechar, parameter, adding, pcnt)); + FIRST_MOD_RESULT(OnRawMode, MOD_RESULT, (user, chan, modechar, parameter, adding, pcnt)); if (IS_LOCAL(user) && (MOD_RESULT == MOD_RES_DENY)) return MODEACTION_DENY; @@ -395,7 +395,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user, else { ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnPreMode, MOD_RESULT, (user, targetuser, targetchannel, parameters)); + FIRST_MOD_RESULT(OnPreMode, MOD_RESULT, (user, targetuser, targetchannel, parameters)); if (MOD_RESULT == MOD_RES_DENY) return; SkipAccessChecks = (MOD_RESULT == MOD_RES_ALLOW); @@ -545,7 +545,7 @@ void ModeParser::DisplayListModes(User* user, Channel* chan, std::string &mode_s return; ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnRawMode, MOD_RESULT, (user, chan, mletter, "", true, 0)); + FIRST_MOD_RESULT(OnRawMode, MOD_RESULT, (user, chan, mletter, "", true, 0)); if (MOD_RESULT == MOD_RES_DENY) continue; @@ -958,29 +958,29 @@ void ModeHandler::RemoveMode(Channel* channel, irc::modestacker* stack) } } -ModeParser::ModeParser(InspIRCd* Instance) +ModeParser::ModeParser() { ModeHandler* modes[] = { - new ModeChannelSecret(Instance), - new ModeChannelPrivate(Instance), - new ModeChannelModerated(Instance), - new ModeChannelTopicOps(Instance), - - new ModeChannelNoExternal(Instance), - new ModeChannelInviteOnly(Instance), - new ModeChannelKey(Instance), - new ModeChannelLimit(Instance), - - new ModeChannelBan(Instance), - new ModeChannelOp(Instance), - new ModeChannelHalfOp(Instance), - new ModeChannelVoice(Instance), - - new ModeUserWallops(Instance), - new ModeUserInvisible(Instance), - new ModeUserOperator(Instance), - new ModeUserServerNoticeMask(Instance), + new ModeChannelSecret, + new ModeChannelPrivate, + new ModeChannelModerated, + new ModeChannelTopicOps, + + new ModeChannelNoExternal, + new ModeChannelInviteOnly, + new ModeChannelKey, + new ModeChannelLimit, + + new ModeChannelBan, + new ModeChannelOp, + new ModeChannelHalfOp, + new ModeChannelVoice, + + new ModeUserWallops, + new ModeUserInvisible, + new ModeUserOperator, + new ModeUserServerNoticeMask, #define BUILTIN_MODE_COUNT 16 }; diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp index d9ecb5b07..119660ff5 100644 --- a/src/modes/cmode_b.cpp +++ b/src/modes/cmode_b.cpp @@ -25,7 +25,7 @@ #include "hashcomp.h" #include "modes/cmode_b.h" -ModeChannelBan::ModeChannelBan(InspIRCd* Instance) : ModeHandler(NULL, 'b', PARAM_ALWAYS, MODETYPE_CHANNEL) +ModeChannelBan::ModeChannelBan() : ModeHandler(NULL, 'b', PARAM_ALWAYS, MODETYPE_CHANNEL) { list = true; } @@ -117,7 +117,7 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan } ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnAddBan, MOD_RESULT, (user,chan,dest)); + FIRST_MOD_RESULT(OnAddBan, MOD_RESULT, (user,chan,dest)); if (MOD_RESULT == MOD_RES_DENY) { dest = ""; @@ -170,7 +170,7 @@ std::string& ModeChannelBan::DelBan(User *user, std::string& dest, Channel *chan if (!strcasecmp(i->data.c_str(), dest.c_str())) { ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnDelBan, MOD_RESULT, (user, chan, dest)); + FIRST_MOD_RESULT(OnDelBan, MOD_RESULT, (user, chan, dest)); if (MOD_RESULT == MOD_RES_DENY) { dest = ""; diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp index 927c7ea73..d5472c154 100644 --- a/src/modes/cmode_h.cpp +++ b/src/modes/cmode_h.cpp @@ -19,7 +19,7 @@ #include "modules.h" #include "modes/cmode_h.h" -ModeChannelHalfOp::ModeChannelHalfOp(InspIRCd* Instance) : ModeHandler(NULL, 'h', PARAM_ALWAYS, MODETYPE_CHANNEL) +ModeChannelHalfOp::ModeChannelHalfOp() : ModeHandler(NULL, 'h', PARAM_ALWAYS, MODETYPE_CHANNEL) { list = true; prefix = '%'; diff --git a/src/modes/cmode_i.cpp b/src/modes/cmode_i.cpp index 60183b001..ac9245d62 100644 --- a/src/modes/cmode_i.cpp +++ b/src/modes/cmode_i.cpp @@ -17,7 +17,7 @@ #include "users.h" #include "modes/cmode_i.h" -ModeChannelInviteOnly::ModeChannelInviteOnly(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, NULL, 'i') +ModeChannelInviteOnly::ModeChannelInviteOnly() : SimpleChannelModeHandler(NULL, 'i') { } diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp index ea035e7b8..4105660d1 100644 --- a/src/modes/cmode_k.cpp +++ b/src/modes/cmode_k.cpp @@ -17,7 +17,7 @@ #include "users.h" #include "modes/cmode_k.h" -ModeChannelKey::ModeChannelKey(InspIRCd* Instance) : ModeHandler(NULL, 'k', PARAM_ALWAYS, MODETYPE_CHANNEL) +ModeChannelKey::ModeChannelKey() : ModeHandler(NULL, 'k', PARAM_ALWAYS, MODETYPE_CHANNEL) { } diff --git a/src/modes/cmode_l.cpp b/src/modes/cmode_l.cpp index 1aea53a61..aa713ec56 100644 --- a/src/modes/cmode_l.cpp +++ b/src/modes/cmode_l.cpp @@ -17,7 +17,7 @@ #include "users.h" #include "modes/cmode_l.h" -ModeChannelLimit::ModeChannelLimit(InspIRCd* Instance) : ModeHandler(NULL, 'l', PARAM_SETONLY, MODETYPE_CHANNEL) +ModeChannelLimit::ModeChannelLimit() : ModeHandler(NULL, 'l', PARAM_SETONLY, MODETYPE_CHANNEL) { } diff --git a/src/modes/cmode_m.cpp b/src/modes/cmode_m.cpp index 1e40e9a16..13f39fd79 100644 --- a/src/modes/cmode_m.cpp +++ b/src/modes/cmode_m.cpp @@ -17,7 +17,7 @@ #include "users.h" #include "modes/cmode_m.h" -ModeChannelModerated::ModeChannelModerated(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, NULL, 'm') +ModeChannelModerated::ModeChannelModerated() : SimpleChannelModeHandler(NULL, 'm') { } diff --git a/src/modes/cmode_n.cpp b/src/modes/cmode_n.cpp index bdc3521a5..4aac083e0 100644 --- a/src/modes/cmode_n.cpp +++ b/src/modes/cmode_n.cpp @@ -17,7 +17,7 @@ #include "users.h" #include "modes/cmode_n.h" -ModeChannelNoExternal::ModeChannelNoExternal(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, NULL, 'n') +ModeChannelNoExternal::ModeChannelNoExternal() : SimpleChannelModeHandler(NULL, 'n') { } diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp index 8af364ad4..8160a38a6 100644 --- a/src/modes/cmode_o.cpp +++ b/src/modes/cmode_o.cpp @@ -19,7 +19,7 @@ #include "modules.h" #include "modes/cmode_o.h" -ModeChannelOp::ModeChannelOp(InspIRCd* Instance) : ModeHandler(NULL, 'o', PARAM_ALWAYS, MODETYPE_CHANNEL) +ModeChannelOp::ModeChannelOp() : ModeHandler(NULL, 'o', PARAM_ALWAYS, MODETYPE_CHANNEL) { list = true; prefix = '@'; diff --git a/src/modes/cmode_p.cpp b/src/modes/cmode_p.cpp index d5f52eb78..92f44f18a 100644 --- a/src/modes/cmode_p.cpp +++ b/src/modes/cmode_p.cpp @@ -17,7 +17,7 @@ #include "users.h" #include "modes/cmode_p.h" -ModeChannelPrivate::ModeChannelPrivate(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, NULL, 'p') +ModeChannelPrivate::ModeChannelPrivate() : SimpleChannelModeHandler(NULL, 'p') { } diff --git a/src/modes/cmode_s.cpp b/src/modes/cmode_s.cpp index d5ec5bbed..486520899 100644 --- a/src/modes/cmode_s.cpp +++ b/src/modes/cmode_s.cpp @@ -17,7 +17,7 @@ #include "users.h" #include "modes/cmode_s.h" -ModeChannelSecret::ModeChannelSecret(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, NULL, 's') +ModeChannelSecret::ModeChannelSecret() : SimpleChannelModeHandler(NULL, 's') { } diff --git a/src/modes/cmode_t.cpp b/src/modes/cmode_t.cpp index b3f266086..627717f33 100644 --- a/src/modes/cmode_t.cpp +++ b/src/modes/cmode_t.cpp @@ -17,7 +17,7 @@ #include "users.h" #include "modes/cmode_t.h" -ModeChannelTopicOps::ModeChannelTopicOps(InspIRCd* Instance) : ModeHandler(NULL, 't', PARAM_NONE, MODETYPE_CHANNEL) +ModeChannelTopicOps::ModeChannelTopicOps() : ModeHandler(NULL, 't', PARAM_NONE, MODETYPE_CHANNEL) { } diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp index 76faa8aae..f744623a6 100644 --- a/src/modes/cmode_v.cpp +++ b/src/modes/cmode_v.cpp @@ -20,7 +20,7 @@ #include "modules.h" #include "modes/cmode_v.h" -ModeChannelVoice::ModeChannelVoice(InspIRCd* Instance) : ModeHandler(NULL, 'v', PARAM_ALWAYS, MODETYPE_CHANNEL) +ModeChannelVoice::ModeChannelVoice() : ModeHandler(NULL, 'v', PARAM_ALWAYS, MODETYPE_CHANNEL) { list = true; prefix = '+'; diff --git a/src/modes/umode_i.cpp b/src/modes/umode_i.cpp index 5c7c41b62..515ffd10e 100644 --- a/src/modes/umode_i.cpp +++ b/src/modes/umode_i.cpp @@ -17,7 +17,7 @@ #include "users.h" #include "modes/umode_i.h" -ModeUserInvisible::ModeUserInvisible(InspIRCd* Instance) : SimpleUserModeHandler(NULL, 'i') +ModeUserInvisible::ModeUserInvisible() : SimpleUserModeHandler(NULL, 'i') { } diff --git a/src/modes/umode_o.cpp b/src/modes/umode_o.cpp index ec9b4ad5b..1d6992144 100644 --- a/src/modes/umode_o.cpp +++ b/src/modes/umode_o.cpp @@ -17,7 +17,7 @@ #include "users.h" #include "modes/umode_o.h" -ModeUserOperator::ModeUserOperator(InspIRCd* Instance) : ModeHandler(NULL, 'o', PARAM_NONE, MODETYPE_USER) +ModeUserOperator::ModeUserOperator() : ModeHandler(NULL, 'o', PARAM_NONE, MODETYPE_USER) { oper = true; } diff --git a/src/modes/umode_s.cpp b/src/modes/umode_s.cpp index abfc480d9..9d4d09329 100644 --- a/src/modes/umode_s.cpp +++ b/src/modes/umode_s.cpp @@ -17,7 +17,7 @@ #include "users.h" #include "modes/umode_s.h" -ModeUserServerNoticeMask::ModeUserServerNoticeMask(InspIRCd* Instance) : ModeHandler(NULL, 's', PARAM_SETONLY, MODETYPE_USER) +ModeUserServerNoticeMask::ModeUserServerNoticeMask() : ModeHandler(NULL, 's', PARAM_SETONLY, MODETYPE_USER) { oper = true; } diff --git a/src/modes/umode_w.cpp b/src/modes/umode_w.cpp index 8cc31094d..e1608169e 100644 --- a/src/modes/umode_w.cpp +++ b/src/modes/umode_w.cpp @@ -17,7 +17,7 @@ #include "users.h" #include "modes/umode_w.h" -ModeUserWallops::ModeUserWallops(InspIRCd* Instance) : SimpleUserModeHandler(NULL, 'w') +ModeUserWallops::ModeUserWallops() : SimpleUserModeHandler(NULL, 'w') { } diff --git a/src/modules.cpp b/src/modules.cpp index d38496444..9e775ed1e 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -90,7 +90,7 @@ Module* Event::GetSource() return this->source; } -char* Event::Send(InspIRCd* SI) +char* Event::Send() { FOREACH_MOD(I_OnEvent,OnEvent(this)); return NULL; @@ -104,7 +104,7 @@ std::string Event::GetEventID() // These declarations define the behavours of the base class Module (which does nothing at all) -Module::Module(InspIRCd*) { } +Module::Module() { } Module::~Module() { } ModResult Module::OnSendSnotice(char &snomask, std::string &type, const std::string &message) { return MOD_RES_PASSTHRU; } @@ -426,7 +426,7 @@ bool ModuleManager::Load(const char* filename) /* This will throw a CoreException if there's a problem loading * the module file or getting a pointer to the init_module symbol. */ - newhandle = new ircd_module(ServerInstance, modfile, "init_module"); + newhandle = new ircd_module(modfile, "init_module"); newmod = newhandle->CallInit(); if (newmod) @@ -494,7 +494,7 @@ bool ModuleManager::Load(const char* filename) } this->ModCount++; - FOREACH_MOD_I(ServerInstance,I_OnLoadModule,OnLoadModule(newmod, filename_str)); + FOREACH_MOD(I_OnLoadModule,OnLoadModule(newmod, filename_str)); /* We give every module a chance to re-prioritize when we introduce a new one, * not just the one thats loading, as the new module could affect the preference @@ -556,7 +556,7 @@ bool ModuleManager::Unload(const char* filename) /* Tidy up any dangling resolvers */ ServerInstance->Res->CleanResolvers(modfind->second.second); - FOREACH_MOD_I(ServerInstance,I_OnUnloadModule,OnUnloadModule(modfind->second.second, modfind->first)); + FOREACH_MOD(I_OnUnloadModule,OnUnloadModule(modfind->second.second, modfind->first)); this->DetachAll(modfind->second.second); @@ -877,7 +877,7 @@ const std::vector<std::string> ModuleManager::GetAllModuleNames(int filter) return retval; } -ConfigReader::ConfigReader(InspIRCd* Instance) +ConfigReader::ConfigReader() { this->error = 0; } @@ -957,12 +957,12 @@ int ConfigReader::EnumerateValues(const std::string &tag, int index) return ServerInstance->Config->ConfVarEnum(tag, index); } -FileReader::FileReader(InspIRCd* Instance, const std::string &filename) +FileReader::FileReader(const std::string &filename) { LoadFile(filename); } -FileReader::FileReader(InspIRCd* Instance) +FileReader::FileReader() { } diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp index d442cc16d..13b35fdfb 100644 --- a/src/modules/extra/m_geoip.cpp +++ b/src/modules/extra/m_geoip.cpp @@ -29,8 +29,7 @@ class ModuleGeoIP : public Module public: - ModuleGeoIP(InspIRCd *Me) : Module(Me) - { + ModuleGeoIP() { OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -51,7 +50,7 @@ class ModuleGeoIP : public Module { GeoBans.clear(); - ConfigReader conf(ServerInstance); + ConfigReader conf; banunknown = conf.ReadFlag("geoip", "banunknown", 0); diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp index 45202e6fa..6fa5abfe7 100644 --- a/src/modules/extra/m_ldapauth.cpp +++ b/src/modules/extra/m_ldapauth.cpp @@ -46,9 +46,8 @@ class ModuleLDAPAuth : public Module LDAP *conn; public: - ModuleLDAPAuth(InspIRCd* Me) - : Module(Me) - { + ModuleLDAPAuth() + { conn = NULL; Implementation eventlist[] = { I_OnUserDisconnect, I_OnCheckReady, I_OnRehash, I_OnUserRegister }; ServerInstance->Modules->Attach(eventlist, this, 4); @@ -63,7 +62,7 @@ public: virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; base = Conf.ReadValue("ldapauth", "baserdn", 0); attribute = Conf.ReadValue("ldapauth", "attribute", 0); diff --git a/src/modules/extra/m_ldapoper.cpp b/src/modules/extra/m_ldapoper.cpp index ed06d6890..634a99fa7 100644 --- a/src/modules/extra/m_ldapoper.cpp +++ b/src/modules/extra/m_ldapoper.cpp @@ -41,9 +41,8 @@ class ModuleLDAPAuth : public Module LDAP *conn; public: - ModuleLDAPAuth(InspIRCd* Me) - : Module(Me) - { + ModuleLDAPAuth() + { conn = NULL; Implementation eventlist[] = { I_OnRehash, I_OnPassCompare }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -58,7 +57,7 @@ public: virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; base = Conf.ReadValue("ldapoper", "baserdn", 0); ldapserver = Conf.ReadValue("ldapoper", "server", 0); diff --git a/src/modules/extra/m_mssql.cpp b/src/modules/extra/m_mssql.cpp index f58858696..8cd9e2ea7 100644 --- a/src/modules/extra/m_mssql.cpp +++ b/src/modules/extra/m_mssql.cpp @@ -51,11 +51,9 @@ class QueryThread : public SocketThread { private: ModuleMsSQL* Parent; - InspIRCd* ServerInstance; public: - QueryThread(InspIRCd* si, ModuleMsSQL* mod) - : SocketThread(si), Parent(mod), ServerInstance(si) - { + QueryThread(ModuleMsSQL* mod) + : SocketThread(si), Parent(mod), { } ~QueryThread() { } virtual void Run(); @@ -232,7 +230,6 @@ class SQLConn : public classbase { private: ResultQueue results; - InspIRCd* ServerInstance; Module* mod; SQLhost host; TDSLOGIN* login; @@ -242,8 +239,8 @@ class SQLConn : public classbase public: QueryQueue queue; - SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi) - : ServerInstance(SI), mod(m), host(hi), login(NULL), sock(NULL), context(NULL) + SQLConn(Module* m, const SQLhost& hi) + : mod(m), host(hi), login(NULL), sock(NULL), context(NULL) { if (OpenDB()) { @@ -643,8 +640,8 @@ class ModuleMsSQL : public Module QueryThread* queryDispatcher; public: - ModuleMsSQL(InspIRCd* Me) - : Module(Me), currid(0) + ModuleMsSQL() + : currid(0) { LoggingMutex = new Mutex(); ResultsMutex = new Mutex(); @@ -658,7 +655,7 @@ class ModuleMsSQL : public Module ReadConf(); - queryDispatcher = new QueryThread(ServerInstance, this); + queryDispatcher = new QueryThread(this); ServerInstance->Threads->Start(queryDispatcher); ServerInstance->Modules->PublishInterface("SQL", this); @@ -709,7 +706,7 @@ class ModuleMsSQL : public Module bool HostInConf(const SQLhost &h) { - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -729,7 +726,7 @@ class ModuleMsSQL : public Module { ClearOldConnections(); - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -760,7 +757,7 @@ class ModuleMsSQL : public Module SQLConn* newconn; - newconn = new SQLConn(ServerInstance, this, hi); + newconn = new SQLConn(this, hi); connections.insert(std::make_pair(hi.id, newconn)); } diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 3718eecf8..023ead94b 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -89,7 +89,6 @@ class ModuleSQL : public Module public: ConfigReader *Conf; - InspIRCd* PublicServerInstance; int currid; bool rehashing; DispatcherThread* Dispatcher; @@ -97,7 +96,7 @@ class ModuleSQL : public Module Mutex LoggingMutex; Mutex ConnMutex; - ModuleSQL(InspIRCd* Me); + ModuleSQL(); ~ModuleSQL(); unsigned long NewID(); const char* OnRequest(Request* request); @@ -593,7 +592,7 @@ void ClearAllConnections() } } -void ConnectDatabases(InspIRCd* ServerInstance, ModuleSQL* Parent) +void ConnectDatabases(ModuleSQL* Parent) { for (ConnMap::iterator i = Connections.begin(); i != Connections.end(); i++) { @@ -612,7 +611,7 @@ void ConnectDatabases(InspIRCd* ServerInstance, ModuleSQL* Parent) } } -void LoadDatabases(ConfigReader* conf, InspIRCd* ServerInstance, ModuleSQL* Parent) +void LoadDatabases(ConfigReader* conf, ModuleSQL* Parent) { Parent->ConnMutex.Lock(); ClearOldConnections(conf); @@ -639,7 +638,7 @@ void LoadDatabases(ConfigReader* conf, InspIRCd* ServerInstance, ModuleSQL* Pare ThisSQL->setInitialQuery(initquery); } } - ConnectDatabases(ServerInstance, Parent); + ConnectDatabases(Parent); Parent->ConnMutex.Unlock(); } @@ -673,23 +672,22 @@ class DispatcherThread : public SocketThread { private: ModuleSQL* Parent; - InspIRCd* ServerInstance; public: - DispatcherThread(InspIRCd* Instance, ModuleSQL* CreatorModule) : SocketThread(Instance), Parent(CreatorModule), ServerInstance(Instance) { } + DispatcherThread(ModuleSQL* CreatorModule) : SocketThread(Instance), Parent(CreatorModule),{ } ~DispatcherThread() { } virtual void Run(); virtual void OnNotify(); }; -ModuleSQL::ModuleSQL(InspIRCd* Me) : Module(Me), rehashing(false) +ModuleSQL::ModuleSQL() : rehashing(false) { ServerInstance->Modules->UseInterface("SQLutils"); - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; PublicServerInstance = ServerInstance; currid = 0; - Dispatcher = new DispatcherThread(ServerInstance, this); + Dispatcher = new DispatcherThread(this); ServerInstance->Threads->Start(Dispatcher); if (!ServerInstance->Modules->PublishFeature("SQL", this)) diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index c61e0983c..c0d301107 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -93,7 +93,7 @@ class ReconnectTimer : public Timer private: Module* mod; public: - ReconnectTimer(InspIRCd* SI, Module* m) + ReconnectTimer(Module* m) : Timer(5, SI->Time(), false), mod(m) { } @@ -301,7 +301,6 @@ public: class SQLConn : public EventHandler { private: - InspIRCd* ServerInstance; SQLhost confhost; /* The <database> entry */ Module* us; /* Pointer to the SQL provider itself */ PGconn* sql; /* PgSQL database connection handle */ @@ -311,8 +310,8 @@ class SQLConn : public EventHandler time_t idle; /* Time we last heard from the database */ public: - SQLConn(InspIRCd* SI, Module* self, const SQLhost& hi) - : EventHandler(), ServerInstance(SI), confhost(hi), us(self), sql(NULL), status(CWRITE), qinprog(false) + SQLConn(Module* self, const SQLhost& hi) + : EventHandler(), confhost(hi), us(self), sql(NULL), status(CWRITE), qinprog(false) { idle = this->ServerInstance->Time(); if(!DoConnect()) @@ -763,8 +762,8 @@ class ModulePgSQL : public Module ReconnectTimer* retimer; public: - ModulePgSQL(InspIRCd* Me) - : Module(Me), currid(0) + ModulePgSQL() + : currid(0) { ServerInstance->Modules->UseInterface("SQLutils"); @@ -813,7 +812,7 @@ class ModulePgSQL : public Module bool HostInConf(const SQLhost &h) { - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -834,7 +833,7 @@ class ModulePgSQL : public Module { ClearOldConnections(); - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -889,7 +888,7 @@ class ModulePgSQL : public Module SQLConn* newconn; - newconn = new SQLConn(ServerInstance, this, hi); + newconn = new SQLConn(this, hi); connections.insert(std::make_pair(hi.id, newconn)); } @@ -905,7 +904,7 @@ class ModulePgSQL : public Module break; } } - retimer = new ReconnectTimer(ServerInstance, this); + retimer = new ReconnectTimer(this); ServerInstance->Timers->AddTimer(retimer); } diff --git a/src/modules/extra/m_regex_pcre.cpp b/src/modules/extra/m_regex_pcre.cpp index 5254f04a6..4389ad685 100644 --- a/src/modules/extra/m_regex_pcre.cpp +++ b/src/modules/extra/m_regex_pcre.cpp @@ -39,14 +39,14 @@ private: pcre* regex; public: - PCRERegex(const std::string& rx, InspIRCd* Me) : Regex(rx, Me) + PCRERegex(const std::string& rx, ) : Regex(rx, Me) { const char* error; int erroffset; regex = pcre_compile(rx.c_str(), 0, &error, &erroffset, NULL); if (!regex) { - Me->Logs->Log("REGEX", DEBUG, "pcre_compile failed: /%s/ [%d] %s", rx.c_str(), erroffset, error); + ServerInstance->Logs->Log("REGEX", DEBUG, "pcre_compile failed: /%s/ [%d] %s", rx.c_str(), erroffset, error); throw PCREException(rx, error, erroffset); } } @@ -70,11 +70,10 @@ public: class ModuleRegexPCRE : public Module { public: - ModuleRegexPCRE(InspIRCd* Me) : Module(Me) - { - Me->Modules->PublishInterface("RegularExpression", this); + ModuleRegexPCRE() { + ServerInstance->Modules->PublishInterface("RegularExpression", this); Implementation eventlist[] = { I_OnRequest }; - Me->Modules->Attach(eventlist, this, 1); + ServerInstance->Modules->Attach(eventlist, this, 1); } virtual Version GetVersion() diff --git a/src/modules/extra/m_regex_posix.cpp b/src/modules/extra/m_regex_posix.cpp index 34a7e9bab..5fe4db29f 100644 --- a/src/modules/extra/m_regex_posix.cpp +++ b/src/modules/extra/m_regex_posix.cpp @@ -34,7 +34,7 @@ private: regex_t regbuf; public: - POSIXRegex(const std::string& rx, InspIRCd* Me, bool extended) : Regex(rx, Me) + POSIXRegex(const std::string& rx, bool extended) : Regex(rx, Me) { int flags = (extended ? REG_EXTENDED : 0) | REG_NOSUB; int errcode; @@ -76,11 +76,10 @@ class ModuleRegexPOSIX : public Module private: bool extended; public: - ModuleRegexPOSIX(InspIRCd* Me) : Module(Me) - { - Me->Modules->PublishInterface("RegularExpression", this); + ModuleRegexPOSIX() { + ServerInstance->Modules->PublishInterface("RegularExpression", this); Implementation eventlist[] = { I_OnRequest, I_OnRehash }; - Me->Modules->Attach(eventlist, this, 2); + ServerInstance->Modules->Attach(eventlist, this, 2); OnRehash(NULL); } @@ -96,7 +95,7 @@ public: virtual void OnRehash(User* u) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; extended = Conf.ReadFlag("posix", "extended", 0); } diff --git a/src/modules/extra/m_regex_tre.cpp b/src/modules/extra/m_regex_tre.cpp index c50429a5e..1ed35605b 100644 --- a/src/modules/extra/m_regex_tre.cpp +++ b/src/modules/extra/m_regex_tre.cpp @@ -36,7 +36,7 @@ private: regex_t regbuf; public: - TRERegex(const std::string& rx, InspIRCd* Me) : Regex(rx, Me) + TRERegex(const std::string& rx, ) : Regex(rx, Me) { int flags = REG_EXTENDED | REG_NOSUB; int errcode; @@ -76,11 +76,10 @@ public: class ModuleRegexTRE : public Module { public: - ModuleRegexTRE(InspIRCd* Me) : Module(Me) - { - Me->Modules->PublishInterface("RegularExpression", this); + ModuleRegexTRE() { + ServerInstance->Modules->PublishInterface("RegularExpression", this); Implementation eventlist[] = { I_OnRequest }; - Me->Modules->Attach(eventlist, this, 1); + ServerInstance->Modules->Attach(eventlist, this, 1); } virtual Version GetVersion() diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 1f2df8a1a..d7c0675bb 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -32,9 +32,8 @@ class ModuleSQLAuth : public Module bool verbose; public: - ModuleSQLAuth(InspIRCd* Me) - : Module(Me) - { + ModuleSQLAuth() + { ServerInstance->Modules->UseInterface("SQLutils"); ServerInstance->Modules->UseInterface("SQL"); @@ -60,7 +59,7 @@ public: virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; databaseid = Conf.ReadValue("sqlauth", "dbid", 0); /* Database ID, given to the SQL service provider */ freeformquery = Conf.ReadValue("sqlauth", "query", 0); /* Field name where username can be found */ diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 86b2cb378..063113102 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -51,7 +51,7 @@ class ResultNotifier : public BufferedSocket ModuleSQLite3* mod; public: - ResultNotifier(ModuleSQLite3* m, InspIRCd* SI, int newfd, char* ip) : BufferedSocket(SI, newfd, ip), mod(m) + ResultNotifier(ModuleSQLite3* m, int newfd, char* ip) : BufferedSocket(SI, newfd, ip), mod(m) { } @@ -77,7 +77,7 @@ class SQLiteListener : public ListenSocketBase FileReader* index; public: - SQLiteListener(ModuleSQLite3* P, InspIRCd* Instance, int port, const std::string &addr) : ListenSocketBase(Instance, port, addr), Parent(P) + SQLiteListener(ModuleSQLite3* P, int port, const std::string &addr) : ListenSocketBase(port, addr), Parent(P) { uslen = sizeof(sock_us); if (getsockname(this->fd,(sockaddr*)&sock_us,&uslen)) @@ -274,14 +274,13 @@ class SQLConn : public classbase { private: ResultQueue results; - InspIRCd* ServerInstance; Module* mod; SQLhost host; sqlite3* conn; public: - SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi) - : ServerInstance(SI), mod(m), host(hi) + SQLConn(Module* m, const SQLhost& hi) + : mod(m), host(hi) { if (OpenDB() != SQLITE_OK) { @@ -543,8 +542,8 @@ class ModuleSQLite3 : public Module unsigned long currid; public: - ModuleSQLite3(InspIRCd* Me) - : Module(Me), currid(0) + ModuleSQLite3() + : currid(0) { ServerInstance->Modules->UseInterface("SQLutils"); @@ -632,7 +631,7 @@ class ModuleSQLite3 : public Module bool HostInConf(const SQLhost &h) { - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -652,7 +651,7 @@ class ModuleSQLite3 : public Module { ClearOldConnections(); - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -681,7 +680,7 @@ class ModuleSQLite3 : public Module SQLConn* newconn; - newconn = new SQLConn(ServerInstance, this, hi); + newconn = new SQLConn(this, hi); connections.insert(std::make_pair(hi.id, newconn)); } diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 556cc8b31..4713f24a9 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -28,8 +28,6 @@ std::map<unsigned long,QueryInfo*> active_queries; class QueryInfo { -private: - InspIRCd* ServerInstance; public: QueryState qs; unsigned long id; @@ -43,7 +41,7 @@ public: time_t date; bool insert; - QueryInfo(InspIRCd* Instance, const std::string &n, const std::string &s, const std::string &h, unsigned long i, int cat) + QueryInfo(const std::string &n, const std::string &s, const std::string &h, unsigned long i, int cat) { ServerInstance = Instance; qs = FIND_SOURCE; @@ -183,9 +181,8 @@ class ModuleSQLLog : public Module { public: - ModuleSQLLog(InspIRCd* Me) - : Module(Me) - { + ModuleSQLLog() + { ServerInstance->Modules->UseInterface("SQLutils"); ServerInstance->Modules->UseInterface("SQL"); @@ -213,7 +210,7 @@ class ModuleSQLLog : public Module void ReadConfig() { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; dbid = Conf.ReadValue("sqllog","dbid",0); // database id of a database configured in sql module } @@ -253,7 +250,7 @@ class ModuleSQLLog : public Module SQLrequest req = SQLrequest(this, SQLModule, dbid, SQLquery("SELECT id,actor FROM ircd_log_actors WHERE actor='?'") % source); if(req.Send()) { - QueryInfo* i = new QueryInfo(ServerInstance, nick, source, host, req.id, category); + QueryInfo* i = new QueryInfo(nick, source, host, req.id, category); i->qs = FIND_SOURCE; active_queries[req.id] = i; } diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 3b0e6e226..47aa8d1fd 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -32,9 +32,8 @@ class ModuleSQLOper : public Module parameterlist names; public: - ModuleSQLOper(InspIRCd* Me) - : Module(Me) - { + ModuleSQLOper() + { ServerInstance->Modules->UseInterface("SQLutils"); ServerInstance->Modules->UseInterface("SQL"); ServerInstance->Modules->UseInterface("HashRequest"); @@ -114,7 +113,7 @@ public: virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; databaseid = Conf.ReadValue("sqloper", "dbid", 0); /* Database ID of a database configured for the service provider module */ hashtype = assign(Conf.ReadValue("sqloper", "hash", 0)); @@ -298,7 +297,7 @@ public: bool OperUser(User* user, const std::string &pattern, const std::string &type) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; for (int j = 0; j < Conf.Enumerate("type"); j++) { diff --git a/src/modules/extra/m_sqlutils.cpp b/src/modules/extra/m_sqlutils.cpp index c257d4098..6d40ee22c 100644 --- a/src/modules/extra/m_sqlutils.cpp +++ b/src/modules/extra/m_sqlutils.cpp @@ -30,9 +30,8 @@ private: IdChanMap idchan; public: - ModuleSQLutils(InspIRCd* Me) - : Module(Me) - { + ModuleSQLutils() + { ServerInstance->Modules->PublishInterface("SQLutils", this); Implementation eventlist[] = { I_OnChannelDelete, I_OnUnloadModule, I_OnRequest, I_OnUserDisconnect }; ServerInstance->Modules->Attach(eventlist, this, 4); diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 3362e9378..1fe84649f 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -143,8 +143,8 @@ class ModuleSSLGnuTLS : public Module GenericCap capHandler; public: - ModuleSSLGnuTLS(InspIRCd* Me) - : Module(Me), starttls(this), capHandler(this, "tls") + ModuleSSLGnuTLS() + : starttls(this), capHandler(this, "tls") { ServerInstance->Modules->PublishInterface("BufferedSocketHook", this); @@ -169,7 +169,7 @@ class ModuleSSLGnuTLS : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; listenports.clear(); sslports.clear(); @@ -200,7 +200,7 @@ class ModuleSSLGnuTLS : public Module OnRehash(user); - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string confdir(ServerInstance->ConfigFileName); // +1 so we the path ends with a / diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 645add4c2..f566b326b 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -100,7 +100,7 @@ class ModuleSSLOpenSSL : public Module public: - ModuleSSLOpenSSL(InspIRCd* Me) + ModuleSSLOpenSSL() { ServerInstance->Modules->PublishInterface("BufferedSocketHook", this); @@ -144,7 +144,7 @@ class ModuleSSLOpenSSL : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; listenports.clear(); sslports.clear(); @@ -175,7 +175,7 @@ class ModuleSSLOpenSSL : public Module OnRehash(user); - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string confdir(ServerInstance->ConfigFileName); // +1 so we the path ends with a / diff --git a/src/modules/extra/m_testclient.cpp b/src/modules/extra/m_testclient.cpp index 21603c3c8..3e41f533f 100644 --- a/src/modules/extra/m_testclient.cpp +++ b/src/modules/extra/m_testclient.cpp @@ -20,9 +20,8 @@ private: public: - ModuleTestClient(InspIRCd* Me) - : Module(Me) - { + ModuleTestClient() + { Implementation eventlist[] = { I_OnRequest, I_OnBackgroundTimer }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp index 557ad1cfa..976a27b5c 100644 --- a/src/modules/extra/m_ziplink.cpp +++ b/src/modules/extra/m_ziplink.cpp @@ -56,9 +56,8 @@ class ModuleZLib : public Module unsigned int net_buffer_size; public: - ModuleZLib(InspIRCd* Me) - : Module(Me) - { + ModuleZLib() + { ServerInstance->Modules->PublishInterface("BufferedSocketHook", this); sessions = new izip_session[ServerInstance->SE->GetMaxFds()]; diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp index 8ff325730..c8aadfcae 100644 --- a/src/modules/m_abbreviation.cpp +++ b/src/modules/m_abbreviation.cpp @@ -20,12 +20,11 @@ class ModuleAbbreviation : public Module public: - ModuleAbbreviation(InspIRCd* Me) - : Module(Me) - { - Me->Modules->Attach(I_OnPreCommand, this); + ModuleAbbreviation() + { + ServerInstance->Modules->Attach(I_OnPreCommand, this); /* Must do this first */ - Me->Modules->SetPriority(this, I_OnPreCommand, PRIORITY_FIRST); + ServerInstance->Modules->SetPriority(this, I_OnPreCommand, PRIORITY_FIRST); } virtual Version GetVersion() diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 57c6834af..3f3c3b1ba 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -65,7 +65,7 @@ class ModuleAlias : public Module virtual void ReadAliases() { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; AllowBots = MyConf.ReadFlag("fantasy", "allowbots", "no", 0); @@ -93,13 +93,12 @@ class ModuleAlias : public Module public: - ModuleAlias(InspIRCd* Me) - : Module(Me) - { + ModuleAlias() + { ReadAliases(); - Me->Modules->Attach(I_OnPreCommand, this); - Me->Modules->Attach(I_OnRehash, this); - Me->Modules->Attach(I_OnUserMessage, this); + ServerInstance->Modules->Attach(I_OnPreCommand, this); + ServerInstance->Modules->Attach(I_OnRehash, this); + ServerInstance->Modules->Attach(I_OnUserMessage, this); } diff --git a/src/modules/m_allowinvite.cpp b/src/modules/m_allowinvite.cpp index ae4e0b92e..0de992501 100644 --- a/src/modules/m_allowinvite.cpp +++ b/src/modules/m_allowinvite.cpp @@ -18,7 +18,7 @@ class AllowInvite : public SimpleChannelModeHandler { public: - AllowInvite(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'A') { } + AllowInvite(Module* Creator) : SimpleChannelModeHandler(Creator, 'A') { } }; class ModuleAllowInvite : public Module @@ -26,7 +26,7 @@ class ModuleAllowInvite : public Module AllowInvite ni; public: - ModuleAllowInvite(InspIRCd* Me) : Module(Me), ni(Me, this) + ModuleAllowInvite() : ni(this) { if (!ServerInstance->Modes->AddMode(&ni)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp index 5a05e3339..37f6a5fd2 100644 --- a/src/modules/m_alltime.cpp +++ b/src/modules/m_alltime.cpp @@ -49,8 +49,8 @@ class Modulealltime : public Module { CommandAlltime mycommand; public: - Modulealltime(InspIRCd *Me) - : Module(Me), mycommand(this) + Modulealltime() + : mycommand(this) { ServerInstance->AddCommand(&mycommand); } diff --git a/src/modules/m_antibear.cpp b/src/modules/m_antibear.cpp index e429f5c56..a89e9dd4d 100644 --- a/src/modules/m_antibear.cpp +++ b/src/modules/m_antibear.cpp @@ -20,7 +20,7 @@ class ModuleAntiBear : public Module { LocalIntExt bearExt; public: - ModuleAntiBear(InspIRCd* Me) : Module(Me), bearExt("antibear_timewait", this) + ModuleAntiBear() : bearExt("antibear_timewait", this) { Extensible::Register(&bearExt); Implementation eventlist[] = { I_OnUserRegister, I_OnPreCommand }; @@ -42,7 +42,7 @@ class ModuleAntiBear : public Module { if (!strncmp(parameters[1].c_str(), "\1TIME Mon May 01 18:54:20 2006", 30)) { - ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), 86400, ServerInstance->Config->ServerName, + ZLine* zl = new ZLine(ServerInstance->Time(), 86400, ServerInstance->Config->ServerName, "Unless you're stuck in a time warp, you appear to be a bear bot!", user->GetIPString()); if (ServerInstance->XLines->AddLine(zl,NULL)) { diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp index c5a56619e..8d4931e3b 100644 --- a/src/modules/m_antibottler.cpp +++ b/src/modules/m_antibottler.cpp @@ -18,9 +18,8 @@ class ModuleAntiBottler : public Module { public: - ModuleAntiBottler(InspIRCd* Me) - : Module(Me) - { + ModuleAntiBottler() + { Implementation eventlist[] = { I_OnPreCommand }; ServerInstance->Modules->Attach(eventlist, this, 1); diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index aa1aa633a..0d149ccf2 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -18,7 +18,7 @@ class AuditoriumMode : public ModeHandler { public: - AuditoriumMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'u', PARAM_NONE, MODETYPE_CHANNEL) + AuditoriumMode(Module* Creator) : ModeHandler(Creator, 'u', PARAM_NONE, MODETYPE_CHANNEL) { levelrequired = OP_VALUE; } @@ -44,8 +44,8 @@ class ModuleAuditorium : public Module bool ShowOps; bool OperOverride; public: - ModuleAuditorium(InspIRCd* Me) - : Module(Me), aum(Me, this) + ModuleAuditorium() + : aum(this) { if (!ServerInstance->Modes->AddMode(&aum)) throw ModuleException("Could not add new modes!"); @@ -53,7 +53,7 @@ class ModuleAuditorium : public Module OnRehash(NULL); Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart, I_OnUserKick, I_OnUserQuit, I_OnNamesListItem, I_OnRehash, I_OnHostCycle }; - Me->Modules->Attach(eventlist, this, 7); + ServerInstance->Modules->Attach(eventlist, this, 7); } @@ -64,7 +64,7 @@ class ModuleAuditorium : public Module void OnRehash(User* user) { - ConfigReader conf(ServerInstance); + ConfigReader conf; ShowOps = conf.ReadFlag("auditorium", "showops", 0); OperOverride = conf.ReadFlag("auditorium", "operoverride", 0); } diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index 0cd915ef9..35b30f0d4 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -31,7 +31,7 @@ class BanException : public ListModeBase { public: - BanException(InspIRCd* Instance, Module* Creator) : ListModeBase(Instance, Creator, 'e', "End of Channel Exception List", 348, 349, true) { } + BanException(Module* Creator) : ListModeBase(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, this) + ModuleBanException() : be(this) { if (!ServerInstance->Modes->AddMode(&be)) throw ModuleException("Could not add new modes!"); @@ -48,7 +48,7 @@ public: be.DoImplements(this); Implementation list[] = { I_OnRehash, I_OnRequest, I_On005Numeric, I_OnExtBanCheck, I_OnCheckChannelBan }; - Me->Modules->Attach(list, this, 5); + ServerInstance->Modules->Attach(list, this, 5); } diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index dae5a775e..11ce93c9a 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -39,7 +39,7 @@ class BanRedirect : public ModeWatcher { public: SimpleExtItem<BanRedirectList> extItem; - BanRedirect(InspIRCd* Instance, Module* parent) : ModeWatcher(Instance, 'b', MODETYPE_CHANNEL), + BanRedirect(Module* parent) : ModeWatcher('b', MODETYPE_CHANNEL), extItem("banredirect", parent) { } @@ -202,8 +202,8 @@ class ModuleBanRedirect : public Module Module* ExceptionModule; public: - ModuleBanRedirect(InspIRCd* Me) - : Module(Me), re(Me, this) + ModuleBanRedirect() + : re(this) { nofollow = false; @@ -214,7 +214,7 @@ class ModuleBanRedirect : public Module Extensible::Register(&re.extItem); Implementation list[] = { I_OnRehash, I_OnUserPreJoin, I_OnChannelDelete, I_OnCleanup }; - Me->Modules->Attach(list, this, 4); + ServerInstance->Modules->Attach(list, this, 4); } virtual void OnChannelDelete(Channel* chan) @@ -231,7 +231,7 @@ class ModuleBanRedirect : public Module if(redirects) { - irc::modestacker modestack(ServerInstance, false); + irc::modestacker modestack(false); StringDeque stackresult; std::vector<std::string> mode_junk; mode_junk.push_back(chan->name); @@ -315,7 +315,7 @@ class ModuleBanRedirect : public Module user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name.c_str()); user->WriteNumeric(470, "%s %s %s :You are banned from this channel, so you are automatically transfered to the redirected channel.", user->nick.c_str(), chan->name.c_str(), redir->targetchan.c_str()); nofollow = true; - Channel::JoinUser(ServerInstance, user, redir->targetchan.c_str(), false, "", false, ServerInstance->Time()); + Channel::JoinUser(user, redir->targetchan.c_str(), false, "", false, ServerInstance->Time()); nofollow = false; return MOD_RES_ALLOW; } diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index c9d20e3ef..7c4d63419 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -45,7 +45,7 @@ class ModuleBlockAmsg : public Module SimpleExtItem<BlockedMessage> blockamsg; public: - ModuleBlockAmsg(InspIRCd* Me) : Module(Me), blockamsg("blockamsg", this) + ModuleBlockAmsg() : blockamsg("blockamsg", this) { this->OnRehash(NULL); Extensible::Register(&blockamsg); @@ -65,7 +65,7 @@ class ModuleBlockAmsg : public Module virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; ForgetDelay = Conf.ReadInteger("blockamsg", "delay", 0, false); diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 88c09d91c..9e81050f3 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -21,7 +21,7 @@ class BlockCaps : public SimpleChannelModeHandler { public: - BlockCaps(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'B') { } + BlockCaps(Module* Creator) : SimpleChannelModeHandler(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, this) + ModuleBlockCAPS() : bc(this) { OnRehash(NULL); if (!ServerInstance->Modes->AddMode(&bc)) @@ -60,7 +60,7 @@ public: Channel* c = (Channel*)dest; - if (CHANOPS_EXEMPT(ServerInstance, 'B') && c->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('B') && c->GetPrefixValue(user) == OP_VALUE) { return MOD_RES_PASSTHRU; } @@ -101,7 +101,7 @@ public: void ReadConf() { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; percent = Conf.ReadInteger("blockcaps", "percent", "100", 0, true); minlen = Conf.ReadInteger("blockcaps", "minlen", "1", 0, true); std::string hmap = Conf.ReadValue("blockcaps", "capsmap", 0); diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index d0423dfe9..1c7cd8c52 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -20,7 +20,7 @@ class BlockColor : public SimpleChannelModeHandler { public: - BlockColor(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'c') { } + BlockColor(Module* Creator) : SimpleChannelModeHandler(Creator, 'c') { } }; class ModuleBlockColour : public Module @@ -29,7 +29,7 @@ class ModuleBlockColour : public Module BlockColor bc; public: - ModuleBlockColour(InspIRCd* Me) : Module(Me), bc(Me, this) + ModuleBlockColour() : bc(this) { if (!ServerInstance->Modes->AddMode(&bc)) throw ModuleException("Could not add new modes!"); @@ -48,7 +48,7 @@ class ModuleBlockColour : public Module { Channel* c = (Channel*)dest; - if (CHANOPS_EXEMPT(ServerInstance, 'c') && c->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('c') && c->GetPrefixValue(user) == OP_VALUE) { return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index f2a72781e..4c8007b8b 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -20,15 +20,15 @@ class BotMode : public SimpleUserModeHandler { public: - BotMode(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Creator, 'B') { } + BotMode(Module* Creator) : SimpleUserModeHandler(Creator, 'B') { } }; class ModuleBotMode : public Module { BotMode bm; public: - ModuleBotMode(InspIRCd* Me) - : Module(Me), bm(Me, this) + ModuleBotMode() + : bm(this) { if (!ServerInstance->Modes->AddMode(&bm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index a6bdb8511..45d3f0e5c 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -128,7 +128,7 @@ struct CallerIDExtInfo : public ExtensionItem class User_g : public SimpleUserModeHandler { public: - User_g(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Creator, 'g') { } + User_g(Module* Creator) : SimpleUserModeHandler(Creator, 'g') { } }; class CommandAccept : public Command @@ -342,7 +342,7 @@ private: } public: - ModuleCallerID(InspIRCd* Me) : Module(Me), cmd(this), myumode(Me, this) + ModuleCallerID() : cmd(this), myumode(this) { OnRehash(NULL); @@ -429,7 +429,7 @@ public: virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; cmd.maxaccepts = Conf.ReadInteger("callerid", "maxaccepts", "16", 0, true); operoverride = Conf.ReadFlag("callerid", "operoverride", "0", 0); tracknick = Conf.ReadFlag("callerid", "tracknick", "0", 0); diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 355c6d0fb..dbd81ed53 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -69,7 +69,7 @@ class CommandCAP : public Command reghold.set(user, 1); Event event((char*) &Data, this->creator, "cap_req"); - event.Send(ServerInstance); + event.Send(); if (Data.ack.size() > 0) { @@ -97,7 +97,7 @@ class CommandCAP : public Command reghold.set(user, 1); Event event((char*) &Data, this->creator, subcommand == "LS" ? "cap_ls" : "cap_list"); - event.Send(ServerInstance); + event.Send(); std::string Result; if (Data.wanted.size() > 0) @@ -117,7 +117,7 @@ class CommandCAP : public Command reghold.set(user, 1); Event event((char*) &Data, this->creator, "cap_clear"); - event.Send(ServerInstance); + event.Send(); std::string Result = irc::stringjoiner(" ", Data.ack, 0, Data.ack.size() - 1).GetJoined(); user->WriteServ("CAP * ACK :%s", Result.c_str()); @@ -135,8 +135,8 @@ class ModuleCAP : public Module { CommandCAP cmd; public: - ModuleCAP(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleCAP() + : cmd(this) { ServerInstance->AddCommand(&cmd); Extensible::Register(&cmd.reghold); diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 2abedd975..bfb30f5e8 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -23,8 +23,8 @@ class CBan : public XLine public: irc::string matchtext; - CBan(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string ch) - : XLine(Instance, s_time, d, src, re, "CBAN") + CBan(time_t s_time, long d, std::string src, std::string re, std::string ch) + : XLine(s_time, d, src, re, "CBAN") { this->matchtext = ch.c_str(); } @@ -63,13 +63,13 @@ public: class CBanFactory : public XLineFactory { public: - CBanFactory(InspIRCd* Instance) : XLineFactory(Instance, "CBAN") { } + CBanFactory() : XLineFactory("CBAN") { } /** Generate a shun */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { - return new CBan(ServerInstance, set_time, duration, source, reason, xline_specific_mask); + return new CBan(set_time, duration, source, reason, xline_specific_mask); } bool AutoApplyToUserList(XLine *x) @@ -116,7 +116,7 @@ class CommandCBan : public Command try { - r = new CBan(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), reason, parameters[0].c_str()); + r = new CBan(ServerInstance->Time(), duration, user->nick.c_str(), reason, parameters[0].c_str()); } catch (...) { @@ -162,7 +162,7 @@ class ModuleCBan : public Module CBanFactory f; public: - ModuleCBan(InspIRCd* Me) : Module(Me), mycommand(this), f(Me) + ModuleCBan() : mycommand(this) { ServerInstance->XLines->RegisterFactory(&f); diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index af3baa292..29410962b 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -26,7 +26,7 @@ typedef std::map<irc::string,irc::string> censor_t; class CensorUser : public SimpleUserModeHandler { public: - CensorUser(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Creator, 'G') { } + CensorUser(Module* Creator) : SimpleUserModeHandler(Creator, 'G') { } }; /** Handles channel mode +G @@ -34,7 +34,7 @@ class CensorUser : public SimpleUserModeHandler class CensorChannel : public SimpleChannelModeHandler { public: - CensorChannel(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'G') { } + CensorChannel(Module* Creator) : SimpleChannelModeHandler(Creator, 'G') { } }; class ModuleCensor : public Module @@ -44,8 +44,8 @@ class ModuleCensor : public Module CensorChannel cc; public: - ModuleCensor(InspIRCd* Me) - : Module(Me), cu(Me, this), cc(Me, this) + ModuleCensor() + : cu(this), cc(this) { /* Read the configuration file on startup. */ @@ -77,7 +77,7 @@ class ModuleCensor : public Module { active = ((Channel*)dest)->IsModeSet('G'); Channel* c = (Channel*)dest; - if (CHANOPS_EXEMPT(ServerInstance, 'G') && c->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('G') && c->GetPrefixValue(user) == OP_VALUE) { return MOD_RES_PASSTHRU; } @@ -115,7 +115,7 @@ class ModuleCensor : public Module * reload our config file on rehash - we must destroy and re-allocate the classes * to call the constructor again and re-read our data. */ - ConfigReader* MyConf = new ConfigReader(ServerInstance); + ConfigReader* MyConf = new ConfigReader; censors.clear(); for (int index = 0; index < MyConf->Enumerate("badword"); index++) diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 6cdad0958..1300092c7 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -106,8 +106,8 @@ class CGIResolver : public Resolver User* them; bool notify; public: - CGIResolver(Module* me, InspIRCd* Instance, bool NotifyOpers, const std::string &source, bool forward, User* u, int userfd, const std::string &type, bool &cached) - : Resolver(Instance, source, forward ? DNS_QUERY_A : DNS_QUERY_PTR4, cached, me), typ(type), theirfd(userfd), them(u), notify(NotifyOpers) { } + CGIResolver(Module* me, bool NotifyOpers, const std::string &source, bool forward, User* u, int userfd, const std::string &type, bool &cached) + : Resolver(source, forward ? DNS_QUERY_A : DNS_QUERY_PTR4, cached, me), typ(type), theirfd(userfd), them(u), notify(NotifyOpers) { } virtual void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached) { @@ -146,7 +146,7 @@ class ModuleCgiIRC : public Module CommandWebirc cmd; bool NotifyOpers; public: - ModuleCgiIRC(InspIRCd* Me) : Module(Me), cmd(this, NotifyOpers) + ModuleCgiIRC() : cmd(this, NotifyOpers) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); @@ -167,7 +167,7 @@ public: virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; cmd.Hosts.clear(); NotifyOpers = Conf.ReadFlag("cgiirc", "opernotice", 0); // If we send an oper notice when a CGI:IRC has their host changed. @@ -307,7 +307,7 @@ public: { bool cached; - CGIResolver* r = new CGIResolver(this, ServerInstance, NotifyOpers, user->password, false, user, user->GetFd(), "PASS", cached); + CGIResolver* r = new CGIResolver(this, NotifyOpers, user->password, false, user, user->GetFd(), "PASS", cached); ServerInstance->AddResolver(r, cached); } catch (...) @@ -358,7 +358,7 @@ public: { bool cached; - CGIResolver* r = new CGIResolver(this, ServerInstance, NotifyOpers, newipstr, false, user, user->GetFd(), "IDENT", cached); + CGIResolver* r = new CGIResolver(this, NotifyOpers, newipstr, false, user, user->GetFd(), "IDENT", cached); ServerInstance->AddResolver(r, cached); } catch (...) diff --git a/src/modules/m_chancreate.cpp b/src/modules/m_chancreate.cpp index c31cbe9cf..666353049 100644 --- a/src/modules/m_chancreate.cpp +++ b/src/modules/m_chancreate.cpp @@ -19,9 +19,8 @@ class ModuleChanCreate : public Module { private: public: - ModuleChanCreate(InspIRCd* Me) - : Module(Me) - { + ModuleChanCreate() + { ServerInstance->SNO->EnableSnomask('j', "CHANCREATE"); ServerInstance->SNO->EnableSnomask('J', "REMOTECHANCREATE"); Implementation eventlist[] = { I_OnUserJoin }; diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 7c28036b7..cd7300372 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -25,7 +25,7 @@ class ChanFilter : public ListModeBase { public: - ChanFilter(InspIRCd* Instance, Module* Creator) : ListModeBase(Instance, Creator, 'g', "End of channel spamfilter list", 941, 940, false, "chanfilter") { } + ChanFilter(Module* Creator) : ListModeBase(Creator, 'g', "End of channel spamfilter list", 941, 940, false, "chanfilter") { } virtual bool ValidateParam(User* user, Channel* chan, std::string &word) { @@ -62,8 +62,8 @@ class ModuleChanFilter : public Module public: - ModuleChanFilter(InspIRCd* Me) - : Module(Me), cf(Me, this) + ModuleChanFilter() + : cf(this) { if (!ServerInstance->Modes->AddMode(&cf)) throw ModuleException("Could not add new modes!"); @@ -78,14 +78,14 @@ class ModuleChanFilter : public Module virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; hidemask = Conf.ReadFlag("chanfilter", "hidemask", 0); cf.DoRehash(); } virtual ModResult ProcessMessages(User* user,Channel* chan,std::string &text) { - if (!IS_LOCAL(user) || (CHANOPS_EXEMPT(ServerInstance, 'g') && chan->GetPrefixValue(user) == OP_VALUE)) + if (!IS_LOCAL(user) || (CHANOPS_EXEMPT('g') && chan->GetPrefixValue(user) == OP_VALUE)) return MOD_RES_PASSTHRU; modelist* list = cf.extItem.get(chan); diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index 0e40ba80c..826c6f32f 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -24,8 +24,7 @@ class ModuleChanLog : public Module std::multimap<char, std::string> logstreams; public: - ModuleChanLog(InspIRCd* Me) : Module(Me) - { + ModuleChanLog() { Implementation eventlist[] = { I_OnRehash, I_OnSendSnotice }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -38,7 +37,7 @@ class ModuleChanLog : public Module virtual void OnRehash(User *user) { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; std::string snomasks; std::string channel; @@ -128,7 +127,7 @@ class ChannelLogStream : public LogStream std::string channel; public: - ChannelLogStream(InspIRCd *Instance, int loglevel, const std::string &chan) : LogStream(Instance, loglevel), channel(chan) + ChannelLogStream(int loglevel, const std::string &chan) : LogStream(loglevel), channel(chan) { } diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index a918eefd2..008422c66 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -19,9 +19,8 @@ static bool allowedmap[256]; class NewIsChannelHandler : public HandlerBase2<bool, const char*, size_t> { - InspIRCd* Server; public: - NewIsChannelHandler(InspIRCd* Srv) : Server(Srv) { } + NewIsChannelHandler() { } virtual ~NewIsChannelHandler() { } virtual bool Call(const char*, size_t); }; @@ -44,19 +43,14 @@ bool NewIsChannelHandler::Call(const char* chname, size_t max) class ModuleChannelNames : public Module { private: - InspIRCd* ServerInstance; - NewIsChannelHandler* myhandler; - caller2<bool, const char*, size_t> * rememberer; + NewIsChannelHandler myhandler; + caller2<bool, const char*, size_t> rememberer; bool badchan; public: - ModuleChannelNames(InspIRCd* Me) : Module(Me) + ModuleChannelNames() : rememberer(ServerInstance->IsChannel) { - rememberer = (caller2<bool, const char*, size_t> *) malloc(sizeof(caller2<bool, const char*, size_t>)); - ServerInstance = Me; - *rememberer = ServerInstance->IsChannel; - myhandler = new NewIsChannelHandler(ServerInstance); - ServerInstance->IsChannel = myhandler; + ServerInstance->IsChannel = &myhandler; badchan = false; Implementation eventlist[] = { I_OnRehash, I_OnUserKick }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -95,7 +89,7 @@ class ModuleChannelNames : public Module virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string denyToken = Conf.ReadValue("channames", "denyrange", 0); std::string allowToken = Conf.ReadValue("channames", "allowrange", 0); memset(allowedmap, 1, sizeof(allowedmap)); @@ -130,9 +124,7 @@ class ModuleChannelNames : public Module virtual ~ModuleChannelNames() { - delete myhandler; - ServerInstance->IsChannel = *rememberer; - free(rememberer); + ServerInstance->IsChannel = rememberer; ValidateChans(); } diff --git a/src/modules/m_channelban.cpp b/src/modules/m_channelban.cpp index 387aeb2b9..5b7b326bd 100644 --- a/src/modules/m_channelban.cpp +++ b/src/modules/m_channelban.cpp @@ -19,8 +19,7 @@ class ModuleBadChannelExtban : public Module { private: public: - ModuleBadChannelExtban(InspIRCd* Me) : Module(Me) - { + ModuleBadChannelExtban() { Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 4d046b415..12b5c1db4 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -67,7 +67,7 @@ class FounderProtectBase const UserMembList* cl = channel->GetUsers(); std::vector<std::string> mode_junk; mode_junk.push_back(channel->name); - irc::modestacker modestack(ServerInstance, false); + irc::modestacker modestack(false); std::deque<std::string> stackresult; for (UserMembCIter i = cl->begin(); i != cl->end(); i++) @@ -266,8 +266,8 @@ class ModuleChanProtect : public Module public: - ModuleChanProtect(InspIRCd* Me) - : Module(Me), FirstInGetsFounder(false), QPrefix(0), APrefix(0), DeprivSelf(false), DeprivOthers(false), booting(true), cp(NULL), cf(NULL) + ModuleChanProtect() + : FirstInGetsFounder(false), QPrefix(0), APrefix(0), DeprivSelf(false), DeprivOthers(false), booting(true), cp(NULL), cf(NULL) { /* Load config stuff */ LoadSettings(); @@ -291,7 +291,7 @@ class ModuleChanProtect : public Module void LoadSettings() { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; FirstInGetsFounder = Conf.ReadFlag("chanprotect", "noservices", 0); diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index cf07e3644..e3de63325 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -203,7 +203,7 @@ class ModuleCheck : public Module private: CommandCheck mycommand; public: - ModuleCheck(InspIRCd* Me) : Module(Me), mycommand(this) + ModuleCheck() : mycommand(this) { ServerInstance->AddCommand(&mycommand); } diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 43f6dea7c..fdec5d6d0 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -86,7 +86,7 @@ class ModuleChgHost : public Module CommandChghost cmd; char hostmap[256]; public: - ModuleChgHost(InspIRCd* Me) : cmd(this, hostmap) + ModuleChgHost() : cmd(this, hostmap) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); @@ -97,7 +97,7 @@ class ModuleChgHost : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string hmap = Conf.ReadValue("hostname", "charmap", 0); if (hmap.empty()) diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 34d969c05..135b26446 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -80,7 +80,7 @@ class ModuleChgIdent : public Module CommandChgident cmd; public: - ModuleChgIdent(InspIRCd* Me) : Module(Me), cmd(this) + ModuleChgIdent() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index 506325eee..17ad9dc48 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -72,7 +72,7 @@ class ModuleChgName : public Module CommandChgname cmd; public: - ModuleChgName(InspIRCd* Me) : Module(Me), cmd(this) + ModuleChgName() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 25d997798..2bd8df80e 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -197,7 +197,7 @@ class CloakUser : public ModeHandler void DoRehash() { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; bool lowercase; /* These are *not* using the need_positive parameter of ReadInteger - @@ -256,7 +256,7 @@ class ModuleCloaking : public Module CloakUser* cu; public: - ModuleCloaking(InspIRCd*) + ModuleCloaking() { /* Attempt to locate the md5 service provider, bail if we can't find it */ Module* HashModule = ServerInstance->Modules->Find("m_md5.so"); diff --git a/src/modules/m_clones.cpp b/src/modules/m_clones.cpp index 966f29705..9742ea29d 100644 --- a/src/modules/m_clones.cpp +++ b/src/modules/m_clones.cpp @@ -61,7 +61,7 @@ class ModuleClones : public Module private: CommandClones cmd; public: - ModuleClones(InspIRCd* Me) : Module(Me), cmd(this) + ModuleClones() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp index 762036407..1cddc5012 100644 --- a/src/modules/m_close.cpp +++ b/src/modules/m_close.cpp @@ -68,8 +68,8 @@ class ModuleClose : public Module { CommandClose cmd; public: - ModuleClose(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleClose() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp index 35d7f5179..20b409b9b 100644 --- a/src/modules/m_commonchans.cpp +++ b/src/modules/m_commonchans.cpp @@ -20,7 +20,7 @@ class PrivacyMode : public ModeHandler { public: - PrivacyMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'c', PARAM_NONE, MODETYPE_USER) { } + PrivacyMode(Module* Creator) : ModeHandler(Creator, 'c', PARAM_NONE, MODETYPE_USER) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -49,7 +49,7 @@ class ModulePrivacyMode : public Module { PrivacyMode pm; public: - ModulePrivacyMode(InspIRCd* Me) : Module(Me), pm(Me, this) + ModulePrivacyMode() : pm(this) { if (!ServerInstance->Modes->AddMode(&pm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index af6b50afd..b78cc85be 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -42,9 +42,8 @@ class ModuleConnJoin : public Module } public: - ModuleConnJoin(InspIRCd* Me) - : Module(Me) - { + ModuleConnJoin() + { OnRehash(NULL); Implementation eventlist[] = { I_OnPostConnect, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -58,7 +57,7 @@ class ModuleConnJoin : public Module virtual void OnRehash(User* user) { - ConfigReader* conf = new ConfigReader(ServerInstance); + ConfigReader* conf = new ConfigReader; JoinChan = conf->ReadValue("autojoin", "channel", 0); Joinchans.clear(); if (!JoinChan.empty()) @@ -82,7 +81,7 @@ class ModuleConnJoin : public Module for(std::vector<std::string>::iterator it = Joinchans.begin(); it != Joinchans.end(); it++) if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax)) - Channel::JoinUser(ServerInstance, user, it->c_str(), false, "", false, ServerInstance->Time()); + Channel::JoinUser(user, it->c_str(), false, "", false, ServerInstance->Time()); } }; diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index 195321bfb..2ad8ab876 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -22,10 +22,9 @@ class ModuleModesOnConnect : public Module ConfigReader *Conf; public: - ModuleModesOnConnect(InspIRCd* Me) : Module(Me) - { + ModuleModesOnConnect() { - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; Implementation eventlist[] = { I_OnUserConnect, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); // for things like +x on connect, important, otherwise we have to resort to config order (bleh) -- w00t @@ -36,7 +35,7 @@ class ModuleModesOnConnect : public Module virtual void OnRehash(User* user) { delete Conf; - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; } virtual ~ModuleModesOnConnect() diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index b77116410..46f4a69eb 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -22,8 +22,8 @@ class ModuleWaitPong : public Module LocalStringExt ext; public: - ModuleWaitPong(InspIRCd* Me) - : Module(Me), ext("waitpong_pingstr", this) + ModuleWaitPong() + : ext("waitpong_pingstr", this) { OnRehash(NULL); Implementation eventlist[] = { I_OnUserRegister, I_OnCheckReady, I_OnPreCommand, I_OnRehash }; @@ -32,7 +32,7 @@ class ModuleWaitPong : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; sendsnotice = Conf.ReadFlag("waitpong", "sendsnotice", 0); diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index d5bb20fe3..d13dc1e0a 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -25,8 +25,7 @@ class ModuleConnectBan : public Module unsigned int ipv4_cidr; unsigned int ipv6_cidr; public: - ModuleConnectBan(InspIRCd* Me) : Module(Me) - { + ModuleConnectBan() { Implementation eventlist[] = { I_OnUserConnect, I_OnGarbageCollect, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 3); OnRehash(NULL); @@ -43,7 +42,7 @@ class ModuleConnectBan : public Module virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string duration; ipv4_cidr = Conf.ReadInteger("connectban", "ipv4cidr", 0, true); @@ -91,7 +90,7 @@ class ModuleConnectBan : public Module if (i->second >= threshold) { // Create zline for set duration. - ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), banduration, ServerInstance->Config->ServerName, "Connect flooding", u->GetCIDRMask(range)); + ZLine* zl = new ZLine(ServerInstance->Time(), banduration, ServerInstance->Config->ServerName, "Connect flooding", u->GetCIDRMask(range)); if (ServerInstance->XLines->AddLine(zl,NULL)) ServerInstance->XLines->ApplyLines(); else diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 04fe45627..419dbab9c 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -28,8 +28,7 @@ private: public: - ModuleConnFlood(InspIRCd* Me) : Module(Me) - { + ModuleConnFlood() { InitConf(); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister }; @@ -48,7 +47,7 @@ public: void InitConf() { /* read configuration variables */ - conf = new ConfigReader(ServerInstance); + conf = new ConfigReader; /* throttle configuration */ seconds = conf->ReadInteger("connflood", "seconds", 0, true); maxconns = conf->ReadInteger("connflood", "maxconns", 0, true); diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index aa5749a04..9ff250cd6 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -50,7 +50,7 @@ class CommandTitle : public Command snprintf(TheHost,MAXBUF,"%s@%s",user->ident.c_str(), user->host.c_str()); snprintf(TheIP, MAXBUF,"%s@%s",user->ident.c_str(), user->GetIPString()); - ConfigReader Conf(ServerInstance); + ConfigReader Conf; for (int i=0; i<Conf.Enumerate("title"); i++) { std::string name = Conf.ReadValue("title", "name", "", i); @@ -86,7 +86,7 @@ class ModuleCustomTitle : public Module CommandTitle cmd; public: - ModuleCustomTitle(InspIRCd* Me) : Module(Me), cmd(this) + ModuleCustomTitle() : cmd(this) { ServerInstance->AddCommand(&cmd); Extensible::Register(&cmd.ctitle); diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp index 6ff275689..4b3d3e83b 100644 --- a/src/modules/m_cycle.cpp +++ b/src/modules/m_cycle.cpp @@ -61,7 +61,7 @@ class CommandCycle : public Command if (!channel->PartUser(user, reason)) delete channel; - Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), true, "", false, ServerInstance->Time()); + Channel::JoinUser(user, parameters[0].c_str(), true, "", false, ServerInstance->Time()); } return CMD_SUCCESS; @@ -80,8 +80,8 @@ class ModuleCycle : public Module { CommandCycle cmd; public: - ModuleCycle(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleCycle() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index a25d553d1..10a8d9310 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -239,10 +239,10 @@ class ModuleDCCAllow : public Module CommandDccallow cmd; public: - ModuleDCCAllow(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleDCCAllow() + : cmd(this) { - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; ext = new SimpleExtItem<dccallowlist>("dccallow", this); Extensible::Register(ext); ServerInstance->AddCommand(&cmd); @@ -255,7 +255,7 @@ class ModuleDCCAllow : public Module virtual void OnRehash(User* user) { delete Conf; - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; ReadFileConf(); } diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp index 82da68100..53085271a 100644 --- a/src/modules/m_deaf.cpp +++ b/src/modules/m_deaf.cpp @@ -20,7 +20,7 @@ class User_d : public ModeHandler { public: - User_d(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'd', PARAM_NONE, MODETYPE_USER) { } + User_d(Module* Creator) : ModeHandler(Creator, 'd', PARAM_NONE, MODETYPE_USER) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -53,8 +53,8 @@ class ModuleDeaf : public Module std::string deaf_bypasschars_uline; public: - ModuleDeaf(InspIRCd* Me) - : Module(Me), m1(Me, this) + ModuleDeaf() + : m1(this) { if (!ServerInstance->Modes->AddMode(&m1)) throw ModuleException("Could not add new modes!"); @@ -67,7 +67,7 @@ class ModuleDeaf : public Module virtual void OnRehash(User* user) { - ConfigReader* conf = new ConfigReader(ServerInstance); + ConfigReader* conf = new ConfigReader; deaf_bypasschars = conf->ReadValue("deaf", "bypasschars", 0); deaf_bypasschars_uline = conf->ReadValue("deaf", "bypasscharsuline", 0); diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 182399eaa..41038d9cb 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -19,7 +19,7 @@ class DelayJoinMode : public ModeHandler private: CUList empty; public: - DelayJoinMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Parent, 'D', PARAM_NONE, MODETYPE_CHANNEL) + DelayJoinMode(Module* Parent) : ModeHandler(Parent, 'D', PARAM_NONE, MODETYPE_CHANNEL) { levelrequired = OP_VALUE; } @@ -32,7 +32,7 @@ class ModuleDelayJoin : public Module DelayJoinMode djm; public: LocalIntExt unjoined; - ModuleDelayJoin(InspIRCd* Me) : Module(Me), djm(Me, this), unjoined("delayjoin", this) + ModuleDelayJoin() : djm(this), unjoined("delayjoin", this) { if (!ServerInstance->Modes->AddMode(&djm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index 9acfc57ea..7931a5982 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -22,7 +22,7 @@ class DelayMsgMode : public ModeHandler CUList empty; public: LocalIntExt jointime; - DelayMsgMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Parent, 'd', PARAM_SETONLY, MODETYPE_CHANNEL) + DelayMsgMode(Module* Parent) : ModeHandler(Parent, 'd', PARAM_SETONLY, MODETYPE_CHANNEL) , jointime("delaymsg", Parent) { levelrequired = OP_VALUE; @@ -54,7 +54,7 @@ class ModuleDelayMsg : public Module private: DelayMsgMode djm; public: - ModuleDelayMsg(InspIRCd* Me) : Module(Me), djm(Me, this) + ModuleDelayMsg() : djm(this) { if (!ServerInstance->Modes->AddMode(&djm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index f47d414bd..f95c0b107 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -23,10 +23,9 @@ class ModuleDenyChannels : public Module ConfigReader *Conf; public: - ModuleDenyChannels(InspIRCd* Me) : Module(Me) - { + ModuleDenyChannels() { - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); } @@ -34,7 +33,7 @@ class ModuleDenyChannels : public Module virtual void OnRehash(User* user) { delete Conf; - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; /* check for redirect validity and loops/chains */ for (int i =0; i < Conf->Enumerate("badchan"); i++) { @@ -116,7 +115,7 @@ class ModuleDenyChannels : public Module if ((!newchan) || (!(newchan->IsModeSet('L')))) { user->WriteNumeric(926, "%s %s :Channel %s is forbidden, redirecting to %s: %s",user->nick.c_str(),cname,cname,redirect.c_str(), reason.c_str()); - Channel::JoinUser(ServerInstance,user,redirect.c_str(),false,"",false,ServerInstance->Time()); + Channel::JoinUser(user,redirect.c_str(),false,"",false,ServerInstance->Time()); return MOD_RES_DENY; } } diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp index 2e590095f..7c2dcb3d8 100644 --- a/src/modules/m_devoice.cpp +++ b/src/modules/m_devoice.cpp @@ -54,7 +54,7 @@ class ModuleDeVoice : public Module { CommandDevoice cmd; public: - ModuleDeVoice(InspIRCd* Me) : Module(Me), cmd(this) + ModuleDeVoice() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 06709979b..cb32ede78 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -51,8 +51,8 @@ class DNSBLResolver : public Resolver public: - DNSBLResolver(Module *me, InspIRCd *Instance, const std::string &hostname, User* u, int userfd, DNSBLConfEntry *conf, bool &cached) - : Resolver(Instance, hostname, DNS_QUERY_A, cached, me) + DNSBLResolver(Module *me, const std::string &hostname, User* u, int userfd, DNSBLConfEntry *conf, bool &cached) + : Resolver(hostname, DNS_QUERY_A, cached, me) { theirfd = userfd; them = u; @@ -125,7 +125,7 @@ class DNSBLResolver : public Resolver } case DNSBLConfEntry::I_KLINE: { - KLine* kl = new KLine(ServerInstance, ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), + KLine* kl = new KLine(ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), "*", them->GetIPString()); if (ServerInstance->XLines->AddLine(kl,NULL)) { @@ -139,7 +139,7 @@ class DNSBLResolver : public Resolver } case DNSBLConfEntry::I_GLINE: { - GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), + GLine* gl = new GLine(ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), "*", them->GetIPString()); if (ServerInstance->XLines->AddLine(gl,NULL)) { @@ -153,7 +153,7 @@ class DNSBLResolver : public Resolver } case DNSBLConfEntry::I_ZLINE: { - ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), + ZLine* zl = new ZLine(ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), them->GetIPString()); if (ServerInstance->XLines->AddLine(zl,NULL)) { @@ -215,8 +215,7 @@ class ModuleDNSBL : public Module return DNSBLConfEntry::I_UNKNOWN; } public: - ModuleDNSBL(InspIRCd *Me) : Module(Me) - { + ModuleDNSBL() { ReadConf(); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnStats }; ServerInstance->Modules->Attach(eventlist, this, 3); @@ -246,7 +245,7 @@ class ModuleDNSBL : public Module */ virtual void ReadConf() { - ConfigReader *MyConf = new ConfigReader(ServerInstance); + ConfigReader *MyConf = new ConfigReader; ClearEntries(); for (int i=0; i< MyConf->Enumerate("dnsbl"); i++) @@ -358,7 +357,7 @@ class ModuleDNSBL : public Module /* now we'd need to fire off lookups for `hostname'. */ bool cached; - DNSBLResolver *r = new DNSBLResolver(this, ServerInstance, hostname, user, user->GetFd(), *i, cached); + DNSBLResolver *r = new DNSBLResolver(this, hostname, user, user->GetFd(), *i, cached); ServerInstance->AddResolver(r, cached); } } diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 0c020513f..b6dbee4ea 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -101,7 +101,7 @@ class CommandFilter : public Command { FilterBase* Base; public: - CommandFilter(FilterBase* f, const std::string &ssource) + CommandFilter(FilterBase* f) : Command(reinterpret_cast<Module*>(f), "FILTER", 1, 5), Base(f) { flags_needed = 'o'; @@ -127,7 +127,7 @@ class FilterBase : public Module protected: std::vector<std::string> exemptfromfilter; // List of channel names excluded from filtering. public: - FilterBase(InspIRCd* Me, const std::string &source); + FilterBase(); virtual ~FilterBase(); virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); virtual FilterResult* FilterMatch(User* user, const std::string &text, int flags) = 0; @@ -242,9 +242,9 @@ bool FilterBase::AppliesToMe(User* user, FilterResult* filter, int iflags) return true; } -FilterBase::FilterBase(InspIRCd* Me, const std::string &source) : Module(Me), filtcommand(this, source) +FilterBase::FilterBase() : filtcommand(this) { - Me->Modules->UseInterface("RegularExpression"); + ServerInstance->Modules->UseInterface("RegularExpression"); ServerInstance->AddCommand(&filtcommand); Implementation eventlist[] = { I_OnPreCommand, I_OnStats, I_OnSyncNetwork, I_OnDecodeMetaData, I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash, I_OnLoadModule }; ServerInstance->Modules->Attach(eventlist, this, 8); @@ -310,7 +310,7 @@ ModResult FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std } if (f->action == "gline") { - GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString()); + GLine* gl = new GLine(ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString()); if (ServerInstance->XLines->AddLine(gl,NULL)) { ServerInstance->XLines->ApplyLines(); @@ -399,7 +399,7 @@ ModResult FilterBase::OnPreCommand(std::string &command, std::vector<std::string if (f->action == "gline") { /* Note: We gline *@IP so that if their host doesnt resolve the gline still applies. */ - GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString()); + GLine* gl = new GLine(ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString()); if (ServerInstance->XLines->AddLine(gl,NULL)) { ServerInstance->XLines->ApplyLines(); @@ -417,7 +417,7 @@ ModResult FilterBase::OnPreCommand(std::string &command, std::vector<std::string void FilterBase::OnRehash(User* user) { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; std::vector<std::string>().swap(exemptfromfilter); for (int index = 0; index < MyConf.Enumerate("exemptfromfilter"); ++index) { @@ -467,7 +467,7 @@ void FilterBase::OnLoadModule(Module* mod, const std::string& name) /* Force a rehash to make sure that any filters that couldnt be applied from the conf * on startup or on load are applied right now. */ - ConfigReader Config(ServerInstance); + ConfigReader Config; ServerInstance->SNO->WriteGlobalSno('a', "Found and activated regex module '%s' for m_filter.so.", RegexEngine.c_str()); ReadFilters(Config); } @@ -562,8 +562,7 @@ class ModuleFilter : public FilterBase ImplFilter fr; public: - ModuleFilter(InspIRCd* Me) - : FilterBase(Me, "m_filter.so") + ModuleFilter() { OnRehash(NULL); } @@ -644,7 +643,7 @@ class ModuleFilter : public FilterBase virtual void OnRehash(User* user) { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; FilterBase::OnRehash(user); ReadFilters(MyConf); } diff --git a/src/modules/m_gecosban.cpp b/src/modules/m_gecosban.cpp index 0a868d347..9d1550b38 100644 --- a/src/modules/m_gecosban.cpp +++ b/src/modules/m_gecosban.cpp @@ -19,8 +19,7 @@ class ModuleGecosBan : public Module { private: public: - ModuleGecosBan(InspIRCd* Me) : Module(Me) - { + ModuleGecosBan() { Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 19359a976..348984e14 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -142,8 +142,8 @@ class ModuleGlobalLoad : public Module CommandGreloadmodule cmd3; public: - ModuleGlobalLoad(InspIRCd* Me) - : Module(Me), cmd1(this), cmd2(this), cmd3(this) + ModuleGlobalLoad() + : cmd1(this), cmd2(this), cmd3(this) { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index 81d969979..3574ad605 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -51,8 +51,8 @@ class ModuleGlobops : public Module { CommandGlobops cmd; public: - ModuleGlobops(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleGlobops() + : cmd(this) { ServerInstance->AddCommand(&cmd); ServerInstance->SNO->EnableSnomask('g',"GLOBOPS"); diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index f16c64e82..bcf1f1e20 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -22,7 +22,7 @@ static std::map<irc::string, std::string> helpop_map; class Helpop : public ModeHandler { public: - Helpop(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'h', PARAM_NONE, MODETYPE_USER) + Helpop(Module* Creator) : ModeHandler(Creator, 'h', PARAM_NONE, MODETYPE_USER) { oper = true; } @@ -120,8 +120,8 @@ class ModuleHelpop : public Module Helpop ho; public: - ModuleHelpop(InspIRCd* Me) - : Module(Me), cmd(this), ho(Me, this) + ModuleHelpop() + : cmd(this), ho(this) { ReadConfig(); if (!ServerInstance->Modes->AddMode(&ho)) @@ -133,7 +133,7 @@ class ModuleHelpop : public Module virtual void ReadConfig() { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; helpop_map.clear(); diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp index 6c3dba88f..0d405186b 100644 --- a/src/modules/m_hidechans.cpp +++ b/src/modules/m_hidechans.cpp @@ -20,7 +20,7 @@ class HideChans : public ModeHandler { public: - HideChans(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'I', PARAM_NONE, MODETYPE_USER) { } + HideChans(Module* Creator) : ModeHandler(Creator, 'I', PARAM_NONE, MODETYPE_USER) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -50,7 +50,7 @@ class ModuleHideChans : public Module bool AffectsOpers; HideChans hm; public: - ModuleHideChans(InspIRCd* Me) : Module(Me), hm(Me, this) + ModuleHideChans() : hm(this) { if (!ServerInstance->Modes->AddMode(&hm)) throw ModuleException("Could not add new modes!"); @@ -71,7 +71,7 @@ class ModuleHideChans : public Module virtual void OnRehash(User* user) { - ConfigReader conf(ServerInstance); + ConfigReader conf; AffectsOpers = conf.ReadFlag("hidechans", "affectsopers", 0); } diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index 8294f5390..b9ea5fa2a 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -20,7 +20,7 @@ class HideOper : public ModeHandler { public: - HideOper(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'H', PARAM_NONE, MODETYPE_USER) + HideOper(Module* Creator) : ModeHandler(Creator, 'H', PARAM_NONE, MODETYPE_USER) { oper = true; } @@ -52,8 +52,8 @@ class ModuleHideOper : public Module { HideOper hm; public: - ModuleHideOper(InspIRCd* Me) - : Module(Me), hm(Me, this) + ModuleHideOper() + : hm(this) { if (!ServerInstance->Modes->AddMode(&hm)) diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index a89b5949d..cb5ab6925 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -36,9 +36,8 @@ class ModuleHostChange : public Module std::string MySeparator; public: - ModuleHostChange(InspIRCd* Me) - : Module(Me) - { + ModuleHostChange() + { OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnUserConnect }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -62,7 +61,7 @@ class ModuleHostChange : public Module virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; MySuffix = Conf.ReadValue("host","suffix",0); MyPrefix = Conf.ReadValue("host","prefix","",0); MySeparator = Conf.ReadValue("host","separator",".",0); diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 929697c5f..e9d05d3e5 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -315,11 +315,11 @@ class HttpServerSocket : public BufferedSocket claimed = false; HTTPRequest httpr(request_type,uri,&headers,this,ip,postdata); Event acl((char*)&httpr, (Module*)HttpModule, "httpd_acl"); - acl.Send(ServerInstance); + acl.Send(); if (!claimed) { Event e((char*)&httpr, (Module*)HttpModule, "httpd_url"); - e.Send(ServerInstance); + e.Send(); if (!claimed) { SendHTTPError(404); @@ -342,7 +342,7 @@ class HttpListener : public ListenSocketBase FileReader* index; public: - HttpListener(InspIRCd* Instance, FileReader *idx, int port, const std::string &addr) : ListenSocketBase(Instance, port, addr) + HttpListener(FileReader *idx, int port, const std::string &addr) : ListenSocketBase(port, addr) { this->index = idx; } @@ -370,7 +370,7 @@ class ModuleHttpServer : public Module std::string indexfile; FileReader* index; HttpListener *http; - ConfigReader c(ServerInstance); + ConfigReader c; httpsocks.clear(); // XXX this will BREAK if this module is made rehashable httplisteners.clear(); @@ -381,16 +381,15 @@ class ModuleHttpServer : public Module bindip = c.ReadValue("http", "ip", i); port = c.ReadInteger("http", "port", i, true); indexfile = c.ReadValue("http", "index", i); - index = new FileReader(ServerInstance, indexfile); + index = new FileReader(indexfile); if (!index->Exists()) throw ModuleException("Can't read index file: "+indexfile); - http = new HttpListener(ServerInstance, index, port, (char *)bindip.c_str()); // XXX this cast SUCKS. + http = new HttpListener(index, port, (char *)bindip.c_str()); // XXX this cast SUCKS. httplisteners.push_back(http); } } - ModuleHttpServer(InspIRCd* Me) : Module(Me) - { + ModuleHttpServer() { ReadConfig(); HttpModule = this; Implementation eventlist[] = { I_OnRequest }; diff --git a/src/modules/m_httpd_acl.cpp b/src/modules/m_httpd_acl.cpp index 812ea843f..8c682cfa9 100644 --- a/src/modules/m_httpd_acl.cpp +++ b/src/modules/m_httpd_acl.cpp @@ -47,7 +47,7 @@ class ModuleHTTPAccessList : public Module void ReadConfig() { acl_list.clear(); - ConfigReader c(ServerInstance); + ConfigReader c; int n_items = c.Enumerate("httpdacl"); for (int i = 0; i < n_items; ++i) { @@ -88,8 +88,7 @@ class ModuleHTTPAccessList : public Module } } - ModuleHTTPAccessList(InspIRCd* Me) : Module(Me) - { + ModuleHTTPAccessList() { ReadConfig(); Implementation eventlist[] = { I_OnEvent, I_OnRequest }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_httpd_config.cpp b/src/modules/m_httpd_config.cpp index 5f902eb29..55f943d2c 100644 --- a/src/modules/m_httpd_config.cpp +++ b/src/modules/m_httpd_config.cpp @@ -28,12 +28,11 @@ class ModuleHttpStats : public Module void ReadConfig() { - ConfigReader c(ServerInstance); + ConfigReader c; this->stylesheet = c.ReadValue("httpstats", "stylesheet", 0); } - ModuleHttpStats(InspIRCd* Me) : Module(Me) - { + ModuleHttpStats() { ReadConfig(); this->changed = true; Implementation eventlist[] = { I_OnEvent, I_OnRequest }; diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 01d77d806..46f474e2d 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -28,12 +28,11 @@ class ModuleHttpStats : public Module void ReadConfig() { - ConfigReader c(ServerInstance); + ConfigReader c; this->stylesheet = c.ReadValue("httpstats", "stylesheet", 0); } - ModuleHttpStats(InspIRCd* Me) : Module(Me) - { + ModuleHttpStats() { ReadConfig(); this->changed = true; Implementation eventlist[] = { I_OnEvent, I_OnRequest }; diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 66bd8835a..d74873e00 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -75,13 +75,12 @@ class IdentRequestSocket : public EventHandler { private: User *user; /* User we are attached to */ - InspIRCd* ServerInstance; /* Server instance */ bool done; /* True if lookup is finished */ std::string result; /* Holds the ident string if done */ public: time_t age; - IdentRequestSocket(InspIRCd *Server, User* u) : user(u), ServerInstance(Server), result(u->ident) + IdentRequestSocket(User* u) : user(u), result(u->ident) { age = ServerInstance->Time(); socklen_t size = 0; @@ -280,9 +279,9 @@ class ModuleIdent : public Module ConfigReader *Conf; SimpleExtItem<IdentRequestSocket> ext; public: - ModuleIdent(InspIRCd *Me) : Module(Me), ext("ident_socket", this) + ModuleIdent() : ext("ident_socket", this) { - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCheckReady, I_OnCleanup, I_OnUserDisconnect }; ServerInstance->Modules->Attach(eventlist, this, 5); @@ -301,7 +300,7 @@ class ModuleIdent : public Module virtual void OnRehash(User *user) { delete Conf; - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; RequestTimeout = Conf->ReadInteger("ident", "timeout", 0, true); if (!RequestTimeout) @@ -333,7 +332,7 @@ class ModuleIdent : public Module try { - IdentRequestSocket *isock = new IdentRequestSocket(ServerInstance, user); + IdentRequestSocket *isock = new IdentRequestSocket(user); ext.set(user, isock); } catch (ModuleException &e) diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index 068e6d666..cfccc3de7 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -19,7 +19,7 @@ class InvisibleMode : public ModeHandler { public: - InvisibleMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'Q', PARAM_NONE, MODETYPE_USER) + InvisibleMode(Module* Creator) : ModeHandler(Creator, 'Q', PARAM_NONE, MODETYPE_USER) { oper = true; } @@ -80,7 +80,7 @@ class InvisibleMode : public ModeHandler class InvisibleDeOper : public ModeWatcher { public: - InvisibleDeOper(InspIRCd* Instance) : ModeWatcher(Instance, 'o', MODETYPE_USER) + InvisibleDeOper() : ModeWatcher('o', MODETYPE_USER) { } @@ -105,8 +105,7 @@ class ModuleInvisible : public Module InvisibleMode qm; InvisibleDeOper ido; public: - ModuleInvisible(InspIRCd* Me) - : Module(Me), qm(Me, this), ido(Me) + ModuleInvisible() : qm(this) { if (!ServerInstance->Modes->AddMode(&qm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index e2a68120b..777e8efd7 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -27,21 +27,19 @@ * Now supports CIDR and IP addresses -- Brain */ -class InspIRCd* ServerInstance; - /** Handles channel mode +I */ class InviteException : public ListModeBase { public: - InviteException(InspIRCd* Instance, Module* Creator) : ListModeBase(Instance, Creator, 'I', "End of Channel Invite Exception List", 346, 347, true) { } + InviteException(Module* Creator) : ListModeBase(Creator, 'I', "End of Channel Invite Exception List", 346, 347, true) { } }; class ModuleInviteException : public Module { InviteException ie; public: - ModuleInviteException(InspIRCd* Me) : Module(Me), ie(Me, this) + ModuleInviteException() : ie(this) { if (!ServerInstance->Modes->AddMode(&ie)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 854276500..2520cbfcf 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -19,8 +19,6 @@ */ class joinfloodsettings : public classbase { - private: - InspIRCd* ServerInstance; public: int secs; int joins; @@ -29,7 +27,7 @@ class joinfloodsettings : public classbase int counter; bool locked; - joinfloodsettings(InspIRCd *Instance, int b, int c) : ServerInstance(Instance), secs(b), joins(c) + joinfloodsettings(int b, int c) : secs(b), joins(c) { reset = ServerInstance->Time() + secs; counter = 0; @@ -87,7 +85,7 @@ class JoinFlood : public ModeHandler { public: SimpleExtItem<joinfloodsettings> ext; - JoinFlood(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'j', PARAM_SETONLY, MODETYPE_CHANNEL), + JoinFlood(Module* Creator) : ModeHandler(Creator, 'j', PARAM_SETONLY, MODETYPE_CHANNEL), ext("joinflood", Creator) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) @@ -137,7 +135,7 @@ class JoinFlood : public ModeHandler if (!f) { parameter = ConvToStr(njoins) + ":" +ConvToStr(nsecs); - f = new joinfloodsettings(ServerInstance, nsecs, njoins); + f = new joinfloodsettings(nsecs, njoins); ext.set(channel, f); channel->SetModeParam('j', parameter); return MODEACTION_ALLOW; @@ -156,7 +154,7 @@ class JoinFlood : public ModeHandler // new mode param, replace old with new if ((nsecs > 0) && (njoins > 0)) { - f = new joinfloodsettings(ServerInstance, nsecs, njoins); + f = new joinfloodsettings(nsecs, njoins); ext.set(channel, f); channel->SetModeParam('j', parameter); return MODEACTION_ALLOW; @@ -196,8 +194,8 @@ class ModuleJoinFlood : public Module public: - ModuleJoinFlood(InspIRCd* Me) - : Module(Me), jf(Me, this) + ModuleJoinFlood() + : jf(this) { if (!ServerInstance->Modes->AddMode(&jf)) diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index 78d4bf4b8..0e8f13c4d 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -135,7 +135,7 @@ class ModuleJumpServer : public Module { CommandJumpserver js; public: - ModuleJumpServer(InspIRCd* Me) : js(this) + ModuleJumpServer() : js(this) { ServerInstance->AddCommand(&js); Implementation eventlist[] = { I_OnUserRegister }; diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 05deee417..33eefadb2 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -31,7 +31,7 @@ class KickRejoin : public ModeHandler { public: SimpleExtItem<delaylist> ext; - KickRejoin(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'J', PARAM_SETONLY, MODETYPE_CHANNEL), + KickRejoin(Module* Creator) : ModeHandler(Creator, 'J', PARAM_SETONLY, MODETYPE_CHANNEL), ext("norejoinusers", Creator) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) @@ -104,8 +104,8 @@ class ModuleKickNoRejoin : public Module public: - ModuleKickNoRejoin(InspIRCd* Me) - : Module(Me), kr(Me, this) + ModuleKickNoRejoin() + : kr(this) { if (!ServerInstance->Modes->AddMode(&kr)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index e2f9310d6..28b3b1c50 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -77,7 +77,7 @@ class CommandKnock : public Command class Knock : public SimpleChannelModeHandler { public: - Knock(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'K') { } + Knock(Module* Creator) : SimpleChannelModeHandler(Creator, 'K') { } }; class ModuleKnock : public Module @@ -85,7 +85,7 @@ class ModuleKnock : public Module CommandKnock cmd; Knock kn; public: - ModuleKnock(InspIRCd* Me) : Module(Me), cmd(this), kn(Me, this) + ModuleKnock() : cmd(this), kn(this) { if (!ServerInstance->Modes->AddMode(&kn)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index 6844fc953..78c15dead 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -74,7 +74,7 @@ private: } public: - ModuleLockserv(InspIRCd* Me) : lockcommand(this, locked), unlockcommand(this, locked) + ModuleLockserv() : lockcommand(this, locked), unlockcommand(this, locked) { ResetLocked(); ServerInstance->AddCommand(&lockcommand); diff --git a/src/modules/m_maphide.cpp b/src/modules/m_maphide.cpp index 9a46df1d4..4c9d0591f 100644 --- a/src/modules/m_maphide.cpp +++ b/src/modules/m_maphide.cpp @@ -19,9 +19,8 @@ class ModuleMapHide : public Module { std::string url; public: - ModuleMapHide(InspIRCd* Me) - : Module(Me) - { + ModuleMapHide() + { ServerInstance->Modules->Attach(I_OnPreCommand, this); ServerInstance->Modules->Attach(I_OnRehash, this); OnRehash(NULL); @@ -29,7 +28,7 @@ class ModuleMapHide : public Module void OnRehash(User* user) { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; url = MyConf.ReadValue("security", "maphide", 0); } diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp index 2771ba495..911f6d926 100644 --- a/src/modules/m_md5.cpp +++ b/src/modules/m_md5.cpp @@ -264,8 +264,8 @@ class ModuleMD5 : public Module public: - ModuleMD5(InspIRCd* Me) - : Module(Me), key(NULL), chars(NULL) + ModuleMD5() + : key(NULL), chars(NULL) { ServerInstance->Modules->PublishInterface("HashRequest", this); Implementation eventlist[] = { I_OnRequest }; diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 611ff953f..5a40664d9 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -28,7 +28,7 @@ class floodsettings : public classbase time_t reset; std::map<User*,int> counters; - floodsettings(InspIRCd *Instance, bool a, int b, int c) : ServerInstance(Instance), ban(a), secs(b), lines(c) + floodsettings(bool a, int b, int c) : ban(a), secs(b), lines(c) { reset = ServerInstance->Time() + secs; }; @@ -77,7 +77,7 @@ class MsgFlood : public ModeHandler { public: SimpleExtItem<floodsettings> ext; - MsgFlood(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'f', PARAM_SETONLY, MODETYPE_CHANNEL), + MsgFlood(Module* Creator) : ModeHandler(Creator, 'f', PARAM_SETONLY, MODETYPE_CHANNEL), ext("messageflood", Creator) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) @@ -137,7 +137,7 @@ class MsgFlood : public ModeHandler if (!f) { parameter = std::string(ban ? "*" : "") + ConvToStr(nlines) + ":" +ConvToStr(nsecs); - f = new floodsettings(ServerInstance,ban,nsecs,nlines); + f = new floodsettings(ban,nsecs,nlines); ext.set(channel, f); channel->SetModeParam('f', parameter); return MODEACTION_ALLOW; @@ -155,7 +155,7 @@ class MsgFlood : public ModeHandler { if ((((nlines != f->lines) || (nsecs != f->secs) || (ban != f->ban))) && (((nsecs > 0) && (nlines > 0)))) { - floodsettings *fs = new floodsettings(ServerInstance,ban,nsecs,nlines); + floodsettings *fs = new floodsettings(ban,nsecs,nlines); ext.set(channel, fs); channel->SetModeParam('f', parameter); return MODEACTION_ALLOW; @@ -195,8 +195,8 @@ class ModuleMsgFlood : public Module public: - ModuleMsgFlood(InspIRCd* Me) - : Module(Me), mf(Me, this) + ModuleMsgFlood() + : mf(this) { if (!ServerInstance->Modes->AddMode(&mf)) throw ModuleException("Could not add new modes!"); @@ -207,7 +207,7 @@ class ModuleMsgFlood : public Module ModResult ProcessMessages(User* user,Channel* dest, const std::string &text) { - if (!IS_LOCAL(user) || (CHANOPS_EXEMPT(ServerInstance, 'f') && dest->GetPrefixValue(user) == OP_VALUE)) + if (!IS_LOCAL(user) || (CHANOPS_EXEMPT('f') && dest->GetPrefixValue(user) == OP_VALUE)) { return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_muteban.cpp b/src/modules/m_muteban.cpp index 6040252c1..6e3ca525f 100644 --- a/src/modules/m_muteban.cpp +++ b/src/modules/m_muteban.cpp @@ -19,8 +19,7 @@ class ModuleQuietBan : public Module { private: public: - ModuleQuietBan(InspIRCd* Me) : Module(Me) - { + ModuleQuietBan() { Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 3); } diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index 6f954df64..7614cdc76 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -20,7 +20,7 @@ class ModuleNamesX : public Module { public: GenericCap cap; - ModuleNamesX(InspIRCd* Me) : Module(Me), cap(this, "multi-prefix") + ModuleNamesX() : cap(this, "multi-prefix") { Implementation eventlist[] = { I_OnPreCommand, I_OnNamesListItem, I_On005Numeric, I_OnEvent }; ServerInstance->Modules->Attach(eventlist, this, 4); diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index 2fe8dcf39..04b53f02c 100755 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -24,9 +24,8 @@ class lwbNickHandler : public HandlerBase2<bool, const char*, size_t> { - InspIRCd* Server; public: - lwbNickHandler(InspIRCd* Srv) : Server(Srv) { } + lwbNickHandler() { } virtual ~lwbNickHandler() { } virtual bool Call(const char*, size_t); }; @@ -214,29 +213,21 @@ bool lwbNickHandler::Call(const char* n, size_t max) class ModuleNationalChars : public Module { private: - - InspIRCd* ServerInstance; - lwbNickHandler* myhandler; + lwbNickHandler myhandler; std::string charset, casemapping; unsigned char m_additional[256], m_additionalUp[256], m_lower[256], m_upper[256]; - caller2<bool, const char*, size_t> * rememberer; + caller2<bool, const char*, size_t> rememberer; bool forcequit; const unsigned char * lowermap_rememberer; public: - ModuleNationalChars(InspIRCd* Me) : Module(Me) + ModuleNationalChars() : rememberer(ServerInstance->IsNick) { - rememberer = (caller2<bool, const char*, size_t> *) malloc(sizeof(caller2<bool, const char*, size_t>)); - lowermap_rememberer = national_case_insensitive_map; memcpy(m_lower, rfc_case_insensitive_map, 256); national_case_insensitive_map = m_lower; - ServerInstance = Me; - - *rememberer = ServerInstance->IsNick; - myhandler = new lwbNickHandler(ServerInstance); - ServerInstance->IsNick = myhandler; + ServerInstance->IsNick = &myhandler; Implementation eventlist[] = { I_OnRehash, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -252,7 +243,7 @@ class ModuleNationalChars : public Module virtual void OnRehash(User* user) { - ConfigReader* conf = new ConfigReader(ServerInstance); + ConfigReader* conf = new ConfigReader; charset = conf->ReadValue("nationalchars", "file", 0); casemapping = conf->ReadValue("nationalchars", "casemapping", charset, 0, false); charset.insert(0, "../locales/"); @@ -279,9 +270,7 @@ class ModuleNationalChars : public Module virtual ~ModuleNationalChars() { - delete myhandler; - ServerInstance->IsNick = *rememberer; - free(rememberer); + ServerInstance->IsNick = rememberer; national_case_insensitive_map = lowermap_rememberer; CheckForceQuit("National characters module unloaded"); } diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 5a59814d4..4e6dca5b9 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -19,8 +19,6 @@ */ class nickfloodsettings : public classbase { - private: - InspIRCd* ServerInstance; public: int secs; int nicks; @@ -29,9 +27,9 @@ class nickfloodsettings : public classbase int counter; bool locked; - nickfloodsettings(InspIRCd *Instance, int b, int c) : ServerInstance(Instance), secs(b), nicks(c) + nickfloodsettings(int b, int c) : secs(b), nicks(c) { - reset = Instance->Time() + secs; + reset = ServerInstance->Time() + secs; counter = 0; locked = false; }; @@ -91,7 +89,7 @@ class NickFlood : public ModeHandler { public: SimpleExtItem<nickfloodsettings> ext; - NickFlood(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'F', PARAM_SETONLY, MODETYPE_CHANNEL), + NickFlood(Module* Creator) : ModeHandler(Creator, 'F', PARAM_SETONLY, MODETYPE_CHANNEL), ext("nickflood", Creator) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) @@ -140,7 +138,7 @@ class NickFlood : public ModeHandler if (!f) { parameter = ConvToStr(nnicks) + ":" +ConvToStr(nsecs); - f = new nickfloodsettings(ServerInstance, nsecs, nnicks); + f = new nickfloodsettings(nsecs, nnicks); ext.set(channel, f); channel->SetModeParam('F', parameter); return MODEACTION_ALLOW; @@ -159,7 +157,7 @@ class NickFlood : public ModeHandler // new mode param, replace old with new if ((nsecs > 0) && (nnicks > 0)) { - f = new nickfloodsettings(ServerInstance, nsecs, nnicks); + f = new nickfloodsettings(nsecs, nnicks); ext.set(channel, f); channel->SetModeParam('F', parameter); return MODEACTION_ALLOW; @@ -197,8 +195,8 @@ class ModuleNickFlood : public Module public: - ModuleNickFlood(InspIRCd* Me) - : Module(Me), nf(Me, this) + ModuleNickFlood() + : nf(this) { if (!ServerInstance->Modes->AddMode(&nf)) throw ModuleException("Could not add new modes!"); @@ -219,7 +217,7 @@ class ModuleNickFlood : public Module nickfloodsettings *f = nf.ext.get(channel); if (f) { - if (CHANOPS_EXEMPT(ServerInstance, 'F') && channel->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('F') && channel->GetPrefixValue(user) == OP_VALUE) continue; if (f->islocked()) @@ -256,7 +254,7 @@ class ModuleNickFlood : public Module nickfloodsettings *f = nf.ext.get(channel); if (f) { - if (CHANOPS_EXEMPT(ServerInstance, 'F') && channel->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('F') && channel->GetPrefixValue(user) == OP_VALUE) return; /* moved this here to avoid incrementing the counter for nick diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 7e1309457..755ae6da4 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -151,8 +151,8 @@ class ModuleNickLock : public Module CommandNicklock cmd1; CommandNickunlock cmd2; public: - ModuleNickLock(InspIRCd* Me) - : Module(Me), locked("nick_locked", this), cmd1(this, locked), cmd2(this, locked) + ModuleNickLock() + : locked("nick_locked", this), cmd1(this, locked), cmd2(this, locked) { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index eaadb59fe..58b9b7dcb 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -18,7 +18,7 @@ class NoCTCP : public ModeHandler { public: - NoCTCP(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'C', PARAM_NONE, MODETYPE_CHANNEL) { } + NoCTCP(Module* Creator) : ModeHandler(Creator, 'C', PARAM_NONE, MODETYPE_CHANNEL) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -50,8 +50,8 @@ class ModuleNoCTCP : public Module public: - ModuleNoCTCP(InspIRCd* Me) - : Module(Me), nc(Me, this) + ModuleNoCTCP() + : nc(this) { if (!ServerInstance->Modes->AddMode(&nc)) throw ModuleException("Could not add new modes!"); @@ -80,7 +80,7 @@ class ModuleNoCTCP : public Module { Channel* c = (Channel*)dest; - if (CHANOPS_EXEMPT(ServerInstance, 'C') && c->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('C') && c->GetPrefixValue(user) == OP_VALUE) { return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index b060d87f8..db77184d6 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -18,7 +18,7 @@ class NoKicks : public SimpleChannelModeHandler { public: - NoKicks(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'Q') { } + NoKicks(Module* Creator) : SimpleChannelModeHandler(Creator, 'Q') { } }; class ModuleNoKicks : public Module @@ -26,8 +26,8 @@ class ModuleNoKicks : public Module NoKicks nk; public: - ModuleNoKicks(InspIRCd* Me) - : Module(Me), nk(Me, this) + ModuleNoKicks() + : nk(this) { if (!ServerInstance->Modes->AddMode(&nk)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 456d83580..2ed25dfe5 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -18,7 +18,7 @@ class NoNicks : public ModeHandler { public: - NoNicks(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'N', PARAM_NONE, MODETYPE_CHANNEL) { } + NoNicks(Module* Creator) : ModeHandler(Creator, 'N', PARAM_NONE, MODETYPE_CHANNEL) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -47,7 +47,7 @@ class ModuleNoNickChange : public Module { NoNicks nn; public: - ModuleNoNickChange(InspIRCd* Me) : Module(Me), nn(Me, this) + ModuleNoNickChange() : nn(this) { ServerInstance->Modes->AddMode(&nn); Implementation eventlist[] = { I_OnUserPreNick, I_On005Numeric }; @@ -86,7 +86,7 @@ class ModuleNoNickChange : public Module { Channel* curr = *i; - if (CHANOPS_EXEMPT(ServerInstance, 'N') && curr->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('N') && curr->GetPrefixValue(user) == OP_VALUE) continue; if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet('N'))) diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index e5a3f9996..c3523a7ef 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -18,7 +18,7 @@ class NoNotice : public SimpleChannelModeHandler { public: - NoNotice(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'T') { } + NoNotice(Module* Creator) : SimpleChannelModeHandler(Creator, 'T') { } }; class ModuleNoNotice : public Module @@ -26,8 +26,8 @@ class ModuleNoNotice : public Module NoNotice nt; public: - ModuleNoNotice(InspIRCd* Me) - : Module(Me), nt(Me, this) + ModuleNoNotice() + : nt(this) { if (!ServerInstance->Modes->AddMode(&nt)) throw ModuleException("Could not add new modes!"); @@ -52,7 +52,7 @@ class ModuleNoNotice : public Module // ulines are exempt. return MOD_RES_PASSTHRU; } - else if (CHANOPS_EXEMPT(ServerInstance, 'T') && c->GetPrefixValue(user) == OP_VALUE) + else if (CHANOPS_EXEMPT('T') && c->GetPrefixValue(user) == OP_VALUE) { // channel ops are exempt if set in conf. return MOD_RES_PASSTHRU; diff --git a/src/modules/m_nopartmsg.cpp b/src/modules/m_nopartmsg.cpp index 32500f069..270159147 100644 --- a/src/modules/m_nopartmsg.cpp +++ b/src/modules/m_nopartmsg.cpp @@ -19,8 +19,7 @@ class ModulePartMsgBan : public Module { private: public: - ModulePartMsgBan(InspIRCd* Me) : Module(Me) - { + ModulePartMsgBan() { Implementation eventlist[] = { I_OnUserPart, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index b8c12f00a..8b8c1401e 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -60,7 +60,7 @@ class CommandOjoin : public Command } active = true; - Channel* channel = Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), false, "", false); + Channel* channel = Channel::JoinUser(user, parameters[0].c_str(), false, "", false); active = false; if (channel) @@ -133,7 +133,7 @@ class NetworkPrefix : public ModeHandler const UserMembList* cl = channel->GetUsers(); std::vector<std::string> mode_junk; mode_junk.push_back(channel->name); - irc::modestacker modestack(ServerInstance, false); + irc::modestacker modestack(false); std::deque<std::string> stackresult; for (UserMembCIter i = cl->begin(); i != cl->end(); i++) @@ -235,8 +235,8 @@ class ModuleOjoin : public Module public: - ModuleOjoin(InspIRCd* Me) - : Module(Me), np(NULL), mycommand(this) + ModuleOjoin() + : np(NULL), mycommand(this) { /* Load config stuff */ OnRehash(NULL); @@ -271,7 +271,7 @@ class ModuleOjoin : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; if (!np) { diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 1dbc61f90..edafcd071 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -19,7 +19,7 @@ class OperChans : public ModeHandler { public: /* This is an oper-only mode */ - OperChans(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'O', PARAM_NONE, MODETYPE_CHANNEL) { oper = true; } + OperChans(Module* Creator) : ModeHandler(Creator, 'O', PARAM_NONE, MODETYPE_CHANNEL) { oper = true; } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -48,8 +48,8 @@ class ModuleOperChans : public Module { OperChans oc; public: - ModuleOperChans(InspIRCd* Me) - : Module(Me), oc(Me, this) + ModuleOperChans() + : oc(this) { if (!ServerInstance->Modes->AddMode(&oc)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_operinvex.cpp b/src/modules/m_operinvex.cpp index a32f39176..e8e9215b4 100644 --- a/src/modules/m_operinvex.cpp +++ b/src/modules/m_operinvex.cpp @@ -22,8 +22,7 @@ class ModuleOperInvex : public Module { private: public: - ModuleOperInvex(InspIRCd* Me) : Module(Me) - { + ModuleOperInvex() { Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index 6b94a4ef9..ac4aab548 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -43,8 +43,7 @@ class ModuleOperjoin : public Module } public: - ModuleOperjoin(InspIRCd* Me) : Module(Me) - { + ModuleOperjoin() { OnRehash(NULL); Implementation eventlist[] = { I_OnPostOper, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -53,7 +52,7 @@ class ModuleOperjoin : public Module virtual void OnRehash(User* user) { - ConfigReader* conf = new ConfigReader(ServerInstance); + ConfigReader* conf = new ConfigReader; operChan = conf->ReadValue("operjoin", "channel", 0); override = conf->ReadFlag("operjoin", "override", "0", 0); @@ -92,7 +91,7 @@ class ModuleOperjoin : public Module for(std::vector<std::string>::iterator it = operChans.begin(); it != operChans.end(); it++) if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax)) - Channel::JoinUser(ServerInstance, user, it->c_str(), override, "", false, ServerInstance->Time()); + Channel::JoinUser(user, it->c_str(), override, "", false, ServerInstance->Time()); std::map<std::string, std::vector<std::string> >::iterator i = operTypeChans.find(user->oper); @@ -103,7 +102,7 @@ class ModuleOperjoin : public Module { if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax)) { - Channel::JoinUser(ServerInstance, user, it->c_str(), override, "", false, ServerInstance->Time()); + Channel::JoinUser(user, it->c_str(), override, "", false, ServerInstance->Time()); } } } diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index 979ce8654..b992b33b6 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -19,10 +19,9 @@ class ModuleOperLevels : public Module private: ConfigReader* conf; public: - ModuleOperLevels(InspIRCd* Me) - : Module(Me) - { - conf = new ConfigReader(ServerInstance); + ModuleOperLevels() + { + conf = new ConfigReader; Implementation eventlist[] = { I_OnRehash, I_OnKill }; ServerInstance->Modules->Attach(eventlist, this, 2); } @@ -36,7 +35,7 @@ class ModuleOperLevels : public Module virtual void OnRehash(User* user) { delete conf; - conf = new ConfigReader(ServerInstance); + conf = new ConfigReader; } virtual Version GetVersion() diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index fb89b162f..e0ef99a22 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -20,8 +20,7 @@ class ModuleOperLog : public Module private: public: - ModuleOperLog(InspIRCd* Me) : Module(Me) - { + ModuleOperLog() { Implementation eventlist[] = { I_OnPreCommand, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 5b78e431b..3890f82e6 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -23,11 +23,10 @@ class ModuleModesOnOper : public Module ConfigReader *Conf; public: - ModuleModesOnOper(InspIRCd* Me) - : Module(Me) - { + ModuleModesOnOper() + { - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; Implementation eventlist[] = { I_OnPostOper, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); } @@ -36,7 +35,7 @@ class ModuleModesOnOper : public Module virtual void OnRehash(User* user) { delete Conf; - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; } virtual ~ModuleModesOnOper() diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 418c36b0c..411cd42c8 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -63,7 +63,7 @@ class ModuleOpermotd : public Module void LoadOperMOTD() { - ConfigReader* conf = new ConfigReader(ServerInstance); + ConfigReader* conf = new ConfigReader; std::string filename; filename = conf->ReadValue("opermotd","file",0); if (opermotd) @@ -71,17 +71,17 @@ class ModuleOpermotd : public Module delete opermotd; opermotd = NULL; } - opermotd = new FileReader(ServerInstance, filename); + opermotd = new FileReader(filename); onoper = conf->ReadFlag("opermotd","onoper","yes",0); delete conf; } - ModuleOpermotd(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleOpermotd() + : cmd(this) { opermotd = NULL; ServerInstance->AddCommand(&cmd); - opermotd = new FileReader(ServerInstance); + opermotd = new FileReader; LoadOperMOTD(); Implementation eventlist[] = { I_OnRehash, I_OnOper }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp index 732d58857..10dcdb37d 100644 --- a/src/modules/m_operprefix.cpp +++ b/src/modules/m_operprefix.cpp @@ -24,7 +24,7 @@ class OperPrefixMode : public ModeHandler { public: - OperPrefixMode(InspIRCd* Instance, Module* Creator, char pfx) : ModeHandler(Creator, 'y', PARAM_ALWAYS, MODETYPE_CHANNEL) + OperPrefixMode(Module* Creator, char pfx) : ModeHandler(Creator, 'y', PARAM_ALWAYS, MODETYPE_CHANNEL) { list = true; prefix = pfx; @@ -78,12 +78,11 @@ class ModuleOperPrefixMode : public Module private: OperPrefixMode* opm; public: - ModuleOperPrefixMode(InspIRCd* Me) : Module(Me) - { - ConfigReader Conf(ServerInstance); + ModuleOperPrefixMode() { + ConfigReader Conf; std::string pfx = Conf.ReadValue("operprefix", "prefix", "!", 0, false); - opm = new OperPrefixMode(ServerInstance, this, pfx[0]); + opm = new OperPrefixMode(this, pfx[0]); if ((!ServerInstance->Modes->AddMode(opm))) throw ModuleException("Could not add a new mode!"); diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 92f0f8efc..3c45bb37d 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -26,9 +26,8 @@ class ModuleOverride : public Module public: - ModuleOverride(InspIRCd* Me) - : Module(Me) - { + ModuleOverride() + { // read our config options (main config file) OnRehash(NULL); ServerInstance->SNO->EnableSnomask('G', "GODMODE"); @@ -43,7 +42,7 @@ class ModuleOverride : public Module void OnRehash(User* user) { // on a rehash we delete our classes for good measure and create them again. - ConfigReader Conf(ServerInstance); + ConfigReader Conf; // re-read our config options on a rehash NoisyOverride = Conf.ReadFlag("override", "noisy", 0); diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index 1617110d1..011a592e7 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -75,8 +75,8 @@ class ModuleOperHash : public Module bool diduseiface; /* If we've called UseInterface yet. */ public: - ModuleOperHash(InspIRCd* Me) - : Module(Me), cmd(this, hashers, names) + ModuleOperHash() + : cmd(this, hashers, names) { diduseiface = false; diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 60d2ec248..3e2e18a8e 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -110,7 +110,7 @@ static bool WriteDatabase() class PermChannel : public ModeHandler { public: - PermChannel(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'P', PARAM_NONE, MODETYPE_CHANNEL) { } + PermChannel(Module* Creator) : ModeHandler(Creator, 'P', PARAM_NONE, MODETYPE_CHANNEL) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -175,7 +175,7 @@ class ModulePermanentChannels : public Module PermChannel p; public: - ModulePermanentChannels(InspIRCd* Me) : Module(Me), p(Me, this) + ModulePermanentChannels() : p(this) { if (!ServerInstance->Modes->AddMode(&p)) throw ModuleException("Could not add new modes!"); @@ -215,7 +215,7 @@ public: * Process config-defined list of permanent channels. * -- w00t */ - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; permchannelsconf = MyConf.ReadValue("permchanneldb", "filename", "", 0, false); @@ -235,7 +235,7 @@ public: if (!c) { - c = new Channel(ServerInstance, channel, ServerInstance->Time()); + c = new Channel(channel, ServerInstance->Time()); if (!topic.empty()) { c->SetTopic(NULL, topic, true); diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index c3a9c514f..e2910e7cd 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -57,11 +57,11 @@ class ModuleRandQuote : public Module CommandRandquote cmd; ConfigReader *conf; public: - ModuleRandQuote(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleRandQuote() + : cmd(this) { - conf = new ConfigReader(ServerInstance); + conf = new ConfigReader; // Sort the Randomizer thingie.. srand(ServerInstance->Time()); @@ -74,7 +74,7 @@ class ModuleRandQuote : public Module throw ModuleException("m_randquote: Quotefile not specified - Please check your config."); } - quotes = new FileReader(ServerInstance, q_file); + quotes = new FileReader(q_file); if(!quotes->Exists()) { throw ModuleException("m_randquote: QuoteFile not Found!! Please check your config - module will not function."); diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 13468823e..6bd375f88 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -20,7 +20,7 @@ class Redirect : public ModeHandler { public: - Redirect(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'L', PARAM_SETONLY, MODETYPE_CHANNEL) { } + Redirect(Module* Creator) : ModeHandler(Creator, 'L', PARAM_SETONLY, MODETYPE_CHANNEL) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) { @@ -89,8 +89,8 @@ class ModuleRedirect : public Module public: - ModuleRedirect(InspIRCd* Me) - : Module(Me), re(Me, this) + ModuleRedirect() + : re(this) { if (!ServerInstance->Modes->AddMode(&re)) @@ -120,7 +120,7 @@ class ModuleRedirect : public Module } user->WriteNumeric(470, "%s %s %s :You may not join this channel, so you are automatically being transferred to the redirect channel.", user->nick.c_str(), cname, channel.c_str()); - Channel::JoinUser(ServerInstance, user, channel.c_str(), false, "", false, ServerInstance->Time()); + Channel::JoinUser(user, channel.c_str(), false, "", false, ServerInstance->Time()); return MOD_RES_DENY; } } diff --git a/src/modules/m_regex.h b/src/modules/m_regex.h index b10a5115b..c8cbc10b6 100644 --- a/src/modules/m_regex.h +++ b/src/modules/m_regex.h @@ -20,10 +20,9 @@ class Regex : public classbase { protected: std::string regex_string; // The raw uncompiled regex string. - InspIRCd* ServerInstance; // Constructor may as well be protected, as this class is abstract. - Regex(const std::string& rx, InspIRCd* Me) : regex_string(rx), ServerInstance(Me) + Regex(const std::string& rx) : regex_string(rx) { } diff --git a/src/modules/m_regex_glob.cpp b/src/modules/m_regex_glob.cpp index 8d7eaafc3..ef843cc76 100644 --- a/src/modules/m_regex_glob.cpp +++ b/src/modules/m_regex_glob.cpp @@ -20,7 +20,7 @@ class GlobRegex : public Regex { public: - GlobRegex(const std::string& rx, InspIRCd* Me) : Regex(rx, Me) + GlobRegex(const std::string& rx) : Regex(rx) { } @@ -37,11 +37,10 @@ public: class ModuleRegexGlob : public Module { public: - ModuleRegexGlob(InspIRCd* Me) : Module(Me) - { - Me->Modules->PublishInterface("RegularExpression", this); + ModuleRegexGlob() { + ServerInstance->Modules->PublishInterface("RegularExpression", this); Implementation eventlist[] = { I_OnRequest }; - Me->Modules->Attach(eventlist, this, 1); + ServerInstance->Modules->Attach(eventlist, this, 1); } virtual Version GetVersion() @@ -64,7 +63,7 @@ public: { RegexFactoryRequest* rfr = (RegexFactoryRequest*)request; std::string rx = rfr->GetRegex(); - rfr->result = (Regex*)new GlobRegex(rx, ServerInstance); + rfr->result = new GlobRegex(rx); return "OK"; } return NULL; diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp index 546d8235a..3354c1132 100644 --- a/src/modules/m_regonlycreate.cpp +++ b/src/modules/m_regonlycreate.cpp @@ -18,9 +18,8 @@ class ModuleRegOnlyCreate : public Module { public: - ModuleRegOnlyCreate(InspIRCd* Me) - : Module(Me) - { + ModuleRegOnlyCreate() + { Implementation eventlist[] = { I_OnUserPreJoin }; ServerInstance->Modules->Attach(eventlist, this, 1); } diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 09f60ad19..ef60639f4 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -187,7 +187,7 @@ class ModuleRemove : public Module public: - ModuleRemove(InspIRCd*) : cmd1(this, supportnokicks), cmd2(this, supportnokicks) + ModuleRemove() : cmd1(this, supportnokicks), cmd2(this, supportnokicks) { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); @@ -204,7 +204,7 @@ class ModuleRemove : public Module virtual void OnRehash(User* user) { - ConfigReader conf(ServerInstance); + ConfigReader conf; supportnokicks = conf.ReadFlag("remove", "supportnokicks", 0); } diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index 8e60359f6..bc66afce5 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -23,7 +23,7 @@ class ModuleRestrictChans : public Module void ReadConfig() { - ConfigReader* MyConf = new ConfigReader(ServerInstance); + ConfigReader* MyConf = new ConfigReader; allowchans.clear(); for (int i = 0; i < MyConf->Enumerate("allowchannel"); i++) { @@ -36,9 +36,8 @@ class ModuleRestrictChans : public Module } public: - ModuleRestrictChans(InspIRCd* Me) - : Module(Me) - { + ModuleRestrictChans() + { ReadConfig(); Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash }; diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index affcd5a24..de7737e66 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -21,9 +21,8 @@ class ModuleRestrictMsg : public Module public: - ModuleRestrictMsg(InspIRCd* Me) - : Module(Me) - { + ModuleRestrictMsg() + { Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_ripemd160.cpp b/src/modules/m_ripemd160.cpp index 87ca21ada..1d3b1eb34 100644 --- a/src/modules/m_ripemd160.cpp +++ b/src/modules/m_ripemd160.cpp @@ -407,7 +407,7 @@ class ModuleRIPEMD160 : public Module byte *RMD(byte *message, dword length, unsigned int* key) { ServerInstance->Logs->Log("m_ripemd160", DEBUG, "RMD: '%s' length=%u", (const char*)message, length); - dword MDbuf[RMDsize/32]; /* contains (A, B, C, D(, E)) */ + dword MDbuf[RMDsize/32]; /* contains (A, B, C, D(E)) */ static byte hashcode[RMDsize/8]; /* for final hash-value */ dword X[16]; /* current 16-word chunk */ unsigned int i; /* counter */ @@ -442,7 +442,7 @@ class ModuleRIPEMD160 : public Module public: - ModuleRIPEMD160(InspIRCd* Me) : Module(Me), currkey(NULL), chars("0123456789abcdef") + ModuleRIPEMD160() : currkey(NULL), chars("0123456789abcdef") { ServerInstance->Modules->PublishInterface("HashRequest", this); Implementation eventlist[] = { I_OnRequest }; diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 94f17ab8c..8bad04f29 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -34,8 +34,8 @@ class RLine : public XLine * @param regex Pattern to match with * @ */ - RLine(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string regexs) - : XLine(Instance, s_time, d, src, re, "R") + RLine(time_t s_time, long d, std::string src, std::string re, std::string regexs) + : XLine(s_time, d, src, re, "R") { matchtext = regexs; @@ -75,7 +75,7 @@ class RLine : public XLine void Apply(User* u) { if (ZlineOnMatch) { - background_zlines.push_back(new ZLine(ServerInstance, ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, ServerInstance->Config->ServerName, reason.c_str(), u->GetIPString())); + background_zlines.push_back(new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, ServerInstance->Config->ServerName, reason.c_str(), u->GetIPString())); } DefaultApply(u, "R", false); } @@ -102,7 +102,7 @@ class RLine : public XLine class RLineFactory : public XLineFactory { public: - RLineFactory(InspIRCd* Instance) : XLineFactory(Instance, "R") + RLineFactory() : XLineFactory("R") { } @@ -110,7 +110,7 @@ class RLineFactory : public XLineFactory */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { - return new RLine(ServerInstance, set_time, duration, source, reason, xline_specific_mask); + return new RLine(set_time, duration, source, reason, xline_specific_mask); } ~RLineFactory() @@ -143,7 +143,7 @@ class CommandRLine : public Command try { - r = new RLine(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str()); + r = new RLine(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str()); } catch (ModuleException &e) { @@ -203,12 +203,12 @@ class ModuleRLine : public Module std::string RegexEngine; public: - ModuleRLine(InspIRCd* Me) : Module(Me), r(this), f(Me) + ModuleRLine() : r(this) { mymodule = this; OnRehash(NULL); - Me->Modules->UseInterface("RegularExpression"); + ServerInstance->Modules->UseInterface("RegularExpression"); ServerInstance->AddCommand(&r); ServerInstance->XLines->RegisterFactory(&f); @@ -244,7 +244,7 @@ class ModuleRLine : public Module virtual void OnRehash(User *user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; if (!Conf.ReadFlag("rline", "zlineonmatch", 0) && ZlineOnMatch) background_zlines.clear(); diff --git a/src/modules/m_rpc_json.cpp b/src/modules/m_rpc_json.cpp index 76b5f0e2e..e57bb77b5 100644 --- a/src/modules/m_rpc_json.cpp +++ b/src/modules/m_rpc_json.cpp @@ -42,7 +42,7 @@ class ModuleRpcJson : public Module private: public: - ModuleRpcJson(InspIRCd *Me) : Module(Me) + ModuleRpcJson() { ServerInstance->Modules->PublishInterface("RPC", this); Implementation eventlist[] = { I_OnEvent }; @@ -89,7 +89,7 @@ class ModuleRpcJson : public Module RPCRequest modreq("json", method->GetString(), params); Event mev((char*) &modreq, this, "RPCMethod"); - mev.Send(ServerInstance); + mev.Send(); if (!modreq.claimed) throw JsonException("Unrecognized method"); diff --git a/src/modules/m_rpctest.cpp b/src/modules/m_rpctest.cpp index 146eabacf..a33976510 100644 --- a/src/modules/m_rpctest.cpp +++ b/src/modules/m_rpctest.cpp @@ -22,8 +22,7 @@ class ModuleRPCTest : public Module private: public: - ModuleRPCTest(InspIRCd *Me) : Module(Me) - { + ModuleRPCTest() { Implementation eventlist[] = { I_OnEvent }; ServerInstance->Modules->Attach(eventlist, this, 1); } diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index 325972d76..0160de7c2 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -40,7 +40,7 @@ class ModuleSafeList : public Module SimpleExtItem<ListData> listData; LocalIntExt listTime; public: - ModuleSafeList(InspIRCd* Me) : Module(Me), listData("safelist_data", this), listTime("safelist_last", this) + ModuleSafeList() : listData("safelist_data", this), listTime("safelist_last", this) { OnRehash(NULL); Extensible::Register(&listData); @@ -55,7 +55,7 @@ class ModuleSafeList : public Module void OnRehash(User* user) { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; ThrottleSecs = MyConf.ReadInteger("safelist", "throttle", "60", 0, true); LimitList = MyConf.ReadInteger("safelist", "maxlisters", "50", 0, true); ServerNameSize = strlen(ServerInstance->Config->ServerName) + 4; diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 207415d9e..28634e4f9 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -49,7 +49,7 @@ class CommandSajoin : public Command */ if (IS_LOCAL(dest)) { - Channel::JoinUser(ServerInstance, dest, parameters[1].c_str(), true, "", false, ServerInstance->Time()); + Channel::JoinUser(dest, parameters[1].c_str(), true, "", false, ServerInstance->Time()); /* Fix for dotslasher and w00t - if the join didnt succeed, return CMD_FAILURE so that it doesnt propagate */ Channel* n = ServerInstance->FindChan(parameters[1]); if (n) @@ -97,8 +97,8 @@ class ModuleSajoin : public Module { CommandSajoin cmd; public: - ModuleSajoin(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSajoin() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index cd0b07477..fa4d95c96 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -97,8 +97,8 @@ class ModuleSakick : public Module { CommandSakick cmd; public: - ModuleSakick(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSakick() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 1053f74d2..ba02c5e16 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -42,8 +42,8 @@ class ModuleSaMode : public Module { CommandSamode cmd; public: - ModuleSaMode(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSaMode() + : cmd(this) { ServerInstance->AddCommand(&cmd); ServerInstance->Modules->Attach(I_OnPreMode, this); diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index cd3c0aff8..c164de3a2 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -86,8 +86,8 @@ class ModuleSanick : public Module { CommandSanick cmd; public: - ModuleSanick(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSanick() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index d4d4c58ec..255648f85 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -97,8 +97,8 @@ class ModuleSapart : public Module { CommandSapart cmd; public: - ModuleSapart(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSapart() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 4d67a2cd1..0d181aa65 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -66,8 +66,8 @@ class ModuleSaquit : public Module { CommandSaquit cmd; public: - ModuleSaquit(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSaquit() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 696b3d809..48e07ef6d 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -34,8 +34,8 @@ class SaslAuthenticator : public classbase bool state_announced; public: - SaslAuthenticator(User *user_, std::string method, InspIRCd *instance, Module *ctor) - : ServerInstance(instance), user(user_), state(SASL_INIT), state_announced(false) + SaslAuthenticator(User *user_, std::string method, Module *ctor) + : user(user_), state(SASL_INIT), state_announced(false) { parameterlist params; params.push_back("*"); @@ -168,7 +168,7 @@ class CommandAuthenticate : public Command SaslAuthenticator *sasl = authExt.get(user); if (!sasl) - authExt.set(user, new SaslAuthenticator(user, parameters[0], ServerInstance, creator)); + authExt.set(user, new SaslAuthenticator(user, parameters[0], creator)); else if (sasl->SendClientMessage(parameters) == false) // IAL abort extension --nenolod { sasl->AnnounceState(); @@ -223,8 +223,8 @@ class ModuleSASL : public Module CommandAuthenticate auth; CommandSASL sasl; public: - ModuleSASL(InspIRCd* Me) - : Module(Me), authExt("sasl_auth", this), cap(this, "sasl"), auth(this, authExt, cap), sasl(this, authExt) + ModuleSASL() + : authExt("sasl_auth", this), cap(this, "sasl"), auth(this, authExt, cap), sasl(this, authExt) { Implementation eventlist[] = { I_OnEvent, I_OnUserRegister, I_OnPostConnect, I_OnUserDisconnect, I_OnCleanup }; ServerInstance->Modules->Attach(eventlist, this, 5); diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index 58d9cac94..7b2c3e5eb 100644 --- a/src/modules/m_satopic.cpp +++ b/src/modules/m_satopic.cpp @@ -55,8 +55,8 @@ class ModuleSATopic : public Module { CommandSATopic cmd; public: - ModuleSATopic(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSATopic() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index b2d1f8014..5e2d704bb 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -21,8 +21,7 @@ class ModuleSecureList : public Module std::vector<std::string> allowlist; time_t WaitTime; public: - ModuleSecureList(InspIRCd* Me) : Module(Me) - { + ModuleSecureList() { OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnPreCommand, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 3); @@ -39,7 +38,7 @@ class ModuleSecureList : public Module void OnRehash(User* user) { - ConfigReader* MyConf = new ConfigReader(ServerInstance); + ConfigReader* MyConf = new ConfigReader; allowlist.clear(); for (int i = 0; i < MyConf->Enumerate("securehost"); i++) diff --git a/src/modules/m_seenicks.cpp b/src/modules/m_seenicks.cpp index 630a7e58e..ca30cfef6 100644 --- a/src/modules/m_seenicks.cpp +++ b/src/modules/m_seenicks.cpp @@ -18,9 +18,8 @@ class ModuleSeeNicks : public Module { public: - ModuleSeeNicks(InspIRCd* Me) - : Module(Me) - { + ModuleSeeNicks() + { ServerInstance->SNO->EnableSnomask('n',"NICK"); ServerInstance->SNO->EnableSnomask('N',"REMOTENICK"); Implementation eventlist[] = { I_OnUserPostNick }; diff --git a/src/modules/m_serverban.cpp b/src/modules/m_serverban.cpp index 6f35de862..810366249 100644 --- a/src/modules/m_serverban.cpp +++ b/src/modules/m_serverban.cpp @@ -19,8 +19,7 @@ class ModuleServerBan : public Module { private: public: - ModuleServerBan(InspIRCd* Me) : Module(Me) - { + ModuleServerBan() { Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 7480daf07..6e950f438 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -22,7 +22,7 @@ class Channel_r : public ModeHandler { public: - Channel_r(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'r', PARAM_NONE, MODETYPE_CHANNEL) { } + Channel_r(Module* Creator) : ModeHandler(Creator, 'r', PARAM_NONE, MODETYPE_CHANNEL) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -52,7 +52,7 @@ class User_r : public ModeHandler { public: - User_r(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'r', PARAM_NONE, MODETYPE_USER) { } + User_r(Module* Creator) : ModeHandler(Creator, 'r', PARAM_NONE, MODETYPE_USER) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -78,7 +78,7 @@ class User_r : public ModeHandler class AChannel_R : public SimpleChannelModeHandler { public: - AChannel_R(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'R') { } + AChannel_R(Module* Creator) : SimpleChannelModeHandler(Creator, 'R') { } }; /** User mode +R - unidentified users cannot message @@ -86,7 +86,7 @@ class AChannel_R : public SimpleChannelModeHandler class AUser_R : public SimpleUserModeHandler { public: - AUser_R(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Creator, 'R') { } + AUser_R(Module* Creator) : SimpleUserModeHandler(Creator, 'R') { } }; /** Channel mode +M - unidentified users cannot message channel @@ -94,7 +94,7 @@ class AUser_R : public SimpleUserModeHandler class AChannel_M : public SimpleChannelModeHandler { public: - AChannel_M(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'M') { } + AChannel_M(Module* Creator) : SimpleChannelModeHandler(Creator, 'M') { } }; class ModuleServicesAccount : public Module @@ -106,8 +106,7 @@ class ModuleServicesAccount : public Module User_r m5; StringExtItem accountname; public: - ModuleServicesAccount(InspIRCd* Me) : Module(Me), - m1(Me, this), m2(Me, this), m3(Me, this), m4(Me, this), m5(Me, this), + ModuleServicesAccount() : m1(this), m2(this), m3(this), m4(this), m5(this), accountname("accountname", this) { @@ -267,7 +266,7 @@ class ModuleServicesAccount : public Module ac.user = dest; ac.account = *account; Event n((char*)&ac, this, "account_login"); - n.Send(ServerInstance); + n.Send(); } } } diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index ee6f2ad23..96e54f8e7 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -20,7 +20,7 @@ class ServProtectMode : public ModeHandler { public: - ServProtectMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'k', PARAM_NONE, MODETYPE_USER) { oper = true; } + ServProtectMode(Module* Creator) : ModeHandler(Creator, 'k', PARAM_NONE, MODETYPE_USER) { oper = true; } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -40,8 +40,8 @@ class ModuleServProtectMode : public Module { ServProtectMode bm; public: - ModuleServProtectMode(InspIRCd* Me) - : Module(Me), bm(Me, this) + ModuleServProtectMode() + : bm(this) { if (!ServerInstance->Modes->AddMode(&bm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index ffbc66ddc..cd9368d3c 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -66,8 +66,8 @@ class ModuleSetHost : public Module CommandSethost cmd; char hostmap[256]; public: - ModuleSetHost(InspIRCd* Me) - : Module(Me), cmd(this, hostmap) + ModuleSetHost() + : cmd(this, hostmap) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); @@ -78,7 +78,7 @@ class ModuleSetHost : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string hmap = Conf.ReadValue("hostname", "charmap", 0); if (hmap.empty()) diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index 3b6f6682b..a0a4cfe8d 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -59,7 +59,7 @@ class ModuleSetIdent : public Module CommandSetident cmd; public: - ModuleSetIdent(InspIRCd* Me) : Module(Me), cmd(this) + ModuleSetIdent() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index 68df49a33..4751d99c1 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -50,8 +50,8 @@ class ModuleSetIdle : public Module { CommandSetidle cmd; public: - ModuleSetIdle(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSetIdle() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index be5bdb5f9..c0e32da73 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -55,8 +55,8 @@ class ModuleSetName : public Module { CommandSetname cmd; public: - ModuleSetName(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSetName() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sha256.cpp b/src/modules/m_sha256.cpp index b6dc215db..c41bd0699 100644 --- a/src/modules/m_sha256.cpp +++ b/src/modules/m_sha256.cpp @@ -258,7 +258,7 @@ class ModuleSHA256 : public Module public: - ModuleSHA256(InspIRCd* Me) : Module(Me), key(NULL), chars(NULL) + ModuleSHA256() : key(NULL), chars(NULL) { ServerInstance->Modules->PublishInterface("HashRequest", this); Implementation eventlist[] = { I_OnRequest }; diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index 63e02c76d..9acc019aa 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -81,9 +81,9 @@ class ModuleShowwhois : public Module public: - ModuleShowwhois(InspIRCd* Me) : cmd(this) + ModuleShowwhois() : cmd(this) { - ConfigReader conf(ServerInstance); + ConfigReader conf; bool OpersOnly = conf.ReadFlag("showwhois", "opersonly", "yes", 0); ShowWhoisFromOpers = conf.ReadFlag("showwhois", "showfromopers", "yes", 0); diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 746dcb918..599d665a1 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -21,8 +21,8 @@ class Shun : public XLine public: std::string matchtext; - Shun(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string shunmask) - : XLine(Instance, s_time, d, src, re, "SHUN") + Shun(time_t s_time, long d, std::string src, std::string re, std::string shunmask) + : XLine(s_time, d, src, re, "SHUN") { this->matchtext = shunmask; } @@ -72,13 +72,13 @@ public: class ShunFactory : public XLineFactory { public: - ShunFactory(InspIRCd* Instance) : XLineFactory(Instance, "SHUN") { } + ShunFactory() : XLineFactory("SHUN") { } /** Generate a shun */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { - return new Shun(ServerInstance, set_time, duration, source, reason, xline_specific_mask); + return new Shun(set_time, duration, source, reason, xline_specific_mask); } }; @@ -136,7 +136,7 @@ class CommandShun : public Command try { - r = new Shun(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), expr.c_str(), target.c_str()); + r = new Shun(ServerInstance->Time(), duration, user->nick.c_str(), expr.c_str(), target.c_str()); } catch (...) { @@ -187,7 +187,7 @@ class ModuleShun : public Module bool affectopers; public: - ModuleShun(InspIRCd* Me) : Module(Me), cmd(this), f(Me) + ModuleShun() : cmd(this) { ServerInstance->XLines->RegisterFactory(&f); ServerInstance->AddCommand(&cmd); @@ -214,7 +214,7 @@ class ModuleShun : public Module virtual void OnRehash(User* user) { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; std::string cmds = MyConf.ReadValue("shun", "enabledcommands", 0); if (cmds.empty()) diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 57f3416e7..eae6bf35c 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -270,8 +270,8 @@ class ModuleSilence : public Module CommandSVSSilence cmdsvssilence; public: - ModuleSilence(InspIRCd* Me) - : Module(Me), maxsilence(32), cmdsilence(this, maxsilence), cmdsvssilence(this) + ModuleSilence() + : maxsilence(32), cmdsilence(this, maxsilence), cmdsvssilence(this) { OnRehash(NULL); ServerInstance->AddCommand(&cmdsilence); @@ -283,7 +283,7 @@ class ModuleSilence : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; maxsilence = Conf.ReadInteger("silence", "maxentries", 0, true); if (!maxsilence) maxsilence = 32; diff --git a/src/modules/m_spanningtree/cachetimer.cpp b/src/modules/m_spanningtree/cachetimer.cpp index ae26f3600..989ed565f 100644 --- a/src/modules/m_spanningtree/cachetimer.cpp +++ b/src/modules/m_spanningtree/cachetimer.cpp @@ -25,7 +25,7 @@ /* $ModDep: m_spanningtree/cachetimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */ -CacheRefreshTimer::CacheRefreshTimer(InspIRCd *Inst, SpanningTreeUtilities *Util) : Timer(3600, Inst->Time(), true), Instance(Inst), Utils(Util) +CacheRefreshTimer::CacheRefreshTimer(SpanningTreeUtilities *Util) : Timer(3600, ServerInstance->Time(), true), Utils(Util) { } diff --git a/src/modules/m_spanningtree/cachetimer.h b/src/modules/m_spanningtree/cachetimer.h index aec539332..dcfba8ef3 100644 --- a/src/modules/m_spanningtree/cachetimer.h +++ b/src/modules/m_spanningtree/cachetimer.h @@ -18,7 +18,6 @@ class ModuleSpanningTree; class SpanningTreeUtilities; -class InspIRCd; /** Create a timer which recurs every second, we inherit from Timer. * Timer is only one-shot however, so at the end of each Tick() we simply @@ -27,10 +26,9 @@ class InspIRCd; class CacheRefreshTimer : public Timer { private: - InspIRCd *Instance; SpanningTreeUtilities *Utils; public: - CacheRefreshTimer(InspIRCd *Instance, SpanningTreeUtilities* Util); + CacheRefreshTimer(SpanningTreeUtilities* Util); virtual void Tick(time_t TIME); }; diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index 7f11f40dd..810cf23a5 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -53,7 +53,7 @@ bool TreeSocket::ForceJoin(const std::string &source, parameterlist ¶ms) if (params.size() < 3) return true; - irc::modestacker modestack(ServerInstance, true); /* Modes to apply from the users in the user list */ + irc::modestacker modestack(true); /* Modes to apply from the users in the user list */ User* who = NULL; /* User we are currently checking */ std::string channel = params[0]; /* Channel name, as a string */ time_t TS = atoi(params[1].c_str()); /* Timestamp given to us for remote side */ @@ -77,7 +77,7 @@ bool TreeSocket::ForceJoin(const std::string &source, parameterlist ¶ms) if (created) { - chan = new Channel(ServerInstance, channel, TS); + chan = new Channel(channel, TS); ServerInstance->SNO->WriteToSnoMask('d', "Creation FJOIN recieved for %s, timestamp: %lu", chan->name.c_str(), (unsigned long)TS); } else @@ -168,7 +168,7 @@ bool TreeSocket::ForceJoin(const std::string &source, parameterlist ¶ms) for (std::string::iterator x = modes.begin(); x != modes.end(); ++x) modestack.Push(*x, who->nick); - Channel::JoinUser(ServerInstance, who, channel.c_str(), true, "", route_back_again->bursting, TS); + Channel::JoinUser(who, channel.c_str(), true, "", route_back_again->bursting, TS); } else { @@ -203,7 +203,7 @@ bool TreeSocket::RemoveStatus(const std::string &prefix, parameterlist ¶ms) if (c) { - irc::modestacker stack(ServerInstance, false); + irc::modestacker stack(false); parameterlist stackresult; stackresult.push_back(c->name); diff --git a/src/modules/m_spanningtree/handshaketimer.cpp b/src/modules/m_spanningtree/handshaketimer.cpp index 814aa122c..b264a4c2f 100644 --- a/src/modules/m_spanningtree/handshaketimer.cpp +++ b/src/modules/m_spanningtree/handshaketimer.cpp @@ -25,7 +25,8 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */ -HandshakeTimer::HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay) : Timer(delay, Inst->Time(), true), Instance(Inst), sock(s), lnk(l), Utils(u) +HandshakeTimer::HandshakeTimer(TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay) + : Timer(delay, ServerInstance->Time(), true), sock(s), lnk(l), Utils(u) { thefd = sock->GetFd(); } diff --git a/src/modules/m_spanningtree/handshaketimer.h b/src/modules/m_spanningtree/handshaketimer.h index 0a60c78fc..3f01a8b5b 100644 --- a/src/modules/m_spanningtree/handshaketimer.h +++ b/src/modules/m_spanningtree/handshaketimer.h @@ -24,13 +24,12 @@ class Link; class HandshakeTimer : public Timer { private: - InspIRCd* Instance; TreeSocket* sock; Link* lnk; SpanningTreeUtilities* Utils; int thefd; public: - HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay); + HandshakeTimer(TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay); ~HandshakeTimer(); virtual void Tick(time_t TIME); }; diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 230c3109b..23945d095 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -31,16 +31,16 @@ /* $ModDep: m_spanningtree/cachetimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h m_spanningtree/protocolinterface.h */ -ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) - : Module(Me), max_local(0), max_global(0) +ModuleSpanningTree::ModuleSpanningTree() + : max_local(0), max_global(0) { ServerInstance->Modules->UseInterface("BufferedSocketHook"); - Utils = new SpanningTreeUtilities(ServerInstance, this); + Utils = new SpanningTreeUtilities(this); command_rconnect = new CommandRConnect(this, Utils); ServerInstance->AddCommand(command_rconnect); command_rsquit = new CommandRSQuit(this, Utils); ServerInstance->AddCommand(command_rsquit); - RefreshTimer = new CacheRefreshTimer(ServerInstance, Utils); + RefreshTimer = new CacheRefreshTimer(Utils); ServerInstance->Timers->AddTimer(RefreshTimer); Implementation eventlist[] = @@ -55,7 +55,7 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); delete ServerInstance->PI; - ServerInstance->PI = new SpanningTreeProtocolInterface(this, Utils, ServerInstance); + ServerInstance->PI = new SpanningTreeProtocolInterface(this, Utils); loopCall = false; // update our local user count @@ -292,7 +292,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) try { bool cached; - ServernameResolver* snr = new ServernameResolver((Module*)this, Utils, ServerInstance,x->IPAddr, *x, cached, start_type, y); + ServernameResolver* snr = new ServernameResolver((Module*)this, Utils, x->IPAddr, *x, cached, start_type, y); ServerInstance->AddResolver(snr, cached); } catch (ModuleException& e) @@ -942,7 +942,7 @@ void ModuleSpanningTree::OnEvent(Event* event) ModuleSpanningTree::~ModuleSpanningTree() { delete ServerInstance->PI; - ServerInstance->PI = new ProtocolInterface(ServerInstance); + ServerInstance->PI = new ProtocolInterface; /* This will also free the listeners */ delete Utils; diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 0d44169c7..810b8ec92 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -60,7 +60,7 @@ class ModuleSpanningTree : public Module /** Constructor */ - ModuleSpanningTree(InspIRCd* Me); + ModuleSpanningTree(); /** Shows /LINKS */ diff --git a/src/modules/m_spanningtree/metadata.cpp b/src/modules/m_spanningtree/metadata.cpp index 135970a4a..ee26f0c73 100644 --- a/src/modules/m_spanningtree/metadata.cpp +++ b/src/modules/m_spanningtree/metadata.cpp @@ -33,7 +33,7 @@ bool TreeSocket::MetaData(const std::string &prefix, parameterlist ¶ms) { if (params[0] == "*") { - FOREACH_MOD_I(ServerInstance,I_OnDecodeMetaData,OnDecodeMetaData(NULL,params[1],params[2])); + FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(NULL,params[1],params[2])); } else if (*(params[0].c_str()) == '#') { @@ -42,7 +42,7 @@ bool TreeSocket::MetaData(const std::string &prefix, parameterlist ¶ms) { if (item) item->unserialize(FORMAT_NETWORK, c, params[2]); - FOREACH_MOD_I(ServerInstance,I_OnDecodeMetaData,OnDecodeMetaData(c,params[1],params[2])); + FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(c,params[1],params[2])); } } else if (*(params[0].c_str()) != '#') @@ -52,7 +52,7 @@ bool TreeSocket::MetaData(const std::string &prefix, parameterlist ¶ms) { if (item) item->unserialize(FORMAT_NETWORK, u, params[2]); - FOREACH_MOD_I(ServerInstance,I_OnDecodeMetaData,OnDecodeMetaData(u,params[1],params[2])); + FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(u,params[1],params[2])); } } } diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 3cfad9b63..b8d8c93ee 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -47,7 +47,7 @@ void TreeSocket::DoBurst(TreeServer* s) /* Send everything else (channel modes, xlines etc) */ this->SendChannelModes(s); this->SendXLines(s); - FOREACH_MOD_I(ServerInstance,I_OnSyncNetwork,OnSyncNetwork(Utils->Creator,(void*)this)); + FOREACH_MOD(I_OnSyncNetwork,OnSyncNetwork(Utils->Creator,(void*)this)); this->WriteLine(endburst); ServerInstance->SNO->WriteToSnoMask('l',"Finished bursting to \2"+name+"\2."); } @@ -230,7 +230,7 @@ void TreeSocket::SendChannelModes(TreeServer* Current) Utils->Creator->ProtoSendMetaData(this, c->second, i->first, value); } - FOREACH_MOD_I(ServerInstance,I_OnSyncChannel,OnSyncChannel(c->second,Utils->Creator,this)); + FOREACH_MOD(I_OnSyncChannel,OnSyncChannel(c->second,Utils->Creator,this)); } } @@ -281,7 +281,7 @@ void TreeSocket::SendUsers(TreeServer* Current) Utils->Creator->ProtoSendMetaData(this, u->second, i->first, value); } - FOREACH_MOD_I(ServerInstance,I_OnSyncUser,OnSyncUser(u->second,Utils->Creator,this)); + FOREACH_MOD(I_OnSyncUser,OnSyncUser(u->second,Utils->Creator,this)); } } } diff --git a/src/modules/m_spanningtree/privmsg.cpp b/src/modules/m_spanningtree/privmsg.cpp index c7acf393c..042edaba8 100644 --- a/src/modules/m_spanningtree/privmsg.cpp +++ b/src/modules/m_spanningtree/privmsg.cpp @@ -40,16 +40,16 @@ bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string { if (messagetype == "PRIVMSG") { - FOREACH_MOD_I(ServerInstance, I_OnUserMessage, OnUserMessage(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); + FOREACH_MOD(I_OnUserMessage, OnUserMessage(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); } else { - FOREACH_MOD_I(ServerInstance, I_OnUserNotice, OnUserNotice(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); + FOREACH_MOD(I_OnUserNotice, OnUserNotice(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); } TreeServer* s = Utils->FindServer(prefix); if (s) { - FOREACH_MOD_I(ServerInstance, I_OnText, OnText(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); + FOREACH_MOD(I_OnText, OnText(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); channel->WriteChannelWithServ(s->GetName().c_str(), "%s %s :%s", messagetype.c_str(), channel->name.c_str(), text.c_str()); } } @@ -61,16 +61,16 @@ bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string { if (messagetype == "PRIVMSG") { - FOREACH_MOD_I(ServerInstance, I_OnUserMessage, OnUserMessage(Utils->ServerUser, user, TYPE_USER, text, 0, except_list)); + FOREACH_MOD(I_OnUserMessage, OnUserMessage(Utils->ServerUser, user, TYPE_USER, text, 0, except_list)); } else { - FOREACH_MOD_I(ServerInstance, I_OnUserNotice, OnUserNotice(Utils->ServerUser, user, TYPE_USER, text, 0, except_list)); + FOREACH_MOD(I_OnUserNotice, OnUserNotice(Utils->ServerUser, user, TYPE_USER, text, 0, except_list)); } TreeServer* s = Utils->FindServer(prefix); if (s) { - FOREACH_MOD_I(ServerInstance, I_OnText, OnText(Utils->ServerUser, user, TYPE_USER, text, status, except_list)); + FOREACH_MOD(I_OnText, OnText(Utils->ServerUser, user, TYPE_USER, text, status, except_list)); user->Write(":%s %s %s :%s", s->GetName().c_str(), messagetype.c_str(), user->nick.c_str(), text.c_str()); } diff --git a/src/modules/m_spanningtree/protocolinterface.h b/src/modules/m_spanningtree/protocolinterface.h index 047d490b6..74120ad47 100644 --- a/src/modules/m_spanningtree/protocolinterface.h +++ b/src/modules/m_spanningtree/protocolinterface.h @@ -10,7 +10,7 @@ class SpanningTreeProtocolInterface : public ProtocolInterface ModuleSpanningTree* Module; void SendChannel(Channel* target, char status, const std::string &text); public: - SpanningTreeProtocolInterface(ModuleSpanningTree* mod, SpanningTreeUtilities* util, InspIRCd* Instance) : ProtocolInterface(Instance), Utils(util), Module(mod) { } + SpanningTreeProtocolInterface(ModuleSpanningTree* mod, SpanningTreeUtilities* util) : Utils(util), Module(mod) { } virtual ~SpanningTreeProtocolInterface() { } virtual void SendEncapsulatedData(parameterlist &encap); diff --git a/src/modules/m_spanningtree/resolvers.cpp b/src/modules/m_spanningtree/resolvers.cpp index c7c49b348..782c7795d 100644 --- a/src/modules/m_spanningtree/resolvers.cpp +++ b/src/modules/m_spanningtree/resolvers.cpp @@ -31,7 +31,7 @@ * callback to OnLookupComplete or OnError when completed. Once it has completed we * will have an IP address which we can then use to continue our connection. */ -ServernameResolver::ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached, QueryType qt, Autoconnect* myac) : Resolver(Instance, hostname, qt, cached, me), MyLink(x), Utils(Util), query(qt), host(hostname), mine(me), myautoconnect(myac) +ServernameResolver::ServernameResolver(Module* me, SpanningTreeUtilities* Util, const std::string &hostname, Link x, bool &cached, QueryType qt, Autoconnect* myac) : Resolver(hostname, qt, cached, me), MyLink(x), Utils(Util), query(qt), host(hostname), mine(me), myautoconnect(myac) { /* Nothing in here, folks */ } @@ -71,7 +71,7 @@ void ServernameResolver::OnError(ResolverError e, const std::string &errormessag if (query == DNS_QUERY_AAAA) { bool cached; - ServernameResolver* snr = new ServernameResolver(mine, Utils, ServerInstance, host, MyLink, cached, DNS_QUERY_A, myautoconnect); + ServernameResolver* snr = new ServernameResolver(mine, Utils, host, MyLink, cached, DNS_QUERY_A, myautoconnect); ServerInstance->AddResolver(snr, cached); return; } diff --git a/src/modules/m_spanningtree/resolvers.h b/src/modules/m_spanningtree/resolvers.h index e4404d6a5..5b5bf88cc 100644 --- a/src/modules/m_spanningtree/resolvers.h +++ b/src/modules/m_spanningtree/resolvers.h @@ -33,8 +33,8 @@ class SecurityIPResolver : public Resolver std::string host; QueryType query; public: - SecurityIPResolver(Module* me, SpanningTreeUtilities* U, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached, QueryType qt) - : Resolver(Instance, hostname, qt, cached, me), MyLink(x), Utils(U), mine(me), host(hostname), query(qt) + SecurityIPResolver(Module* me, SpanningTreeUtilities* U, const std::string &hostname, Link x, bool &cached, QueryType qt) + : Resolver(hostname, qt, cached, me), MyLink(x), Utils(U), mine(me), host(hostname), query(qt) { } @@ -48,7 +48,7 @@ class SecurityIPResolver : public Resolver if (query == DNS_QUERY_AAAA) { bool cached; - SecurityIPResolver* res = new SecurityIPResolver(mine, Utils, ServerInstance, host, MyLink, cached, DNS_QUERY_A); + SecurityIPResolver* res = new SecurityIPResolver(mine, Utils, host, MyLink, cached, DNS_QUERY_A); ServerInstance->AddResolver(res, cached); return; } @@ -76,7 +76,7 @@ class ServernameResolver : public Resolver Module* mine; Autoconnect* myautoconnect; public: - ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached, QueryType qt, Autoconnect* myac); + ServernameResolver(Module* me, SpanningTreeUtilities* Util, const std::string &hostname, Link x, bool &cached, QueryType qt, Autoconnect* myac); void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached); void OnError(ResolverError e, const std::string &errormessage); }; diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index 025675642..b1c6c2cb4 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -72,7 +72,7 @@ bool TreeSocket::RemoteServer(const std::string &prefix, parameterlist ¶ms) Link* lnk = Utils->FindLink(servername); - TreeServer *Node = new TreeServer(this->Utils, ServerInstance, servername, description, sid, ParentOfThis,NULL, lnk ? lnk->Hidden : false); + TreeServer *Node = new TreeServer(Utils, servername, description, sid, ParentOfThis,NULL, lnk ? lnk->Hidden : false); ParentOfThis->AddChild(Node); params[4] = ":" + params[4]; @@ -158,7 +158,7 @@ bool TreeSocket::Outbound_Reply_Server(parameterlist ¶ms) Utils->timeoutlist.erase(this); - TreeServer *Node = new TreeServer(this->Utils, ServerInstance, sname, description, sid, Utils->TreeRoot, this, x->Hidden); + TreeServer *Node = new TreeServer(Utils, sname, description, sid, Utils->TreeRoot, this, x->Hidden); Utils->TreeRoot->AddChild(Node); params[4] = ":" + params[4]; diff --git a/src/modules/m_spanningtree/svsjoin.cpp b/src/modules/m_spanningtree/svsjoin.cpp index 1664190f8..dff882f62 100644 --- a/src/modules/m_spanningtree/svsjoin.cpp +++ b/src/modules/m_spanningtree/svsjoin.cpp @@ -35,7 +35,7 @@ bool TreeSocket::ServiceJoin(const std::string &prefix, parameterlist ¶ms) { /* only join if it's local, otherwise just pass it on! */ if (IS_LOCAL(u)) - Channel::JoinUser(ServerInstance, u, params[1].c_str(), false, "", false, ServerInstance->Time()); + Channel::JoinUser(u, params[1].c_str(), false, "", false, ServerInstance->Time()); Utils->DoOneToAllButSender(prefix,"SVSJOIN",params,prefix); } return true; diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index 567d44858..ffc533daf 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -25,10 +25,10 @@ * represents our own server. Therefore, it has no route, no parent, and * no socket associated with it. Its version string is our own local version. */ -TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, const std::string &id) - : ServerInstance(Instance), ServerName(Name.c_str()), ServerDesc(Desc), Utils(Util) +TreeServer::TreeServer(SpanningTreeUtilities* Util, std::string Name, std::string Desc, const std::string &id) + : ServerName(Name.c_str()), ServerDesc(Desc), Utils(Util) { - age = Instance->Time(); + age = ServerInstance->Time(); bursting = false; Parent = NULL; VersionString.clear(); @@ -46,10 +46,10 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::str * This constructor initializes the server's Route and Parent, and sets up * its ping counters so that it will be pinged one minute from now. */ -TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, const std::string &id, TreeServer* Above, TreeSocket* Sock, bool Hide) - : ServerInstance(Instance), Parent(Above), ServerName(Name.c_str()), ServerDesc(Desc), Socket(Sock), Utils(Util), Hidden(Hide) +TreeServer::TreeServer(SpanningTreeUtilities* Util, std::string Name, std::string Desc, const std::string &id, TreeServer* Above, TreeSocket* Sock, bool Hide) + : Parent(Above), ServerName(Name.c_str()), ServerDesc(Desc), Socket(Sock), Utils(Util), Hidden(Hide) { - age = Instance->Time(); + age = ServerInstance->Time(); bursting = true; VersionString.clear(); ServerUserCount = ServerOperCount = 0; @@ -62,7 +62,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::str gettimeofday(&t, NULL); long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000); this->StartBurst = ts; - Instance->Logs->Log("m_spanningtree",DEBUG, "Started bursting at time %lu", ts); + ServerInstance->Logs->Log("m_spanningtree",DEBUG, "Started bursting at time %lu", ts); /* find the 'route' for this server (e.g. the one directly connected * to the local server, which we can use to reach it) @@ -148,7 +148,7 @@ void TreeServer::FinishBurst() ServerInstance->SNO->WriteToSnoMask(Parent == Utils->TreeRoot ? 'l' : 'L', "Received end of netburst from \2%s\2 (burst time: %lu %s)", ServerName.c_str(), (bursttime > 10000 ? bursttime / 1000 : bursttime), (bursttime > 10000 ? "secs" : "msecs")); Event rmode((char*)ServerName.c_str(), (Module*)Utils->Creator, "new_server"); - rmode.Send(ServerInstance); + rmode.Send(); } void TreeServer::SetID(const std::string &id) diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h index e8db09cdf..24f9c0499 100644 --- a/src/modules/m_spanningtree/treeserver.h +++ b/src/modules/m_spanningtree/treeserver.h @@ -30,7 +30,6 @@ */ class TreeServer : public classbase { - InspIRCd* ServerInstance; /* Creator */ TreeServer* Parent; /* Parent entry */ TreeServer* Route; /* Route entry */ std::vector<TreeServer*> Children; /* List of child objects */ @@ -61,13 +60,13 @@ class TreeServer : public classbase * represents our own server. Therefore, it has no route, no parent, and * no socket associated with it. Its version string is our own local version. */ - TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, const std::string &id); + TreeServer(SpanningTreeUtilities* Util, std::string Name, std::string Desc, const std::string &id); /** When we create a new server, we call this constructor to initialize it. * This constructor initializes the server's Route and Parent, and sets up * its ping counters so that it will be pinged one minute from now. */ - TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, const std::string &id, TreeServer* Above, TreeSocket* Sock, bool Hide); + TreeServer(SpanningTreeUtilities* Util, std::string Name, std::string Desc, const std::string &id, TreeServer* Above, TreeSocket* Sock, bool Hide); int QuitUsers(const std::string &reason); diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 729c273ec..6bb736a85 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -66,7 +66,7 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, int newfd, char* ip, Autocon if (HookMod) BufferedSocketHookRequest(this, Utils->Creator, HookMod).Send(); - hstimer = new HandshakeTimer(ServerInstance, this, &(Utils->LinkBlocks[0]), this->Utils, 1); + hstimer = new HandshakeTimer(this, &(Utils->LinkBlocks[0]), this->Utils, 1); ServerInstance->Timers->AddTimer(hstimer); /* Fix by Brain - inbound sockets need a timeout, too. 30 secs should be pleanty */ @@ -117,7 +117,7 @@ void TreeSocket::OnConnected() if (GetIOHook()) { ServerInstance->SNO->WriteToSnoMask('l', "Connection to \2%s\2[%s] using transport \2%s\2", myhost.c_str(), (x->HiddenFromStats ? "<hidden>" : this->IP.c_str()), x->Hook.c_str()); - hstimer = new HandshakeTimer(ServerInstance, this, &(*x), this->Utils, 1); + hstimer = new HandshakeTimer(this, &(*x), this->Utils, 1); ServerInstance->Timers->AddTimer(hstimer); } else @@ -203,7 +203,7 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason) if ((Current) && (Current != Utils->TreeRoot)) { Event rmode((char*)Current->GetName().c_str(), (Module*)Utils->Creator, "lost_server"); - rmode.Send(ServerInstance); + rmode.Send(); parameterlist params; params.push_back(Current->GetName()); diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index cf537f05b..1b617804e 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -169,7 +169,7 @@ bool TreeSocket::ProcessLine(std::string &line) Link* lnk = Utils->FindLink(InboundServerName); - Node = new TreeServer(this->Utils, ServerInstance, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); + Node = new TreeServer(this->Utils, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); Utils->TreeRoot->AddChild(Node); parameterlist sparams; diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 0f0e75a1d..f1a4e6256 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -87,7 +87,7 @@ bool TreeSocket::ParseUID(const std::string &source, parameterlist ¶ms) User* _new = NULL; try { - _new = new User(ServerInstance, params[0]); + _new = new User(params[0]); } catch (...) { @@ -173,7 +173,7 @@ bool TreeSocket::ParseUID(const std::string &source, parameterlist ¶ms) params[params.size() - 1] = ":" + params[params.size() - 1]; Utils->DoOneToAllButSender(source, "UID", params, source); - FOREACH_MOD_I(ServerInstance,I_OnPostConnect,OnPostConnect(_new)); + FOREACH_MOD(I_OnPostConnect,OnPostConnect(_new)); return true; } diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 8d3c55758..729f6d4ee 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -147,12 +147,12 @@ bool SpanningTreeUtilities::IsServer(const std::string &ServerName) return (FindServer(ServerName) != NULL); } -SpanningTreeUtilities::SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningTree* C) : ServerInstance(Instance), Creator(C) +SpanningTreeUtilities::SpanningTreeUtilities(ModuleSpanningTree* C) : Creator(C) { ServerInstance->Logs->Log("m_spanningtree",DEBUG,"***** Using SID for hash: %s *****", ServerInstance->Config->GetSID().c_str()); - this->TreeRoot = new TreeServer(this, ServerInstance, ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc, ServerInstance->Config->GetSID()); - ServerUser = new FakeUser(ServerInstance, TreeRoot->GetID()); + this->TreeRoot = new TreeServer(this, ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc, ServerInstance->Config->GetSID()); + ServerUser = new FakeUser(TreeRoot->GetID()); this->ReadConfiguration(true); } @@ -418,7 +418,7 @@ void SpanningTreeUtilities::RefreshIPCache() try { bool cached; - SecurityIPResolver* sr = new SecurityIPResolver((Module*)this->Creator, this, ServerInstance, L->IPAddr, *L, cached, start_type); + SecurityIPResolver* sr = new SecurityIPResolver(Creator, this, L->IPAddr, *L, cached, start_type); ServerInstance->AddResolver(sr, cached); } catch (...) @@ -430,7 +430,7 @@ void SpanningTreeUtilities::RefreshIPCache() void SpanningTreeUtilities::ReadConfiguration(bool rebind) { - ConfigReader* Conf = new ConfigReader(ServerInstance); + ConfigReader* Conf = new ConfigReader; /* We don't need to worry about these being *unloaded* on the fly, only loaded, * because we 'use' the interface locking the module in memory. @@ -485,7 +485,7 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) break; } - ServerSocketListener *listener = new ServerSocketListener(ServerInstance, this, portno, (char *)IP.c_str()); + ServerSocketListener *listener = new ServerSocketListener(this, portno, (char *)IP.c_str()); if (listener->GetFd() == -1) { delete listener; @@ -577,7 +577,7 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) try { bool cached; - SecurityIPResolver* sr = new SecurityIPResolver((Module*)this->Creator, this, ServerInstance, L.IPAddr, L, cached, start_type); + SecurityIPResolver* sr = new SecurityIPResolver(Creator, this, L.IPAddr, L, cached, start_type); ServerInstance->AddResolver(sr, cached); } catch (...) diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index 1bdf127d8..2f8fc75db 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -44,7 +44,7 @@ class ServerSocketListener : public ListenSocketBase SpanningTreeUtilities *Utils; public: - ServerSocketListener(InspIRCd* Instance, SpanningTreeUtilities *u, int port, char* addr) : ListenSocketBase(Instance, port, addr) + ServerSocketListener(SpanningTreeUtilities *u, int port, char* addr) : ListenSocketBase(port, addr) { this->Utils = u; Hook = NULL; @@ -82,10 +82,6 @@ class Autoconnect : public classbase */ class SpanningTreeUtilities : public classbase { - private: - /** Creator server - */ - InspIRCd* ServerInstance; public: /** Creator module */ @@ -166,7 +162,7 @@ class SpanningTreeUtilities : public classbase /** Initialise utility class */ - SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningTree* Creator); + SpanningTreeUtilities(ModuleSpanningTree* Creator); /** Destroy class and free listeners etc */ diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp index 0cc660537..12aa0d347 100644 --- a/src/modules/m_spy.cpp +++ b/src/modules/m_spy.cpp @@ -18,8 +18,7 @@ class ModuleSpy : public Module { public: - ModuleSpy(InspIRCd* Me) : Module(Me) - { + ModuleSpy() { ServerInstance->Modules->Attach(I_OnUserList, this); } diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index cd636c633..1b5a39ba4 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -116,8 +116,8 @@ class ModuleSSLInfo : public Module CommandSSLInfo cmd; public: - ModuleSSLInfo(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSSLInfo() + : cmd(this) { ServerInstance->AddCommand(&cmd); @@ -164,7 +164,7 @@ class ModuleSSLInfo : public Module if ((pcmd == "OPER") && (validated)) { - ConfigReader cf(ServerInstance); + ConfigReader cf; char TheHost[MAXBUF]; char TheIP[MAXBUF]; std::string LoginName; diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index 52e506f07..0538f9f62 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -21,7 +21,7 @@ class SSLMode : public ModeHandler { public: - SSLMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'z', PARAM_NONE, MODETYPE_CHANNEL) { } + SSLMode(Module* Creator) : ModeHandler(Creator, 'z', PARAM_NONE, MODETYPE_CHANNEL) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -70,8 +70,8 @@ class ModuleSSLModes : public Module SSLMode sslm; public: - ModuleSSLModes(InspIRCd* Me) - : Module(Me), sslm(Me, this) + ModuleSSLModes() + : sslm(this) { if (!ServerInstance->Modes->AddMode(&sslm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index 34db0c9e5..34662c45b 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -20,7 +20,7 @@ class ChannelStripColor : public SimpleChannelModeHandler { public: - ChannelStripColor(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'S') { } + ChannelStripColor(Module* Creator) : SimpleChannelModeHandler(Creator, 'S') { } }; /** Handles user mode +S @@ -28,7 +28,7 @@ class ChannelStripColor : public SimpleChannelModeHandler class UserStripColor : public SimpleUserModeHandler { public: - UserStripColor(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Creator, 'S') { } + UserStripColor(Module* Creator) : SimpleUserModeHandler(Creator, 'S') { } }; @@ -39,7 +39,7 @@ class ModuleStripColor : public Module UserStripColor usc; public: - ModuleStripColor(InspIRCd* Me) : Module(Me), csc(Me, this), usc(Me, this) + ModuleStripColor() : csc(this), usc(this) { if (!ServerInstance->Modes->AddMode(&usc) || !ServerInstance->Modes->AddMode(&csc)) throw ModuleException("Could not add new modes!"); @@ -115,7 +115,7 @@ class ModuleStripColor : public Module // check if we allow ops to bypass filtering, if we do, check if they're opped accordingly. // note: short circut logic here, don't wreck it. -- w00t - if (CHANOPS_EXEMPT(ServerInstance, 'S') && t->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('S') && t->GetPrefixValue(user) == OP_VALUE) { return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index e99adcaec..26f9cac1a 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -23,8 +23,8 @@ class SVSHold : public XLine public: irc::string nickname; - SVSHold(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string nick) - : XLine(Instance, s_time, d, src, re, "SVSHOLD") + SVSHold(time_t s_time, long d, std::string src, std::string re, std::string nick) + : XLine(s_time, d, src, re, "SVSHOLD") { this->nickname = nick.c_str(); } @@ -64,13 +64,13 @@ public: class SVSHoldFactory : public XLineFactory { public: - SVSHoldFactory(InspIRCd* Instance) : XLineFactory(Instance, "SVSHOLD") { } + SVSHoldFactory() : XLineFactory("SVSHOLD") { } /** Generate a shun */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { - return new SVSHold(ServerInstance, set_time, duration, source, reason, xline_specific_mask); + return new SVSHold(set_time, duration, source, reason, xline_specific_mask); } }; @@ -117,7 +117,7 @@ class CommandSvshold : public Command try { - r = new SVSHold(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str()); + r = new SVSHold(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str()); } catch (...) { @@ -163,7 +163,7 @@ class ModuleSVSHold : public Module public: - ModuleSVSHold(InspIRCd* Me) : Module(Me), cmd(this), s(Me) + ModuleSVSHold() : cmd(this) { ServerInstance->XLines->RegisterFactory(&s); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 0c84764a2..4465b0c89 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -75,7 +75,7 @@ class ModuleSWhois : public Module CommandSwhois cmd; public: - ModuleSWhois(InspIRCd* Me) : Module(Me), cmd(this) + ModuleSWhois() : cmd(this) { ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_OnWhoisLine, I_OnPostCommand }; @@ -104,7 +104,7 @@ class ModuleSWhois : public Module { if ((command != "OPER") || (result != CMD_SUCCESS)) return; - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string swhois; diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 7bbeb13a6..c0816419f 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -118,8 +118,8 @@ class ModuleTimedBans : public Module { CommandTban cmd; public: - ModuleTimedBans(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleTimedBans() + : cmd(this) { ServerInstance->AddCommand(&cmd); TimedBanList.clear(); diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp index d3c8641d1..e39064ca7 100644 --- a/src/modules/m_tline.cpp +++ b/src/modules/m_tline.cpp @@ -63,8 +63,8 @@ class ModuleTLine : public Module { CommandTline cmd; public: - ModuleTLine(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleTLine() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp index f9cd4c596..be199208d 100644 --- a/src/modules/m_uhnames.cpp +++ b/src/modules/m_uhnames.cpp @@ -21,7 +21,7 @@ class ModuleUHNames : public Module public: GenericCap cap; - ModuleUHNames(InspIRCd* Me) : Module(Me), cap(this, "userhost-in-names") + ModuleUHNames() : cap(this, "userhost-in-names") { Implementation eventlist[] = { I_OnEvent, I_OnPreCommand, I_OnNamesListItem, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 4); diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 38b344f5a..c44e15511 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -87,7 +87,7 @@ class ModuleUninvite : public Module public: - ModuleUninvite(InspIRCd* Me) : Module(Me), cmd(this) + ModuleUninvite() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 14a92e068..b229aa39b 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -57,8 +57,8 @@ class ModuleUserIP : public Module { CommandUserip cmd; public: - ModuleUserIP(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleUserIP() + : cmd(this) { ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_On005Numeric }; diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 72b5d669c..f1a074aec 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -27,7 +27,7 @@ class CommandVhost : public Command CmdResult Handle (const std::vector<std::string> ¶meters, User *user) { - ConfigReader *Conf = new ConfigReader(ServerInstance); + ConfigReader *Conf = new ConfigReader; for (int index = 0; index < Conf->Enumerate("vhost"); index++) { @@ -60,7 +60,7 @@ class ModuleVHost : public Module CommandVhost cmd; public: - ModuleVHost(InspIRCd* Me) : Module(Me), cmd(this) + ModuleVHost() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 8c237a8eb..24b4edc09 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -367,8 +367,8 @@ class Modulewatch : public Module CommandSVSWatch sw; public: - Modulewatch(InspIRCd* Me) - : Module(Me), maxwatch(32), cmdw(this, maxwatch), sw(this) + Modulewatch() + : maxwatch(32), cmdw(this, maxwatch), sw(this) { OnRehash(NULL); whos_watching_me = new watchentries(); @@ -381,7 +381,7 @@ class Modulewatch : public Module virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; maxwatch = Conf.ReadInteger("watch", "maxentries", 0, true); if (!maxwatch) maxwatch = 32; diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index efd6a9c1d..991d803d6 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -22,8 +22,7 @@ class ModuleXLineDB : public Module bool reading_db; // If this is true, addlines are as a result of db reading, so don't bother flushing the db to disk. // DO REMEMBER TO SET IT, otherwise it's annoying :P public: - ModuleXLineDB(InspIRCd* Me) : Module(Me) - { + ModuleXLineDB() { Implementation eventlist[] = { I_OnAddLine, I_OnDelLine, I_OnExpireLine }; ServerInstance->Modules->Attach(eventlist, this, 3); diff --git a/src/server.cpp b/src/server.cpp index 0c0eda6ac..cea92ac51 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -50,13 +50,13 @@ void InspIRCd::Exit(int status) void RehashHandler::Call(const std::string &reason) { - Server->SNO->WriteToSnoMask('a', "Rehashing config file %s %s",ServerConfig::CleanFilename(Server->ConfigFileName.c_str()), reason.c_str()); - Server->RehashUsersAndChans(); - FOREACH_MOD_I(Server, I_OnGarbageCollect, OnGarbageCollect()); - if (!Server->ConfigThread) + ServerInstance->SNO->WriteToSnoMask('a', "Rehashing config file %s %s",ServerConfig::CleanFilename(ServerInstance->ConfigFileName.c_str()), reason.c_str()); + ServerInstance->RehashUsersAndChans(); + FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect()); + if (!ServerInstance->ConfigThread) { - Server->ConfigThread = new ConfigReaderThread(Server, ""); - Server->Threads->Start(Server->ConfigThread); + ServerInstance->ConfigThread = new ConfigReaderThread(""); + ServerInstance->Threads->Start(ServerInstance->ConfigThread); } } @@ -87,7 +87,7 @@ void InspIRCd::BuildISupport() v << " CASEMAPPING=rfc1459 STATUSMSG=@" << (this->Config->AllowHalfop ? "%" : "") << "+ CHARSET=ascii TOPICLEN=" << Config->Limits.MaxTopic - 1 << " KICKLEN=" << Config->Limits.MaxKick - 1 << " MAXTARGETS=" << Config->MaxTargets - 1; v << " AWAYLEN=" << Config->Limits.MaxAway - 1 << " CHANMODES=" << this->Modes->GiveModeList(MASK_CHANNEL) << " FNC NETWORK=" << Config->Network << " MAXPARA=32 ELIST=MU"; Config->data005 = v.str(); - FOREACH_MOD_I(this,I_On005Numeric,On005Numeric(Config->data005)); + FOREACH_MOD(I_On005Numeric,On005Numeric(Config->data005)); Config->Update005(); } diff --git a/src/snomasks.cpp b/src/snomasks.cpp index 863b9f2db..742214a6d 100644 --- a/src/snomasks.cpp +++ b/src/snomasks.cpp @@ -17,7 +17,7 @@ #include <stdarg.h> #include "snomasks.h" -SnomaskManager::SnomaskManager(InspIRCd* Instance) : ServerInstance(Instance) +SnomaskManager::SnomaskManager() { SnoMasks.clear(); this->SetupDefaults(); @@ -44,7 +44,7 @@ bool SnomaskManager::EnableSnomask(char letter, const std::string &type) { if (SnoMasks.find(letter) == SnoMasks.end()) { - Snomask *s = new Snomask(ServerInstance, letter, type); + Snomask *s = new Snomask(letter, type); SnoMasks[letter] = s; return true; } @@ -144,7 +144,7 @@ void Snomask::SendMessage(const std::string &message) char mysnomask = MySnomask; ServerInstance->Logs->Log("snomask", DEFAULT, "%s: %s", desc.c_str(), message.c_str()); - FIRST_MOD_RESULT(ServerInstance, OnSendSnotice, MOD_RESULT, (mysnomask, desc, message)); + FIRST_MOD_RESULT(OnSendSnotice, MOD_RESULT, (mysnomask, desc, message)); LastBlocked = (MOD_RESULT == MOD_RES_DENY); diff --git a/src/socket.cpp b/src/socket.cpp index cc9cb79b9..b719ebe82 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -148,7 +148,7 @@ int InspIRCd::BindPorts(FailedPortList &failed_ports) } if (!skip) { - ClientListenSocket *ll = new ClientListenSocket(this, portno, Addr); + ClientListenSocket *ll = new ClientListenSocket(portno, Addr); if (ll->GetFd() > -1) { bound++; diff --git a/src/stats.cpp b/src/stats.cpp index 02cfeaa7c..ba1b19e9a 100644 --- a/src/stats.cpp +++ b/src/stats.cpp @@ -30,7 +30,7 @@ void InspIRCd::DoStats(char statschar, User* user, string_list &results) } ModResult MOD_RESULT; - FIRST_MOD_RESULT(this, OnStats, MOD_RESULT, (statschar, user, results)); + FIRST_MOD_RESULT(OnStats, MOD_RESULT, (statschar, user, results)); if (MOD_RESULT == MOD_RES_DENY) { results.push_back(sn+" 219 "+user->nick+" "+statschar+" :End of /STATS report"); diff --git a/src/testsuite.cpp b/src/testsuite.cpp index d9921a7b8..bc68cb5f1 100644 --- a/src/testsuite.cpp +++ b/src/testsuite.cpp @@ -41,7 +41,7 @@ class TestSuiteThread : public Thread } }; -TestSuite::TestSuite(InspIRCd* Instance) : ServerInstance(Instance) +TestSuite::TestSuite() { cout << "\n\n*** STARTING TESTSUITE ***\n"; @@ -74,12 +74,12 @@ TestSuite::TestSuite(InspIRCd* Instance) : ServerInstance(Instance) case '2': cout << "Enter module filename to load: "; cin >> modname; - cout << (Instance->Modules->Load(modname.c_str()) ? "\nSUCCESS!\n" : "\nFAILURE\n"); + cout << (ServerInstance->Modules->Load(modname.c_str()) ? "\nSUCCESS!\n" : "\nFAILURE\n"); break; case '3': cout << "Enter module filename to unload: "; cin >> modname; - cout << (Instance->Modules->Unload(modname.c_str()) ? "\nSUCCESS!\n" : "\nFAILURE\n"); + cout << (ServerInstance->Modules->Unload(modname.c_str()) ? "\nSUCCESS!\n" : "\nFAILURE\n"); break; case '4': cout << (DoThreadTests() ? "\nSUCCESS!\n" : "\nFAILURE\n"); @@ -271,7 +271,7 @@ bool TestSuite::DoThreadTests() cout << "Creating new ThreadEngine class...\n"; try { - te = new ThreadEngine(ServerInstance); + te = new ThreadEngine; } catch (...) { diff --git a/src/threadengines/threadengine_pthread.cpp b/src/threadengines/threadengine_pthread.cpp index a4a47f8fa..59ab8f402 100644 --- a/src/threadengines/threadengine_pthread.cpp +++ b/src/threadengines/threadengine_pthread.cpp @@ -17,7 +17,7 @@ #include <signal.h> #include <fcntl.h> -ThreadEngine::ThreadEngine(InspIRCd* Instance) +ThreadEngine::ThreadEngine() { } @@ -87,7 +87,7 @@ class ThreadSignalSocket : public BufferedSocket } }; -SocketThread::SocketThread(InspIRCd* SI) +SocketThread::SocketThread() { int fd = eventfd(0, O_NONBLOCK); if (fd < 0) @@ -126,7 +126,7 @@ class ThreadSignalSocket : public BufferedSocket } }; -SocketThread::SocketThread(InspIRCd* SI) +SocketThread::SocketThread() { int fds[2]; if (pipe(fds)) diff --git a/src/threadengines/threadengine_win32.cpp b/src/threadengines/threadengine_win32.cpp index fab75699e..e880d597f 100644 --- a/src/threadengines/threadengine_win32.cpp +++ b/src/threadengines/threadengine_win32.cpp @@ -14,7 +14,7 @@ #include "inspircd.h" #include "threadengines/threadengine_win32.h" -ThreadEngine::ThreadEngine(InspIRCd* Instance) +ThreadEngine::ThreadEngine() { } @@ -67,7 +67,7 @@ class ThreadSignalSocket : public BufferedSocket } }; -SocketThread::SocketThread(InspIRCd* SI) +SocketThread::SocketThread() { int listenFD = socket(AF_INET, SOCK_STREAM, 0); if (listenFD == -1) diff --git a/src/timer.cpp b/src/timer.cpp index 8dab38392..31de8ab1c 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -16,7 +16,7 @@ #include "inspircd.h" #include "timer.h" -TimerManager::TimerManager(InspIRCd* Instance) : ServerInstance(Instance) +TimerManager::TimerManager() { } diff --git a/src/user_resolver.cpp b/src/user_resolver.cpp index b37d112fe..db8d065f1 100644 --- a/src/user_resolver.cpp +++ b/src/user_resolver.cpp @@ -14,8 +14,8 @@ /* $Core */ #include "inspircd.h" -UserResolver::UserResolver(InspIRCd* Instance, User* user, std::string to_resolve, QueryType qt, bool &cache) : - Resolver(Instance, to_resolve, qt, cache), bound_user(user) +UserResolver::UserResolver(User* user, std::string to_resolve, QueryType qt, bool &cache) : + Resolver(to_resolve, qt, cache), bound_user(user) { this->fwd = (qt == DNS_QUERY_A || qt == DNS_QUERY_AAAA); this->bound_fd = user->GetFd(); @@ -37,14 +37,14 @@ void UserResolver::OnLookupComplete(const std::string &result, unsigned int ttl, if (this->bound_user->client_sa.sa.sa_family == AF_INET6) { /* IPV6 forward lookup */ - res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, DNS_QUERY_AAAA, lcached); + res_forward = new UserResolver(bound_user, result, DNS_QUERY_AAAA, lcached); } else { /* IPV4 lookup */ - res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, DNS_QUERY_A, lcached); + res_forward = new UserResolver(bound_user, result, DNS_QUERY_A, lcached); } - this->ServerInstance->AddResolver(res_forward, lcached); + ServerInstance->AddResolver(res_forward, lcached); } } catch (CoreException& e) diff --git a/src/usermanager.cpp b/src/usermanager.cpp index fe6d280c0..db2d3b08e 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -18,7 +18,7 @@ #include "bancache.h" /* add a client connection to the sockets list */ -void UserManager::AddUser(InspIRCd* Instance, int socket, ClientListenSocket* via, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) +void UserManager::AddUser(int socket, ClientListenSocket* via, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) { /* NOTE: Calling this one parameter constructor for User automatically * allocates a new UUID and places it in the hash_map. @@ -26,12 +26,12 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, ClientListenSocket* vi User* New = NULL; try { - New = new User(Instance); + New = new User(); } catch (...) { - Instance->Logs->Log("USERS", DEFAULT,"*** WTF *** Duplicated UUID! -- Crack smoking monkies have been unleashed."); - Instance->SNO->WriteToSnoMask('a', "WARNING *** Duplicate UUID allocated!"); + ServerInstance->Logs->Log("USERS", DEFAULT,"*** WTF *** Duplicated UUID! -- Crack smoking monkies have been unleashed."); + ServerInstance->SNO->WriteToSnoMask('a', "WARNING *** Duplicate UUID allocated!"); return; } @@ -40,7 +40,7 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, ClientListenSocket* vi memcpy(&New->server_sa, server, sizeof(irc::sockets::sockaddrs)); /* Give each of the modules an attempt to hook the user for I/O */ - FOREACH_MOD_I(Instance, I_OnHookIO, OnHookIO(New, via)); + FOREACH_MOD(I_OnHookIO, OnHookIO(New, via)); if (New->GetIOHook()) { @@ -54,7 +54,7 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, ClientListenSocket* vi } } - Instance->Logs->Log("USERS", DEBUG,"New user fd: %d", socket); + ServerInstance->Logs->Log("USERS", DEBUG,"New user fd: %d", socket); this->unregistered_count++; @@ -63,19 +63,19 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, ClientListenSocket* vi /* The users default nick is their UUID */ New->nick.assign(New->uuid, 0, ServerInstance->Config->Limits.NickMax); - New->server = Instance->FindServerNamePtr(Instance->Config->ServerName); + New->server = ServerInstance->FindServerNamePtr(ServerInstance->Config->ServerName); New->ident.assign("unknown"); New->registered = REG_NONE; - New->signon = Instance->Time() + Instance->Config->dns_timeout; + New->signon = ServerInstance->Time() + ServerInstance->Config->dns_timeout; New->lastping = 1; /* Smarter than your average bear^H^H^H^Hset of strlcpys. */ New->dhost.assign(New->GetIPString(), 0, 64); New->host.assign(New->GetIPString(), 0, 64); - Instance->Users->AddLocalClone(New); - Instance->Users->AddGlobalClone(New); + ServerInstance->Users->AddLocalClone(New); + ServerInstance->Users->AddGlobalClone(New); /* * First class check. We do this again in FullConnect after DNS is done, and NICK/USER is recieved. @@ -97,9 +97,9 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, ClientListenSocket* vi this->local_users.push_back(New); - if ((this->local_users.size() > Instance->Config->SoftLimit) || (this->local_users.size() >= (unsigned int)Instance->SE->GetMaxFds())) + if ((this->local_users.size() > ServerInstance->Config->SoftLimit) || (this->local_users.size() >= (unsigned int)ServerInstance->SE->GetMaxFds())) { - Instance->SNO->WriteToSnoMask('a', "Warning: softlimit value has been reached: %d clients", Instance->Config->SoftLimit); + ServerInstance->SNO->WriteToSnoMask('a', "Warning: softlimit value has been reached: %d clients", ServerInstance->Config->SoftLimit); this->QuitUser(New,"No more connections allowed"); return; } @@ -109,29 +109,29 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, ClientListenSocket* vi * besides that, if we get a positive bancache hit, we still won't fuck * them over if they are exempt. -- w00t */ - New->exempt = (Instance->XLines->MatchesLine("E",New) != NULL); + New->exempt = (ServerInstance->XLines->MatchesLine("E",New) != NULL); - if (BanCacheHit *b = Instance->BanCache->GetHit(New->GetIPString())) + if (BanCacheHit *b = ServerInstance->BanCache->GetHit(New->GetIPString())) { if (!b->Type.empty() && !New->exempt) { /* user banned */ - Instance->Logs->Log("BANCACHE", DEBUG, std::string("BanCache: Positive hit for ") + New->GetIPString()); - if (*Instance->Config->MoronBanner) - New->WriteServ("NOTICE %s :*** %s", New->nick.c_str(), Instance->Config->MoronBanner); + ServerInstance->Logs->Log("BANCACHE", DEBUG, std::string("BanCache: Positive hit for ") + New->GetIPString()); + if (*ServerInstance->Config->MoronBanner) + New->WriteServ("NOTICE %s :*** %s", New->nick.c_str(), ServerInstance->Config->MoronBanner); this->QuitUser(New, b->Reason); return; } else { - Instance->Logs->Log("BANCACHE", DEBUG, std::string("BanCache: Negative hit for ") + New->GetIPString()); + ServerInstance->Logs->Log("BANCACHE", DEBUG, std::string("BanCache: Negative hit for ") + New->GetIPString()); } } else { if (!New->exempt) { - XLine* r = Instance->XLines->MatchesLine("Z",New); + XLine* r = ServerInstance->XLines->MatchesLine("Z",New); if (r) { @@ -141,9 +141,9 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, ClientListenSocket* vi } } - if (!Instance->SE->AddFd(New, FD_WANT_FAST_READ | FD_WANT_EDGE_WRITE)) + if (!ServerInstance->SE->AddFd(New, FD_WANT_FAST_READ | FD_WANT_EDGE_WRITE)) { - Instance->Logs->Log("USERS", DEBUG,"Internal error on new connection"); + ServerInstance->Logs->Log("USERS", DEBUG,"Internal error on new connection"); this->QuitUser(New, "Internal error handling connection"); } @@ -152,7 +152,7 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, ClientListenSocket* vi */ New->WriteServ("NOTICE Auth :*** Looking up your hostname..."); - if (Instance->Config->NoUserDns) + if (ServerInstance->Config->NoUserDns) { New->WriteServ("NOTICE %s :*** Skipping host resolution (disabled by server administrator)", New->nick.c_str()); New->dns_done = true; @@ -194,12 +194,12 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char if (user->registered == REG_ALL) { - FOREACH_MOD_I(ServerInstance,I_OnUserQuit,OnUserQuit(user, reason, oper_reason)); + FOREACH_MOD(I_OnUserQuit,OnUserQuit(user, reason, oper_reason)); user->PurgeEmptyChannels(); user->WriteCommonQuit(reason, oper_reason); } - FOREACH_MOD_I(ServerInstance,I_OnUserDisconnect,OnUserDisconnect(user)); + FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(user)); if (user->registered != REG_ALL) if (ServerInstance->Users->unregistered_count) @@ -517,7 +517,7 @@ void UserManager::WriteMode(const char* modes, int flags, const char* text, ...) /* return how many users have a given mode e.g. 'a' */ int UserManager::ModeCount(const char mode) { - ModeHandler* mh = this->ServerInstance->Modes->FindMode(mode, MODETYPE_USER); + ModeHandler* mh = ServerInstance->Modes->FindMode(mode, MODETYPE_USER); if (mh) return mh->GetCount(); diff --git a/src/userprocess.cpp b/src/userprocess.cpp index b150f2828..bc354fa6d 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -20,17 +20,17 @@ void FloodQuitUserHandler::Call(User* current) { - Server->Logs->Log("USERS",DEFAULT,"Excess flood from: %s@%s", current->ident.c_str(), current->host.c_str()); - Server->SNO->WriteToSnoMask('f',"Excess flood from: %s%s%s@%s", + ServerInstance->Logs->Log("USERS",DEFAULT,"Excess flood from: %s@%s", current->ident.c_str(), current->host.c_str()); + ServerInstance->SNO->WriteToSnoMask('f',"Excess flood from: %s%s%s@%s", current->registered == REG_ALL ? current->nick.c_str() : "", current->registered == REG_ALL ? "!" : "", current->ident.c_str(), current->host.c_str()); - Server->Users->QuitUser(current, "Excess flood"); + ServerInstance->Users->QuitUser(current, "Excess flood"); if (current->registered != REG_ALL) { - ZLine* zl = new ZLine(Server, Server->Time(), 0, Server->Config->ServerName, "Flood from unregistered connection", current->GetIPString()); - if (Server->XLines->AddLine(zl,NULL)) - Server->XLines->ApplyLines(); + ZLine* zl = new ZLine(ServerInstance->Time(), 0, ServerInstance->Config->ServerName, "Flood from unregistered connection", current->GetIPString()); + if (ServerInstance->XLines->AddLine(zl,NULL)) + ServerInstance->XLines->ApplyLines(); else delete zl; } diff --git a/src/users.cpp b/src/users.cpp index b63350386..f5165edfa 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -109,7 +109,7 @@ void User::StartDNSLookup() UserResolver *res_reverse; QueryType resolvtype = this->client_sa.sa.sa_family == AF_INET6 ? DNS_QUERY_PTR6 : DNS_QUERY_PTR4; - res_reverse = new UserResolver(ServerInstance, this, sip, resolvtype, cached); + res_reverse = new UserResolver(this, sip, resolvtype, cached); ServerInstance->AddResolver(res_reverse, cached); } @@ -205,9 +205,9 @@ void User::DecrementModes() } } -User::User(InspIRCd* Instance, const std::string &uid) +User::User(const std::string &uid) { - server = Instance->FindServerNamePtr(Instance->Config->ServerName); + server = ServerInstance->FindServerNamePtr(ServerInstance->Config->ServerName); age = ServerInstance->Time(); Penalty = 0; lastping = signon = idle_lastmsg = nping = registered = 0; @@ -220,15 +220,15 @@ User::User(InspIRCd* Instance, const std::string &uid) AllowedPrivs = AllowedOperCommands = NULL; if (uid.empty()) - uuid.assign(Instance->GetUID(), 0, UUID_LENGTH - 1); + uuid.assign(ServerInstance->GetUID(), 0, UUID_LENGTH - 1); else uuid.assign(uid, 0, UUID_LENGTH - 1); ServerInstance->Logs->Log("USERS", DEBUG,"New UUID for user: %s (%s)", uuid.c_str(), uid.empty() ? "allocated new" : "used remote"); - user_hash::iterator finduuid = Instance->Users->uuidlist->find(uuid); - if (finduuid == Instance->Users->uuidlist->end()) - (*Instance->Users->uuidlist)[uuid] = this; + user_hash::iterator finduuid = ServerInstance->Users->uuidlist->find(uuid); + if (finduuid == ServerInstance->Users->uuidlist->end()) + (*ServerInstance->Users->uuidlist)[uuid] = this; else throw CoreException("Duplicate UUID "+std::string(uuid)+" in User constructor"); } @@ -853,7 +853,7 @@ void User::FullConnect() ModResult MOD_RESULT; std::string command("LUSERS"); std::vector<std::string> parameters; - FIRST_MOD_RESULT(ServerInstance, OnPreCommand, MOD_RESULT, (command, parameters, this, true, "LUSERS")); + FIRST_MOD_RESULT(OnPreCommand, MOD_RESULT, (command, parameters, this, true, "LUSERS")); if (!MOD_RESULT) ServerInstance->CallCommandHandler(command, parameters, this); @@ -910,7 +910,7 @@ bool User::ForceNickChange(const char* newnick) this->InvalidateCache(); NICKForced.set(this, 1); - FIRST_MOD_RESULT(ServerInstance, OnUserPreNick, MOD_RESULT, (this, newnick)); + FIRST_MOD_RESULT(OnUserPreNick, MOD_RESULT, (this, newnick)); NICKForced.set(this, 0); if (MOD_RESULT == MOD_RES_DENY) @@ -1148,7 +1148,7 @@ void User::WriteNumeric(unsigned int numeric, const std::string &text) char textbuffer[MAXBUF]; ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnNumeric, MOD_RESULT, (this, numeric, text)); + FIRST_MOD_RESULT(OnNumeric, MOD_RESULT, (this, numeric, text)); if (MOD_RESULT == MOD_RES_DENY) return; @@ -1409,7 +1409,7 @@ bool User::ChangeName(const char* gecos) if (IS_LOCAL(this)) { ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnChangeLocalUserGECOS, MOD_RESULT, (this,gecos)); + FIRST_MOD_RESULT(OnChangeLocalUserGECOS, MOD_RESULT, (this,gecos)); if (MOD_RESULT == MOD_RES_DENY) return false; FOREACH_MOD(I_OnChangeName,OnChangeName(this,gecos)); @@ -1424,7 +1424,7 @@ void User::DoHostCycle(const std::string &quitline) char buffer[MAXBUF]; ModResult result = MOD_RES_PASSTHRU; - FIRST_MOD_RESULT(ServerInstance, OnHostCycle, result, (this)); + FIRST_MOD_RESULT(OnHostCycle, result, (this)); if (result == MOD_RES_DENY) return; @@ -1475,7 +1475,7 @@ bool User::ChangeDisplayedHost(const char* shost) if (IS_LOCAL(this)) { ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnChangeLocalUserHost, MOD_RESULT, (this,shost)); + FIRST_MOD_RESULT(OnChangeLocalUserHost, MOD_RESULT, (this,shost)); if (MOD_RESULT == MOD_RES_DENY) return false; } @@ -1734,7 +1734,7 @@ void User::PurgeEmptyChannels() if (i2 != ServerInstance->chanlist->end()) { ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnChannelPreDelete, MOD_RESULT, (i2->second)); + FIRST_MOD_RESULT(OnChannelPreDelete, MOD_RESULT, (i2->second)); if (MOD_RESULT == MOD_RES_DENY) continue; // delete halted by module FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(i2->second)); diff --git a/src/whois.cpp b/src/whois.cpp index fc24d0c82..83bfd31da 100644 --- a/src/whois.cpp +++ b/src/whois.cpp @@ -68,7 +68,7 @@ void InspIRCd::DoWhois(User* user, User* dest,unsigned long signon, unsigned lon } } - FOREACH_MOD_I(this, I_OnWhois,OnWhois(user,dest)); + FOREACH_MOD(I_OnWhois,OnWhois(user,dest)); /* * We only send these if we've been provided them. That is, if hidewhois is turned off, and user is local, or diff --git a/src/xline.cpp b/src/xline.cpp index b15a7ce2b..2fa6dda00 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -181,7 +181,7 @@ bool XLineManager::AddLine(XLine* line, User* user) } } - /*ELine* item = new ELine(ServerInstance, ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());*/ + /*ELine* item = new ELine(ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());*/ XLineFactory* xlf = GetFactory(line->type); if (!xlf) return false; @@ -389,13 +389,13 @@ void XLineManager::InvokeStats(const std::string &type, int numeric, User* user, } -XLineManager::XLineManager(InspIRCd* Instance) : ServerInstance(Instance) +XLineManager::XLineManager() { - GFact = new GLineFactory(Instance); - EFact = new ELineFactory(Instance); - KFact = new KLineFactory(Instance); - QFact = new QLineFactory(Instance); - ZFact = new ZLineFactory(Instance); + GFact = new GLineFactory; + EFact = new ELineFactory; + KFact = new KLineFactory; + QFact = new QLineFactory; + ZFact = new ZLineFactory; RegisterFactory(GFact); RegisterFactory(EFact); diff --git a/win/inspircd_namedpipe.cpp b/win/inspircd_namedpipe.cpp index 93d7c423a..95c0ae578 100644 --- a/win/inspircd_namedpipe.cpp +++ b/win/inspircd_namedpipe.cpp @@ -6,7 +6,7 @@ #include <psapi.h>
-IPCThread::IPCThread(InspIRCd* Instance) : Thread(), ServerInstance(Instance)
+IPCThread::IPCThread()
{
if (!initwmi())
ServerInstance->Logs->Log("IPC", DEBUG, "Could not initialise WMI. CPU percantage reports will not be available.");
@@ -127,7 +127,7 @@ void IPCThread::SetResult(int newresult) }
-IPC::IPC(InspIRCd* Srv) : ServerInstance(Srv)
+IPC::IPC()
{
/* The IPC pipe is threaded */
thread = new IPCThread(Srv);
diff --git a/win/inspircd_namedpipe.h b/win/inspircd_namedpipe.h index 98647d1b8..eef2c9df0 100644 --- a/win/inspircd_namedpipe.h +++ b/win/inspircd_namedpipe.h @@ -4,19 +4,16 @@ #include "threadengine.h" #include <windows.h> -class InspIRCd; - class IPCThread : public Thread { BOOL Connected; DWORD BytesRead; BOOL Success; HANDLE Pipe; - InspIRCd* ServerInstance; char status[MAXBUF]; int result; public: - IPCThread(InspIRCd* Instance); + IPCThread(); virtual ~IPCThread(); virtual void Run(); const char GetStatus(); @@ -28,12 +25,11 @@ class IPCThread : public Thread class IPC { private: - InspIRCd* ServerInstance; IPCThread* thread; public: - IPC(InspIRCd* Srv); + IPC(); void Check(); ~IPC(); }; -#endif
\ No newline at end of file +#endif diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp index 1008cb838..223fb648e 100644 --- a/win/inspircd_win32wrapper.cpp +++ b/win/inspircd_win32wrapper.cpp @@ -413,12 +413,12 @@ void ClearConsole() /* Many inspircd classes contain function pointers/functors which can be changed to point at platform specific implementations * of code. This function repoints these pointers and functors so that calls are windows specific. */ -void ChangeWindowsSpecificPointers(InspIRCd* Instance) +void ChangeWindowsSpecificPointers() { Instance->Logs->Log("win32",DEBUG,"Changing to windows specific pointer and functor set"); } -DWORD WindowsForkStart(InspIRCd* Instance) +DWORD WindowsForkStart() { /* Windows implementation of fork() :P */ if (owner_processid) @@ -498,7 +498,7 @@ DWORD WindowsForkStart(InspIRCd* Instance) return ExitCode; } -void WindowsForkKillOwner(InspIRCd * Instance) +void WindowsForkKillOwner() { HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, owner_processid); if(!hProcess || !owner_processid) diff --git a/win/inspircd_win32wrapper.h b/win/inspircd_win32wrapper.h index 8120e193f..a1eba11e9 100644 --- a/win/inspircd_win32wrapper.h +++ b/win/inspircd_win32wrapper.h @@ -220,7 +220,6 @@ void * ::operator new(size_t iSize); void ::operator delete(void * ptr); /* IPC Handlers */ -class InspIRCd; class ValueItem; class ServerConfig; @@ -230,11 +229,11 @@ CoreExport std::string FindNameServerWin(); /* Clear a windows console */ CoreExport void ClearConsole(); -CoreExport DWORD WindowsForkStart(InspIRCd* Instance); +CoreExport DWORD WindowsForkStart(); -CoreExport void WindowsForkKillOwner(InspIRCd* Instance); +CoreExport void WindowsForkKillOwner(); -CoreExport void ChangeWindowsSpecificPointers(InspIRCd* Instance); +CoreExport void ChangeWindowsSpecificPointers(); CoreExport bool ValidateWindowsDnsServer(ServerConfig* conf, const char* tag, const char* value, ValueItem &data); |