diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-10 22:40:57 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-10 22:40:57 +0000 |
commit | f9636a2eff46f6829bf9e01c711ab1ba45a7d50a (patch) | |
tree | 4fd9dc8529e9e0adbd5acb47b5fa0f960aef195c | |
parent | 24b1fbeec8e61e9636daaf606778c324d3ae3042 (diff) |
So much stuff changed in this one, i forgot most of it.
Oh yeah, main thing is ModeHandler and ModeWatcher classes now take an InspIRCd* to their constructor
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4858 e03df62e-2008-0410-955e-edbf42e46eb7
80 files changed, 244 insertions, 218 deletions
diff --git a/include/command_parse.h b/include/command_parse.h index 800f2beeb..d00cdd058 100644 --- a/include/command_parse.h +++ b/include/command_parse.h @@ -23,17 +23,21 @@ #include "users.h" #include "ctables.h" #include "typedefs.h" - + +class InspIRCd; + class CommandParser : public classbase { private: + InspIRCd* ServerInstance; + int ProcessParameters(char **command_p,char *parameters); void ProcessCommand(userrec *user, std::string &cmd); void SetupCommandTable(); public: command_table cmdlist; - CommandParser(); + CommandParser(InspIRCd* Instance); bool CallHandler(const std::string &commandname,const char** parameters, int pcnt, userrec *user); bool IsValidCommand(const std::string &commandname, int pcnt, userrec * user); int LoopCall(userrec* user, command_t* CommandObj, const char** parameters, int pcnt, unsigned int splithere, unsigned int extra); diff --git a/include/cull_list.h b/include/cull_list.h index adc9fe8d5..96d5a83c5 100644 --- a/include/cull_list.h +++ b/include/cull_list.h @@ -28,6 +28,8 @@ #include "users.h" #include "channels.h" +class InspIRCd; + /** The CullItem class holds a user and their quitmessage, * and is used internally by the CullList class to compile * a list of users which are to be culled when a long @@ -79,6 +81,9 @@ class CullItem : public classbase class CullList : public classbase { private: + /** Creator of this CullList + */ + InspIRCd* ServerInstance; /** Holds a list of users being quit. * See the information for CullItem for * more information. @@ -101,8 +106,9 @@ class CullList : public classbase /** Constructor. * Clears the CullList::list and CullList::exempt * items. + * @param Instance Creator of this CullList object */ - CullList(); + CullList(InspIRCd* Instance); /** Adds a user to the cull list for later * removal via QUIT. * @param user The user to add diff --git a/include/dynamic.h b/include/dynamic.h index 386ebb376..4440c476d 100644 --- a/include/dynamic.h +++ b/include/dynamic.h @@ -22,10 +22,12 @@ typedef void * (initfunc) (void); #include "inspircd_config.h" +class InspIRCd; + class DLLManager { public: - DLLManager(const char *fname); + DLLManager(InspIRCd* ServerInstance, const char *fname); virtual ~DLLManager(); @@ -52,7 +54,7 @@ class DLLManager class DLLFactoryBase : public DLLManager { public: - DLLFactoryBase(const char *fname, const char *func_name = 0); + DLLFactoryBase(InspIRCd* Instance, const char *fname, const char *func_name = 0); virtual ~DLLFactoryBase(); #ifdef STATIC_LINK initfunc *factory_func; @@ -64,7 +66,7 @@ class DLLFactoryBase : public DLLManager template <class T> class DLLFactory : public DLLFactoryBase { public: - DLLFactory(const char *fname, const char *func_name=0) : DLLFactoryBase(fname,func_name) + DLLFactory(InspIRCd* Instance, const char *fname, const char *func_name=0) : DLLFactoryBase(Instance, fname, func_name) { if (factory_func) factory = reinterpret_cast<T*>(factory_func()); diff --git a/include/inspircd.h b/include/inspircd.h index 42072919e..b1f6431ab 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -133,6 +133,10 @@ class InspIRCd : public classbase Module* FindModule(const std::string &name); + int BindPorts(bool bail); + bool HasPort(int port, char* addr); + bool BindSocket(int sockfd, insp_sockaddr client, insp_sockaddr server, int port, char* addr); + void AddServerName(const std::string &servername); const char* FindServerNamePtr(const std::string &servername); bool FindServerName(const std::string &servername); diff --git a/include/mode.h b/include/mode.h index 63a64363a..2e51946d0 100644 --- a/include/mode.h +++ b/include/mode.h @@ -28,6 +28,8 @@ #include "channels.h" #include "ctables.h" +class InspIRCd; + /** * Holds the values for different type of modes * that can exist, USER or CHANNEL type. @@ -79,6 +81,7 @@ typedef std::pair<bool,std::string> ModePair; class ModeHandler : public Extensible { protected: + InspIRCd* ServerInstance; /** * The mode letter you're implementing. */ @@ -125,7 +128,7 @@ class ModeHandler : public Extensible * @param ModeType Set this to MODETYPE_USER for a usermode, or MODETYPE_CHANNEL for a channelmode. * @param operonly Set this to true if only opers should be allowed to set or unset the mode. */ - ModeHandler(char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly); + ModeHandler(InspIRCd* Instance, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly); /** * The default destructor does nothing */ @@ -215,6 +218,7 @@ class ModeHandler : public Extensible class ModeWatcher : public Extensible { protected: + InspIRCd* ServerInstance; /** * The mode letter this class is watching */ @@ -228,7 +232,7 @@ class ModeWatcher : public Extensible /** * The constructor initializes the mode and the mode type */ - ModeWatcher(char modeletter, ModeType type); + ModeWatcher(InspIRCd* Instance, char modeletter, ModeType type); /** * The default destructor does nothing. */ @@ -277,6 +281,7 @@ typedef std::vector<ModeWatcher*>::iterator ModeWatchIter; class ModeParser : public classbase { private: + InspIRCd* ServerInstance; /** * Mode handlers for each mode, to access a handler subtract * 65 from the ascii value of the mode letter. @@ -301,21 +306,21 @@ class ModeParser : public classbase /** * The constructor initializes all the RFC basic modes by using ModeParserAddMode(). */ - ModeParser(); + ModeParser(InspIRCd* Instance); /** * Used to check if user 'd' should be allowed to do operation 'MASK' on channel 'chan'. * for example, should 'user A' be able to 'op' on 'channel B'. */ - static userrec* SanityChecks(userrec *user,const char *dest,chanrec *chan,int status); + userrec* SanityChecks(userrec *user,const char *dest,chanrec *chan,int status); /** * Grant a built in privilage (e.g. ops, halfops, voice) to a user on a channel */ - static const char* Grant(userrec *d,chanrec *chan,int MASK); + const char* Grant(userrec *d,chanrec *chan,int MASK); /** * Revoke a built in privilage (e.g. ops, halfops, voice) to a user on a channel */ - static const char* Revoke(userrec *d,chanrec *chan,int MASK); + const char* Revoke(userrec *d,chanrec *chan,int MASK); /** * Tidy a banmask. This makes a banmask 'acceptable' if fields are left out. * E.g. diff --git a/include/modes/cmode_b.h b/include/modes/cmode_b.h index 34b90c9b9..e17a6909a 100644 --- a/include/modes/cmode_b.h +++ b/include/modes/cmode_b.h @@ -1,12 +1,14 @@ #include "mode.h" #include "channels.h" +class InspIRCd; + class ModeChannelBan : public ModeHandler { private: BanItem b; public: - ModeChannelBan(); + ModeChannelBan(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); std::string& AddBan(userrec *user,std::string& dest,chanrec *chan,int status); std::string& DelBan(userrec *user,std::string& dest,chanrec *chan,int status); diff --git a/include/modes/cmode_h.h b/include/modes/cmode_h.h index eaf2149af..e1253d03c 100644 --- a/include/modes/cmode_h.h +++ b/include/modes/cmode_h.h @@ -1,11 +1,13 @@ #include "mode.h" #include "channels.h" +class InspIRCd; + class ModeChannelHalfOp : public ModeHandler { private: public: - ModeChannelHalfOp(); + ModeChannelHalfOp(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); std::string AddHalfOp(userrec *user,const char *dest,chanrec *chan,int status); std::string DelHalfOp(userrec *user,const char *dest,chanrec *chan,int status); diff --git a/include/modes/cmode_i.h b/include/modes/cmode_i.h index 7320cb169..b8bea88a8 100644 --- a/include/modes/cmode_i.h +++ b/include/modes/cmode_i.h @@ -1,8 +1,10 @@ #include "mode.h" +class InspIRCd; + class ModeChannelInviteOnly : public ModeHandler { public: - ModeChannelInviteOnly(); + ModeChannelInviteOnly(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); }; diff --git a/include/modes/cmode_k.h b/include/modes/cmode_k.h index 8434fc5c4..16769b572 100644 --- a/include/modes/cmode_k.h +++ b/include/modes/cmode_k.h @@ -1,9 +1,11 @@ #include "mode.h" +class InspIRCd; + class ModeChannelKey : public ModeHandler { public: - ModeChannelKey(); + ModeChannelKey(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter); bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel); diff --git a/include/modes/cmode_l.h b/include/modes/cmode_l.h index 69c132e56..dbedb610a 100644 --- a/include/modes/cmode_l.h +++ b/include/modes/cmode_l.h @@ -1,9 +1,11 @@ #include "mode.h" +class InspIRCd; + class ModeChannelLimit : public ModeHandler { public: - ModeChannelLimit(); + ModeChannelLimit(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter); bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel); diff --git a/include/modes/cmode_m.h b/include/modes/cmode_m.h index d8cff2aa4..7f8380540 100644 --- a/include/modes/cmode_m.h +++ b/include/modes/cmode_m.h @@ -1,8 +1,10 @@ #include "mode.h" +class InspIRCd; + class ModeChannelModerated : public ModeHandler { public: - ModeChannelModerated(); + ModeChannelModerated(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); }; diff --git a/include/modes/cmode_n.h b/include/modes/cmode_n.h index ebed70103..96559b81d 100644 --- a/include/modes/cmode_n.h +++ b/include/modes/cmode_n.h @@ -1,8 +1,10 @@ #include "mode.h" +class InspIRCd; + class ModeChannelNoExternal : public ModeHandler { public: - ModeChannelNoExternal(); + ModeChannelNoExternal(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); }; diff --git a/include/modes/cmode_o.h b/include/modes/cmode_o.h index ff166b5e2..25b03a786 100644 --- a/include/modes/cmode_o.h +++ b/include/modes/cmode_o.h @@ -1,11 +1,13 @@ #include "mode.h" #include "channels.h" +class InspIRCd; + class ModeChannelOp : public ModeHandler { private: public: - ModeChannelOp(); + ModeChannelOp(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); std::string AddOp(userrec *user,const char *dest,chanrec *chan,int status); std::string DelOp(userrec *user,const char *dest,chanrec *chan,int status); diff --git a/include/modes/cmode_p.h b/include/modes/cmode_p.h index 87ffca4cb..38a043da8 100644 --- a/include/modes/cmode_p.h +++ b/include/modes/cmode_p.h @@ -1,8 +1,10 @@ #include "mode.h" +class InspIRCd; + class ModeChannelPrivate : public ModeHandler { public: - ModeChannelPrivate(); + ModeChannelPrivate(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); }; diff --git a/include/modes/cmode_s.h b/include/modes/cmode_s.h index 981bddfaf..b72038f26 100644 --- a/include/modes/cmode_s.h +++ b/include/modes/cmode_s.h @@ -1,8 +1,10 @@ #include "mode.h" +class InspIRCd; + class ModeChannelSecret : public ModeHandler { public: - ModeChannelSecret(); + ModeChannelSecret(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); }; diff --git a/include/modes/cmode_t.h b/include/modes/cmode_t.h index 7e852400b..8c4a27a4d 100644 --- a/include/modes/cmode_t.h +++ b/include/modes/cmode_t.h @@ -1,8 +1,10 @@ #include "mode.h" +class InspIRCd; + class ModeChannelTopicOps : public ModeHandler { public: - ModeChannelTopicOps(); + ModeChannelTopicOps(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); }; diff --git a/include/modes/cmode_v.h b/include/modes/cmode_v.h index 3e747ca9d..a2d94938d 100644 --- a/include/modes/cmode_v.h +++ b/include/modes/cmode_v.h @@ -1,11 +1,13 @@ #include "mode.h" #include "channels.h" +class InspIRCd; + class ModeChannelVoice : public ModeHandler { private: public: - ModeChannelVoice(); + ModeChannelVoice(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); std::string AddVoice(userrec *user,const char *dest,chanrec *chan,int status); std::string DelVoice(userrec *user,const char *dest,chanrec *chan,int status); diff --git a/include/modes/umode_i.h b/include/modes/umode_i.h index 61626f3ce..dad12473e 100644 --- a/include/modes/umode_i.h +++ b/include/modes/umode_i.h @@ -1,8 +1,10 @@ #include "mode.h" +class InspIRCd; + class ModeUserInvisible : public ModeHandler { public: - ModeUserInvisible(); + ModeUserInvisible(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); }; diff --git a/include/modes/umode_n.h b/include/modes/umode_n.h index cf449f324..bb4cb2717 100644 --- a/include/modes/umode_n.h +++ b/include/modes/umode_n.h @@ -1,8 +1,10 @@ #include "mode.h" +class InspIRCd; + class ModeUserServerNoticeMask : public ModeHandler { public: - ModeUserServerNoticeMask(); + ModeUserServerNoticeMask(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); }; diff --git a/include/modes/umode_o.h b/include/modes/umode_o.h index fd389b4b0..736909fdf 100644 --- a/include/modes/umode_o.h +++ b/include/modes/umode_o.h @@ -1,8 +1,10 @@ #include "mode.h" +class InspIRCd; + class ModeUserOperator : public ModeHandler { public: - ModeUserOperator(); + ModeUserOperator(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); }; diff --git a/include/modes/umode_s.h b/include/modes/umode_s.h index c108cb44d..f982d32b9 100644 --- a/include/modes/umode_s.h +++ b/include/modes/umode_s.h @@ -1,8 +1,10 @@ #include "mode.h" +class InspIRCd; + class ModeUserServerNotice : public ModeHandler { public: - ModeUserServerNotice(); + ModeUserServerNotice(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); }; diff --git a/include/modes/umode_w.h b/include/modes/umode_w.h index e92d1ece2..ce3db0a52 100644 --- a/include/modes/umode_w.h +++ b/include/modes/umode_w.h @@ -1,8 +1,10 @@ #include "mode.h" +class InspIRCd; + class ModeUserWallops : public ModeHandler { public: - ModeUserWallops(); + ModeUserWallops(InspIRCd* Instance); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); }; diff --git a/include/socket.h b/include/socket.h index 8219ff5dd..92cd57130 100644 --- a/include/socket.h +++ b/include/socket.h @@ -65,8 +65,6 @@ namespace irc void NonBlocking(int s); int OpenTCPSocket(); - bool BindSocket(int sockfd, insp_sockaddr client, insp_sockaddr server, int port, char* addr); - int BindPorts(bool bail); }; }; diff --git a/include/u_listmode.h b/include/u_listmode.h index 45b04c158..8e1b9e335 100644 --- a/include/u_listmode.h +++ b/include/u_listmode.h @@ -58,8 +58,8 @@ class ListModeBase : public ModeHandler limitlist chanlimits; public: - ListModeBase(Server* serv, char modechar, const std::string &eolstr, const std::string &lnum, const std::string &eolnum, bool autotidy, const std::string &ctag = "banlist") - : ModeHandler(modechar, 1, 1, true, MODETYPE_CHANNEL, false), Srv(serv), listnumeric(lnum), endoflistnumeric(eolnum), endofliststring(eolstr), tidy(autotidy), configtag(ctag) + ListModeBase(InspIRCd* Instance, Server* serv, char modechar, const std::string &eolstr, const std::string &lnum, const std::string &eolnum, bool autotidy, const std::string &ctag = "banlist") + : ModeHandler(Instance, modechar, 1, 1, true, MODETYPE_CHANNEL, false), Srv(serv), listnumeric(lnum), endoflistnumeric(eolnum), endofliststring(eolstr), tidy(autotidy), configtag(ctag) { this->DoRehash(); infokey = "exceptionbase_mode_" + std::string(1, mode) + "_list"; diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 952a65e36..4d8251fa5 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -48,12 +48,8 @@ #define nspace __gnu_cxx -extern InspIRCd* ServerInstance; - extern time_t TIME; -extern Server* MyServer; - /* Special commands which may occur without registration of the user */ cmd_user* command_user; cmd_nick* command_nick; @@ -323,7 +319,7 @@ bool CommandParser::CreateCommand(command_t *f) else return false; } -CommandParser::CommandParser() +CommandParser::CommandParser(InspIRCd* Instance) : ServerInstance(Instance) { this->SetupCommandTable(); } diff --git a/src/configreader.cpp b/src/configreader.cpp index 0f9fbfc7f..e4f56421e 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -28,8 +28,6 @@ extern time_t TIME; -using irc::sockets::BindPorts; - std::vector<std::string> old_module_names, new_module_names, added_modules, removed_modules; ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance) @@ -796,7 +794,7 @@ void ServerConfig::Read(bool bail, userrec* user) */ if (!bail) { - ServerInstance->stats->BoundPortCount = BindPorts(false); + ServerInstance->stats->BoundPortCount = ServerInstance->BindPorts(false); if (!removed_modules.empty()) for (std::vector<std::string>::iterator removing = removed_modules.begin(); removing != removed_modules.end(); removing++) diff --git a/src/cull_list.cpp b/src/cull_list.cpp index 18c86f631..50ecfe518 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -38,8 +38,6 @@ using namespace std; #include "typedefs.h" #include "cull_list.h" -extern InspIRCd* ServerInstance; - /* * In current implementation of CullList, this isn't used. It did odd things with a lot of sockets. */ @@ -98,7 +96,7 @@ std::string& CullItem::GetReason() return this->reason; } -CullList::CullList() +CullList::CullList(InspIRCd* Instance) : ServerInstance(Instance) { list.clear(); exempt.clear(); diff --git a/src/dynamic.cpp b/src/dynamic.cpp index c75371a39..23e1e3267 100644 --- a/src/dynamic.cpp +++ b/src/dynamic.cpp @@ -29,13 +29,12 @@ using namespace std; #include "inspstring.h" #include "helperfuncs.h" +#include "inspircd.h" #include <unistd.h> #include <sys/types.h> #include <stdio.h> -extern InspIRCd* ServerInstance; - -DLLManager::DLLManager(const char *fname) +DLLManager::DLLManager(InspIRCd* ServerInstance, const char *fname) { err = NULL; @@ -183,7 +182,7 @@ bool DLLManager::GetSymbol(void** v, const char* sym_name) #endif -DLLFactoryBase::DLLFactoryBase(const char* fname, const char* symbol) : DLLManager(fname) +DLLFactoryBase::DLLFactoryBase(InspIRCd* Instance, const char* fname, const char* symbol) : DLLManager(Instance, fname) { // try get the factory function if there is no error yet factory_func = 0; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 5ed9b1cc9..439c4a305 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -64,7 +64,6 @@ #include "typedefs.h" #include "command_parse.h" -using irc::sockets::BindPorts; using irc::sockets::NonBlocking; using irc::sockets::insp_ntoa; using irc::sockets::insp_inaddr; @@ -287,12 +286,12 @@ InspIRCd::InspIRCd(int argc, char** argv) : ModCount(-1) OpenLog(argv, argc); this->stats = new serverstats(); - this->Parser = new CommandParser(); + this->Parser = new CommandParser(this); this->Timers = new TimerManager(); Config->ClearStack(); Config->Read(true, NULL); CheckRoot(); - this->ModeGrok = new ModeParser(); + this->ModeGrok = new ModeParser(this); this->AddServerName(Config->ServerName); CheckDie(); InitializeDisabledCommands(Config->DisabledCommands, this); @@ -573,7 +572,7 @@ bool InspIRCd::LoadModule(const char* filename) } try { - ircd_module* a = new ircd_module(modfile); + ircd_module* a = new ircd_module(this, modfile); factory[this->ModCount+1] = a; if (factory[this->ModCount+1]->LastError()) { diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 184eec0f3..860b9b44c 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -27,7 +27,6 @@ #include "socketengine.h" #include "inspircd.h" -using irc::sockets::BindSocket; using irc::sockets::OpenTCPSocket; using irc::sockets::insp_inaddr; using irc::sockets::insp_sockaddr; @@ -74,7 +73,7 @@ InspSocket::InspSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool } else { - if (!BindSocket(this->fd,this->client,this->server,aport,(char*)ipaddr.c_str())) + if (!SI->BindSocket(this->fd,this->client,this->server,aport,(char*)ipaddr.c_str())) { log(DEBUG,"BindSocket() error %s",strerror(errno)); this->Close(); diff --git a/src/mode.cpp b/src/mode.cpp index 29b935475..0d86a5c4c 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -65,12 +65,12 @@ using namespace std; /* +n (notice mask - our implementation of snomasks) */ #include "modes/umode_n.h" -extern InspIRCd* ServerInstance; - extern time_t TIME; -ModeHandler::ModeHandler(char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly) - : mode(modeletter), n_params_on(parameters_on), n_params_off(parameters_off), list(listmode), m_type(type), oper(operonly) +extern InspIRCd* ServerInstance; + +ModeHandler::ModeHandler(InspIRCd* Instance, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly) + : ServerInstance(Instance), mode(modeletter), n_params_on(parameters_on), n_params_off(parameters_off), list(listmode), m_type(type), oper(operonly) { } @@ -129,7 +129,7 @@ bool ModeHandler::CheckTimeStamp(time_t theirs, time_t ours, const std::string & return (ours < theirs); } -ModeWatcher::ModeWatcher(char modeletter, ModeType type) : mode(modeletter), m_type(type) +ModeWatcher::ModeWatcher(InspIRCd* Instance, char modeletter, ModeType type) : ServerInstance(Instance), mode(modeletter), m_type(type) { } @@ -661,7 +661,7 @@ bool ModeParser::DelModeWatcher(ModeWatcher* mw) return true; } -ModeParser::ModeParser() +ModeParser::ModeParser(InspIRCd* Instance) : ServerInstance(Instance) { /* Clear mode list */ memset(modehandlers, 0, sizeof(modehandlers)); @@ -670,29 +670,29 @@ ModeParser::ModeParser() /* Initialise the RFC mode letters */ /* Start with channel simple modes, no params */ - this->AddMode(new ModeChannelSecret, 's'); - this->AddMode(new ModeChannelPrivate, 'p'); - this->AddMode(new ModeChannelModerated, 'm'); - this->AddMode(new ModeChannelTopicOps, 't'); - this->AddMode(new ModeChannelNoExternal, 'n'); - this->AddMode(new ModeChannelInviteOnly, 'i'); + this->AddMode(new ModeChannelSecret(Instance), 's'); + this->AddMode(new ModeChannelPrivate(Instance), 'p'); + this->AddMode(new ModeChannelModerated(Instance), 'm'); + this->AddMode(new ModeChannelTopicOps(Instance), 't'); + this->AddMode(new ModeChannelNoExternal(Instance), 'n'); + this->AddMode(new ModeChannelInviteOnly(Instance), 'i'); /* Cannel modes with params */ - this->AddMode(new ModeChannelKey, 'k'); - this->AddMode(new ModeChannelLimit, 'l'); + this->AddMode(new ModeChannelKey(Instance), 'k'); + this->AddMode(new ModeChannelLimit(Instance), 'l'); /* Channel listmodes */ - this->AddMode(new ModeChannelBan, 'b'); - this->AddMode(new ModeChannelOp, 'o'); - this->AddMode(new ModeChannelHalfOp, 'h'); - this->AddMode(new ModeChannelVoice, 'v'); + this->AddMode(new ModeChannelBan(Instance), 'b'); + this->AddMode(new ModeChannelOp(Instance), 'o'); + this->AddMode(new ModeChannelHalfOp(Instance), 'h'); + this->AddMode(new ModeChannelVoice(Instance), 'v'); /* Now for usermodes */ - this->AddMode(new ModeUserServerNotice, 's'); - this->AddMode(new ModeUserWallops, 'w'); - this->AddMode(new ModeUserInvisible, 'i'); - this->AddMode(new ModeUserOperator, 'o'); - this->AddMode(new ModeUserServerNoticeMask, 'n'); + this->AddMode(new ModeUserServerNotice(Instance), 's'); + this->AddMode(new ModeUserWallops(Instance), 'w'); + this->AddMode(new ModeUserInvisible(Instance), 'i'); + this->AddMode(new ModeUserOperator(Instance), 'o'); + this->AddMode(new ModeUserServerNoticeMask(Instance), 'n'); } bool ModeParser::InsertMode(std::string &output, const char* mode, unsigned short section) diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp index 8c1c2cd63..f265c1094 100644 --- a/src/modes/cmode_b.cpp +++ b/src/modes/cmode_b.cpp @@ -13,14 +13,9 @@ #include "hashcomp.h" #include "modes/cmode_b.h" -extern InspIRCd* ServerInstance; -extern InspIRCd* ServerInstance; -extern std::vector<Module*> modules; -extern std::vector<ircd_module*> factory; -extern int MODCOUNT; extern time_t TIME; -ModeChannelBan::ModeChannelBan() : ModeHandler('b', 1, 1, true, MODETYPE_CHANNEL, false) +ModeChannelBan::ModeChannelBan(InspIRCd* Instance) : ModeHandler(Instance, 'b', 1, 1, true, MODETYPE_CHANNEL, false) { } diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp index 0fd4bfa07..493d4f776 100644 --- a/src/modes/cmode_h.cpp +++ b/src/modes/cmode_h.cpp @@ -14,14 +14,9 @@ #include "hashcomp.h" #include "modes/cmode_h.h" -extern InspIRCd* ServerInstance; - -extern std::vector<Module*> modules; -extern std::vector<ircd_module*> factory; -extern int MODCOUNT; extern time_t TIME; -ModeChannelHalfOp::ModeChannelHalfOp() : ModeHandler('h', 1, 1, true, MODETYPE_CHANNEL, false) +ModeChannelHalfOp::ModeChannelHalfOp(InspIRCd* Instance) : ModeHandler(Instance, 'h', 1, 1, true, MODETYPE_CHANNEL, false) { } @@ -74,7 +69,7 @@ ModeAction ModeChannelHalfOp::OnModeChange(userrec* source, userrec* dest, chanr std::string ModeChannelHalfOp::AddHalfOp(userrec *user,const char* dest,chanrec *chan,int status) { - userrec *d = ModeParser::SanityChecks(user,dest,chan,status); + userrec *d = ServerInstance->ModeGrok->SanityChecks(user,dest,chan,status); if (d) { @@ -95,14 +90,14 @@ std::string ModeChannelHalfOp::AddHalfOp(userrec *user,const char* dest,chanrec } } - return ModeParser::Grant(d,chan,UCMODE_HOP); + return ServerInstance->ModeGrok->Grant(d,chan,UCMODE_HOP); } return ""; } std::string ModeChannelHalfOp::DelHalfOp(userrec *user,const char *dest,chanrec *chan,int status) { - userrec *d = ModeParser::SanityChecks(user,dest,chan,status); + userrec *d = ServerInstance->ModeGrok->SanityChecks(user,dest,chan,status); if (d) { @@ -123,7 +118,7 @@ std::string ModeChannelHalfOp::DelHalfOp(userrec *user,const char *dest,chanrec } } - return ModeParser::Revoke(d,chan,UCMODE_HOP); + return ServerInstance->ModeGrok->Revoke(d,chan,UCMODE_HOP); } return ""; } diff --git a/src/modes/cmode_i.cpp b/src/modes/cmode_i.cpp index d74ac86e7..78115cb60 100644 --- a/src/modes/cmode_i.cpp +++ b/src/modes/cmode_i.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/cmode_i.h" -ModeChannelInviteOnly::ModeChannelInviteOnly() : ModeHandler('i', 0, 0, false, MODETYPE_CHANNEL, false) +ModeChannelInviteOnly::ModeChannelInviteOnly(InspIRCd* Instance) : ModeHandler(Instance, 'i', 0, 0, false, MODETYPE_CHANNEL, false) { } diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp index e509447f3..8e00f96f7 100644 --- a/src/modes/cmode_k.cpp +++ b/src/modes/cmode_k.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/cmode_k.h" -ModeChannelKey::ModeChannelKey() : ModeHandler('k', 1, 1, false, MODETYPE_CHANNEL, false) +ModeChannelKey::ModeChannelKey(InspIRCd* Instance) : ModeHandler(Instance, 'k', 1, 1, false, MODETYPE_CHANNEL, false) { } diff --git a/src/modes/cmode_l.cpp b/src/modes/cmode_l.cpp index cdbf0f58f..3bdacd60e 100644 --- a/src/modes/cmode_l.cpp +++ b/src/modes/cmode_l.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/cmode_l.h" -ModeChannelLimit::ModeChannelLimit() : ModeHandler('l', 1, 0, false, MODETYPE_CHANNEL, false) +ModeChannelLimit::ModeChannelLimit(InspIRCd* Instance) : ModeHandler(Instance, 'l', 1, 0, false, MODETYPE_CHANNEL, false) { } diff --git a/src/modes/cmode_m.cpp b/src/modes/cmode_m.cpp index b3c41df12..d3826d19f 100644 --- a/src/modes/cmode_m.cpp +++ b/src/modes/cmode_m.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/cmode_m.h" -ModeChannelModerated::ModeChannelModerated() : ModeHandler('m', 0, 0, false, MODETYPE_CHANNEL, false) +ModeChannelModerated::ModeChannelModerated(InspIRCd* Instance) : ModeHandler(Instance, 'm', 0, 0, false, MODETYPE_CHANNEL, false) { } diff --git a/src/modes/cmode_n.cpp b/src/modes/cmode_n.cpp index 85b45626a..b7f3ff23d 100644 --- a/src/modes/cmode_n.cpp +++ b/src/modes/cmode_n.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/cmode_n.h" -ModeChannelNoExternal::ModeChannelNoExternal() : ModeHandler('n', 0, 0, false, MODETYPE_CHANNEL, false) +ModeChannelNoExternal::ModeChannelNoExternal(InspIRCd* Instance) : ModeHandler(Instance, 'n', 0, 0, false, MODETYPE_CHANNEL, false) { } diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp index 75e088635..528cd4ede 100644 --- a/src/modes/cmode_o.cpp +++ b/src/modes/cmode_o.cpp @@ -14,14 +14,9 @@ #include "hashcomp.h" #include "modes/cmode_o.h" -extern InspIRCd* ServerInstance; - -extern std::vector<Module*> modules; -extern std::vector<ircd_module*> factory; -extern int MODCOUNT; extern time_t TIME; -ModeChannelOp::ModeChannelOp() : ModeHandler('o', 1, 1, true, MODETYPE_CHANNEL, false) +ModeChannelOp::ModeChannelOp(InspIRCd* Instance) : ModeHandler(Instance, 'o', 1, 1, true, MODETYPE_CHANNEL, false) { } @@ -65,7 +60,7 @@ ModeAction ModeChannelOp::OnModeChange(userrec* source, userrec* dest, chanrec* std::string ModeChannelOp::AddOp(userrec *user,const char* dest,chanrec *chan,int status) { - userrec *d = ModeParser::SanityChecks(user,dest,chan,status); + userrec *d = ServerInstance->ModeGrok->SanityChecks(user,dest,chan,status); if (d) { @@ -86,14 +81,14 @@ std::string ModeChannelOp::AddOp(userrec *user,const char* dest,chanrec *chan,in } } - return ModeParser::Grant(d,chan,UCMODE_OP); + return ServerInstance->ModeGrok->Grant(d,chan,UCMODE_OP); } return ""; } std::string ModeChannelOp::DelOp(userrec *user,const char *dest,chanrec *chan,int status) { - userrec *d = ModeParser::SanityChecks(user,dest,chan,status); + userrec *d = ServerInstance->ModeGrok->SanityChecks(user,dest,chan,status); if (d) { @@ -117,7 +112,7 @@ std::string ModeChannelOp::DelOp(userrec *user,const char *dest,chanrec *chan,in } } - return ModeParser::Revoke(d,chan,UCMODE_OP); + return ServerInstance->ModeGrok->Revoke(d,chan,UCMODE_OP); } return ""; } diff --git a/src/modes/cmode_p.cpp b/src/modes/cmode_p.cpp index ef4892fc3..cff09895f 100644 --- a/src/modes/cmode_p.cpp +++ b/src/modes/cmode_p.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/cmode_p.h" -ModeChannelPrivate::ModeChannelPrivate() : ModeHandler('p', 0, 0, false, MODETYPE_CHANNEL, false) +ModeChannelPrivate::ModeChannelPrivate(InspIRCd* Instance) : ModeHandler(Instance, 'p', 0, 0, false, MODETYPE_CHANNEL, false) { } diff --git a/src/modes/cmode_s.cpp b/src/modes/cmode_s.cpp index eec99b91d..800f9f6cb 100644 --- a/src/modes/cmode_s.cpp +++ b/src/modes/cmode_s.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/cmode_s.h" -ModeChannelSecret::ModeChannelSecret() : ModeHandler('s', 0, 0, false, MODETYPE_CHANNEL, false) +ModeChannelSecret::ModeChannelSecret(InspIRCd* Instance) : ModeHandler(Instance, 's', 0, 0, false, MODETYPE_CHANNEL, false) { } diff --git a/src/modes/cmode_t.cpp b/src/modes/cmode_t.cpp index 836c86f34..b2484ff12 100644 --- a/src/modes/cmode_t.cpp +++ b/src/modes/cmode_t.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/cmode_t.h" -ModeChannelTopicOps::ModeChannelTopicOps() : ModeHandler('t', 0, 0, false, MODETYPE_CHANNEL, false) +ModeChannelTopicOps::ModeChannelTopicOps(InspIRCd* Instance) : ModeHandler(Instance, 't', 0, 0, false, MODETYPE_CHANNEL, false) { } diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp index 7888666ca..c834c47fd 100644 --- a/src/modes/cmode_v.cpp +++ b/src/modes/cmode_v.cpp @@ -14,14 +14,9 @@ #include "hashcomp.h" #include "modes/cmode_v.h" -extern InspIRCd* ServerInstance; - -extern std::vector<Module*> modules; -extern std::vector<ircd_module*> factory; -extern int MODCOUNT; extern time_t TIME; -ModeChannelVoice::ModeChannelVoice() : ModeHandler('v', 1, 1, true, MODETYPE_CHANNEL, false) +ModeChannelVoice::ModeChannelVoice(InspIRCd* Instance) : ModeHandler(Instance, 'v', 1, 1, true, MODETYPE_CHANNEL, false) { } @@ -65,7 +60,7 @@ ModeAction ModeChannelVoice::OnModeChange(userrec* source, userrec* dest, chanre std::string ModeChannelVoice::AddVoice(userrec *user,const char* dest,chanrec *chan,int status) { - userrec *d = ModeParser::SanityChecks(user,dest,chan,status); + userrec *d = ServerInstance->ModeGrok->SanityChecks(user,dest,chan,status); if (d) { @@ -86,14 +81,14 @@ std::string ModeChannelVoice::AddVoice(userrec *user,const char* dest,chanrec *c } } - return ModeParser::Grant(d,chan,UCMODE_VOICE); + return ServerInstance->ModeGrok->Grant(d,chan,UCMODE_VOICE); } return ""; } std::string ModeChannelVoice::DelVoice(userrec *user,const char *dest,chanrec *chan,int status) { - userrec *d = ModeParser::SanityChecks(user,dest,chan,status); + userrec *d = ServerInstance->ModeGrok->SanityChecks(user,dest,chan,status); if (d) { @@ -114,7 +109,7 @@ std::string ModeChannelVoice::DelVoice(userrec *user,const char *dest,chanrec *c } } - return ModeParser::Revoke(d,chan,UCMODE_VOICE); + return ServerInstance->ModeGrok->Revoke(d,chan,UCMODE_VOICE); } return ""; } diff --git a/src/modes/umode_i.cpp b/src/modes/umode_i.cpp index 584a12ff5..60ca4955f 100644 --- a/src/modes/umode_i.cpp +++ b/src/modes/umode_i.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/umode_i.h" -ModeUserInvisible::ModeUserInvisible() : ModeHandler('i', 0, 0, false, MODETYPE_USER, false) +ModeUserInvisible::ModeUserInvisible(InspIRCd* Instance) : ModeHandler(Instance, 'i', 0, 0, false, MODETYPE_USER, false) { } diff --git a/src/modes/umode_n.cpp b/src/modes/umode_n.cpp index 6c1b380f3..e3370fa56 100644 --- a/src/modes/umode_n.cpp +++ b/src/modes/umode_n.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/umode_n.h" -ModeUserServerNoticeMask::ModeUserServerNoticeMask() : ModeHandler('n', 1, 0, false, MODETYPE_USER, true) +ModeUserServerNoticeMask::ModeUserServerNoticeMask(InspIRCd* Instance) : ModeHandler(Instance, 'n', 1, 0, false, MODETYPE_USER, true) { } diff --git a/src/modes/umode_o.cpp b/src/modes/umode_o.cpp index 861fb62dc..356f68d4e 100644 --- a/src/modes/umode_o.cpp +++ b/src/modes/umode_o.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/umode_o.h" -ModeUserOperator::ModeUserOperator() : ModeHandler('o', 0, 0, false, MODETYPE_USER, true) +ModeUserOperator::ModeUserOperator(InspIRCd* Instance) : ModeHandler(Instance, 'o', 0, 0, false, MODETYPE_USER, true) { } diff --git a/src/modes/umode_s.cpp b/src/modes/umode_s.cpp index 0c005f56a..4a5add907 100644 --- a/src/modes/umode_s.cpp +++ b/src/modes/umode_s.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/umode_s.h" -ModeUserServerNotice::ModeUserServerNotice() : ModeHandler('s', 0, 0, false, MODETYPE_USER, false) +ModeUserServerNotice::ModeUserServerNotice(InspIRCd* Instance) : ModeHandler(Instance, 's', 0, 0, false, MODETYPE_USER, false) { } diff --git a/src/modes/umode_w.cpp b/src/modes/umode_w.cpp index 8cfbf8fd2..af00ac17e 100644 --- a/src/modes/umode_w.cpp +++ b/src/modes/umode_w.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/umode_w.h" -ModeUserWallops::ModeUserWallops() : ModeHandler('w', 0, 0, false, MODETYPE_USER, false) +ModeUserWallops::ModeUserWallops(InspIRCd* Instance) : ModeHandler(Instance, 'w', 0, 0, false, MODETYPE_USER, false) { } diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 9bb92fd61..a5cdaf3e0 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -48,7 +48,7 @@ class ModuleSSLGnuTLS : public Module char* dummy; - CullList culllist; + CullList* culllist; std::vector<int> listenports; @@ -70,6 +70,8 @@ class ModuleSSLGnuTLS : public Module : Module::Module(Me) { Srv = Me; + + culllist = new CullList(ServerInstance); // Not rehashable...because I cba to reduce all the sizes of existing buffers. inbufsize = ServerInstance->Config->NetBufferSize; @@ -196,6 +198,7 @@ class ModuleSSLGnuTLS : public Module gnutls_dh_params_deinit(dh_params); gnutls_certificate_free_credentials(x509_cred); gnutls_global_deinit(); + delete culllist; } virtual void OnCleanup(int target_type, void* item) @@ -209,7 +212,7 @@ class ModuleSSLGnuTLS : public Module // User is using SSL, they're a local user, and they're using one of *our* SSL ports. // Potentially there could be multiple SSL modules loaded at once on different ports. log(DEBUG, "m_ssl_gnutls.so: Adding user %s to cull list", user->nick); - culllist.AddItem(user, "SSL module unloading"); + culllist->AddItem(user, "SSL module unloading"); } } } @@ -219,7 +222,7 @@ class ModuleSSLGnuTLS : public Module if(mod == this) { // We're being unloaded, kill all the users added to the cull list in OnCleanup - int numusers = culllist.Apply(); + int numusers = culllist->Apply(); log(DEBUG, "m_ssl_gnutls.so: Killed %d users for unload of GnuTLS SSL module", numusers); for(unsigned int i = 0; i < listenports.size(); i++) diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index f9f38fc17..7d10b78be 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -62,7 +62,7 @@ class ModuleSSLOpenSSL : public Module Server* Srv; ConfigReader* Conf; - CullList culllist; + CullList* culllist; std::vector<int> listenports; @@ -85,6 +85,8 @@ class ModuleSSLOpenSSL : public Module : Module::Module(Me) { Srv = Me; + + culllist = new CullList(ServerInstance); // Not rehashable...because I cba to reduce all the sizes of existing buffers. inbufsize = ServerInstance->Config->NetBufferSize; @@ -220,6 +222,7 @@ class ModuleSSLOpenSSL : public Module virtual ~ModuleSSLOpenSSL() { SSL_CTX_free(ctx); + delete culllist; } virtual void OnCleanup(int target_type, void* item) @@ -233,7 +236,7 @@ class ModuleSSLOpenSSL : public Module // User is using SSL, they're a local user, and they're using one of *our* SSL ports. // Potentially there could be multiple SSL modules loaded at once on different ports. log(DEBUG, "m_ssl_openssl.so: Adding user %s to cull list", user->nick); - culllist.AddItem(user, "SSL module unloading"); + culllist->AddItem(user, "SSL module unloading"); } } } @@ -243,7 +246,7 @@ class ModuleSSLOpenSSL : public Module if(mod == this) { // We're being unloaded, kill all the users added to the cull list in OnCleanup - int numusers = culllist.Apply(); + int numusers = culllist->Apply(); log(DEBUG, "m_ssl_openssl.so: Killed %d users for unload of OpenSSL SSL module", numusers); for(unsigned int i = 0; i < listenports.size(); i++) diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index 588c42b5e..0c56edd7e 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -23,7 +23,7 @@ extern InspIRCd* ServerInstance; class BanException : public ListModeBase { public: - BanException(Server* serv) : ListModeBase(serv, 'e', "End of Channel Exception List", "348", "349", true) { } + BanException(InspIRCd* Instance, Server* serv) : ListModeBase(Instance, serv, 'e', "End of Channel Exception List", "348", "349", true) { } }; @@ -36,7 +36,7 @@ public: ModuleBanException(Server* serv) : Module::Module(serv) { - be = new BanException(serv); + be = new BanException(ServerInstance, serv); Srv = serv; Srv->AddMode(be, 'e'); } diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 8cc3d8646..76d535380 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -29,7 +29,7 @@ extern InspIRCd* ServerInstance; class BlockCaps : public ModeHandler { public: - BlockCaps() : ModeHandler('P', 0, 0, false, MODETYPE_CHANNEL, false) { } + BlockCaps(InspIRCd* Instance) : ModeHandler(Instance, 'P', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -63,7 +63,7 @@ public: ModuleBlockCAPS(Server* Me) : Module::Module(Me) { Srv = Me; - bc = new BlockCaps; + bc = new BlockCaps(ServerInstance); Srv->AddMode(bc, 'P'); } diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index 75d86bba0..4ededb4a3 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -31,7 +31,7 @@ extern InspIRCd* ServerInstance; class BlockColor : public ModeHandler { public: - BlockColor() : ModeHandler('c', 0, 0, false, MODETYPE_CHANNEL, false) { } + BlockColor(InspIRCd* Instance) : ModeHandler(Instance, 'c', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -65,7 +65,7 @@ class ModuleBlockColour : public Module ModuleBlockColour(Server* Me) : Module::Module(Me) { Srv = Me; - bc = new BlockColor(); + bc = new BlockColor(ServerInstance); Srv->AddMode(bc, 'c'); } diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 0f402a1ed..b33e63e19 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -32,7 +32,7 @@ extern InspIRCd* ServerInstance; class BotMode : public ModeHandler { public: - BotMode() : ModeHandler('B', 0, 0, false, MODETYPE_USER, false) { } + BotMode(InspIRCd* Instance) : ModeHandler(Instance, 'B', 0, 0, false, MODETYPE_USER, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -70,7 +70,7 @@ class ModuleBotMode : public Module : Module::Module(Me) { Srv = Me; - bm = new BotMode(); + bm = new BotMode(ServerInstance); Srv->AddMode(bm, 'B'); } diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index deeb68685..4bc5b43e5 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -42,7 +42,7 @@ class CensorException : public ModuleException class CensorUser : public ModeHandler { public: - CensorUser() : ModeHandler('G', 0, 0, false, MODETYPE_USER, false) { } + CensorUser(InspIRCd* Instance) : ModeHandler(Instance, 'G', 0, 0, false, MODETYPE_USER, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -74,7 +74,7 @@ class CensorUser : public ModeHandler class CensorChannel : public ModeHandler { public: - CensorChannel() : ModeHandler('G', 0, 0, false, MODETYPE_CHANNEL, false) { } + CensorChannel(InspIRCd* Instance) : ModeHandler(Instance, 'G', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -125,8 +125,8 @@ class ModuleCensor : public Module */ Srv = Me; OnRehash(""); - cu = new CensorUser; - cc = new CensorChannel; + cu = new CensorUser(ServerInstance); + cc = new CensorChannel(ServerInstance); Srv->AddMode(cu, 'G'); Srv->AddMode(cc, 'G'); } diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 22442de98..6756fd8ec 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -34,7 +34,7 @@ extern InspIRCd* ServerInstance; class ChanFilter : public ListModeBase { public: - ChanFilter(Server* serv) : ListModeBase(serv, 'g', "End of channel spamfilter list", "941", "940", false, "chanfilter") { } + ChanFilter(InspIRCd* Instance, Server* serv) : ListModeBase(Instance, serv, 'g', "End of channel spamfilter list", "941", "940", false, "chanfilter") { } virtual bool ValidateParam(userrec* user, chanrec* chan, std::string &word) { @@ -74,7 +74,7 @@ class ModuleChanFilter : public Module ModuleChanFilter(Server* Me) : Module::Module(Me), Srv(Me) { - cf = new ChanFilter(Srv); + cf = new ChanFilter(ServerInstance, Srv); Srv->AddMode(cf, 'g'); } diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 024887792..920c34a17 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -32,7 +32,7 @@ class ChanFounder : public ModeHandler char* dummyptr; public: - ChanFounder(Server* s) : ModeHandler('q', 1, 1, true, MODETYPE_CHANNEL, false), Srv(s) { } + ChanFounder(InspIRCd* Instance, Server* s) : ModeHandler(Instance, 'q', 1, 1, true, MODETYPE_CHANNEL, false), Srv(s) { } ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) { @@ -147,7 +147,7 @@ class ChanProtect : public ModeHandler Server* Srv; char* dummyptr; public: - ChanProtect(Server* s) : ModeHandler('a', 1, 1, true, MODETYPE_CHANNEL, false), Srv(s) { } + ChanProtect(InspIRCd* Instance, Server* s) : ModeHandler(Instance, 'a', 1, 1, true, MODETYPE_CHANNEL, false), Srv(s) { } ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) { @@ -258,8 +258,8 @@ class ModuleChanProtect : public Module { /* Initialise module variables */ - cp = new ChanProtect(Me); - cf = new ChanFounder(Me); + cp = new ChanProtect(ServerInstance, Me); + cf = new ChanFounder(ServerInstance, Me); Srv->AddMode(cp, 'a'); Srv->AddMode(cf, 'q'); diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 92fac501e..f3b5bcb7e 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -285,7 +285,7 @@ class CloakUser : public ModeHandler } public: - CloakUser(Server* Me) : ModeHandler('x', 0, 0, false, MODETYPE_USER, false), Srv(Me) { } + CloakUser(InspIRCd* Instance, Server* Me) : ModeHandler(Instance, 'x', 0, 0, false, MODETYPE_USER, false), Srv(Me) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -406,7 +406,7 @@ class ModuleCloaking : public Module : Module::Module(Me), Srv(Me) { /* Create new mode handler object */ - cu = new CloakUser(Srv); + cu = new CloakUser(ServerInstance, Srv); /* Register it with the core */ Srv->AddMode(cu, 'x'); diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index a02ad1172..289522d7f 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -53,7 +53,7 @@ class cmd_globops : public command_t class ModeGlobops : public ModeHandler { public: - ModeGlobops() : ModeHandler('g', 0, 0, false, MODETYPE_USER, true) { } + ModeGlobops(InspIRCd* Instance) : ModeHandler(Instance, 'g', 0, 0, false, MODETYPE_USER, true) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -88,7 +88,7 @@ class ModuleGlobops : public Module : Module::Module(Me) { Srv = Me; - mg = new ModeGlobops(); + mg = new ModeGlobops(ServerInstance); Srv->AddMode(mg, 'g'); mycommand = new cmd_globops(); Srv->AddCommand(mycommand); diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 00ba05c24..d0ec1a0aa 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -36,7 +36,7 @@ void sendtohelpop(userrec*, int, const char**); class Helpop : public ModeHandler { public: - Helpop() : ModeHandler('h', 0, 0, false, MODETYPE_USER, true) { } + Helpop(InspIRCd* Instance) : ModeHandler(Instance, 'h', 0, 0, false, MODETYPE_USER, true) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -207,7 +207,7 @@ class ModuleHelpop : public Module Srv = Me; ReadConfig(); - ho = new Helpop(); + ho = new Helpop(ServerInstance); Srv->AddMode(ho, 'h'); mycommand = new cmd_helpop(); Srv->AddCommand(mycommand); diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index 5bd8d17e6..f3e278e98 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -24,7 +24,7 @@ class InspIRCd* ServerInstance; class InviteException : public ListModeBase { public: - InviteException(Server* serv) : ListModeBase(serv, 'I', "End of Channel Invite Exception List", "346", "347", true) { } + InviteException(InspIRCd* Instance, Server* serv) : ListModeBase(Instance, serv, 'I', "End of Channel Invite Exception List", "346", "347", true) { } }; class ModuleInviteException : public Module @@ -35,7 +35,7 @@ class ModuleInviteException : public Module public: ModuleInviteException(Server* serv) : Module(serv) { - ie = new InviteException(serv); + ie = new InviteException(ServerInstance, serv); Srv = serv; Srv->AddMode(ie, 'I'); } diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 60794c804..3adbb5332 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -101,7 +101,7 @@ class joinfloodsettings : public classbase class JoinFlood : public ModeHandler { public: - JoinFlood() : ModeHandler('j', 1, 0, false, MODETYPE_CHANNEL, false) { } + JoinFlood(InspIRCd* Instance) : ModeHandler(Instance, 'j', 1, 0, false, MODETYPE_CHANNEL, false) { } ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) { @@ -197,7 +197,7 @@ class ModuleJoinFlood : public Module : Module::Module(Me) { Srv = Me; - jf = new JoinFlood(); + jf = new JoinFlood(ServerInstance); Srv->AddMode(jf, 'j'); } diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 268b8d5f7..811a51725 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -25,7 +25,7 @@ typedef std::map<userrec*, time_t> delaylist; class KickRejoin : public ModeHandler { public: - KickRejoin() : ModeHandler('J', 1, 0, false, MODETYPE_CHANNEL, false) { } + KickRejoin(InspIRCd* Instance) : ModeHandler(Instance, 'J', 1, 0, false, MODETYPE_CHANNEL, false) { } ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) { @@ -79,7 +79,7 @@ public: : Module::Module(Me) { Srv = Me; - kr = new KickRejoin(); + kr = new KickRejoin(ServerInstance); Srv->AddMode(kr, 'J'); } diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index ce956b9e0..1272f2be8 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -80,7 +80,7 @@ class cmd_knock : public command_t class Knock : public ModeHandler { public: - Knock() : ModeHandler('K', 0, 0, false, MODETYPE_CHANNEL, false) { } + Knock(InspIRCd* Instance) : ModeHandler(Instance, 'K', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -113,7 +113,7 @@ class ModuleKnock : public Module ModuleKnock(Server* Me) : Module::Module(Me) { Srv = Me; - kn = new Knock(); + kn = new Knock(ServerInstance); Srv->AddMode(kn, 'K'); mycommand = new cmd_knock(); Srv->AddCommand(mycommand); diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 7dfe9b943..9049eca8c 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -89,7 +89,7 @@ class floodsettings : public classbase class MsgFlood : public ModeHandler { public: - MsgFlood() : ModeHandler('f', 1, 0, false, MODETYPE_CHANNEL, false) { } + MsgFlood(InspIRCd* Instance) : ModeHandler(Instance, 'f', 1, 0, false, MODETYPE_CHANNEL, false) { } ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) { @@ -195,7 +195,7 @@ class ModuleMsgFlood : public Module : Module::Module(Me) { Srv = Me; - mf = new MsgFlood(); + mf = new MsgFlood(ServerInstance); Srv->AddMode(mf, 'f'); } diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index dd35f88a8..fc7ede256 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -30,7 +30,7 @@ extern InspIRCd* ServerInstance; class NoCTCP : public ModeHandler { public: - NoCTCP() : ModeHandler('C', 0, 0, false, MODETYPE_CHANNEL, false) { } + NoCTCP(InspIRCd* Instance) : ModeHandler(Instance, 'C', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -66,7 +66,7 @@ class ModuleNoCTCP : public Module : Module::Module(Me) { Srv = Me; - nc = new NoCTCP(); + nc = new NoCTCP(ServerInstance); Srv->AddMode(nc, 'C'); } diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp index 1d14f1c9b..1481f5f03 100644 --- a/src/modules/m_noinvite.cpp +++ b/src/modules/m_noinvite.cpp @@ -30,7 +30,7 @@ extern InspIRCd* ServerInstance; class NoInvite : public ModeHandler { public: - NoInvite() : ModeHandler('V', 0, 0, false, MODETYPE_CHANNEL, false) { } + NoInvite(InspIRCd* Instance) : ModeHandler(Instance, 'V', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -65,7 +65,7 @@ class ModuleNoInvite : public Module ModuleNoInvite(Server* Me) : Module::Module(Me) { Srv = Me; - ni = new NoInvite(); + ni = new NoInvite(ServerInstance); Srv->AddMode(ni, 'V'); } diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index c1151472d..be06cd79c 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -30,7 +30,7 @@ extern InspIRCd* ServerInstance; class NoKicks : public ModeHandler { public: - NoKicks() : ModeHandler('Q', 0, 0, false, MODETYPE_CHANNEL, false) { } + NoKicks(InspIRCd* Instance) : ModeHandler(Instance, 'Q', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -66,7 +66,7 @@ class ModuleNoKicks : public Module : Module::Module(Me) { Srv = Me; - nk = new NoKicks(); + nk = new NoKicks(ServerInstance); Srv->AddMode(nk, 'Q'); } diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 7b134b71e..1e8b7ccf9 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -33,7 +33,7 @@ extern InspIRCd* ServerInstance; class NoNicks : public ModeHandler { public: - NoNicks() : ModeHandler('N', 0, 0, false, MODETYPE_CHANNEL, false) { } + NoNicks(InspIRCd* Instance) : ModeHandler(Instance, 'N', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -68,7 +68,7 @@ class ModuleNoNickChange : public Module : Module::Module(Me) { Srv = Me; - nn = new NoNicks(); + nn = new NoNicks(ServerInstance); Srv->AddMode(nn, 'N'); } diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 7a2229ccd..34c59db88 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -30,7 +30,7 @@ extern InspIRCd* ServerInstance; class NoNotice : public ModeHandler { public: - NoNotice() : ModeHandler('T', 0, 0, false, MODETYPE_CHANNEL, false) { } + NoNotice(InspIRCd* Instance) : ModeHandler(Instance, 'T', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -65,7 +65,7 @@ class ModuleNoNotice : public Module : Module::Module(Me) { Srv = Me; - nt = new NoNotice(); + nt = new NoNotice(ServerInstance); Srv->AddMode(nt, 'T'); } diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 1aace393c..f78bb5e36 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -31,7 +31,7 @@ class OperChans : public ModeHandler { public: /* This is an oper-only mode */ - OperChans() : ModeHandler('O', 0, 0, false, MODETYPE_CHANNEL, true) { } + OperChans(InspIRCd* Instance) : ModeHandler(Instance, 'O', 0, 0, false, MODETYPE_CHANNEL, true) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -64,9 +64,8 @@ class ModuleOperChans : public Module ModuleOperChans(Server* Me) : Module::Module(Me) { - Srv = Me; - // Add a mode +O for channels with no parameters - oc = new OperChans(); + Srv = Me; + oc = new OperChans(ServerInstance); Srv->AddMode(oc, 'O'); } diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 8a917e4ba..8e7cefb93 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -31,7 +31,7 @@ class Redirect : public ModeHandler { Server* Srv; public: - Redirect(Server* s) : ModeHandler('L', 1, 0, false, MODETYPE_CHANNEL, false), Srv(s) { } + Redirect(InspIRCd* Instance, Server* s) : ModeHandler(Instance, 'L', 1, 0, false, MODETYPE_CHANNEL, false), Srv(s) { } ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) { @@ -115,7 +115,7 @@ class ModuleRedirect : public Module : Module::Module(Me) { Srv = Me; - re = new Redirect(Me); + re = new Redirect(ServerInstance, Me); Srv->AddMode(re, 'L'); } diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp index 33748450d..0fc9f1e9d 100644 --- a/src/modules/m_services.cpp +++ b/src/modules/m_services.cpp @@ -35,7 +35,7 @@ class Channel_r : public ModeHandler { Server* Srv; public: - Channel_r(Server* srv) : ModeHandler('r', 0, 0, false, MODETYPE_CHANNEL, false), Srv(srv) { } + Channel_r(InspIRCd* Instance, Server* srv) : ModeHandler(Instance, 'r', 0, 0, false, MODETYPE_CHANNEL, false), Srv(srv) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -59,7 +59,7 @@ class User_r : public ModeHandler { Server* Srv; public: - User_r(Server* srv) : ModeHandler('r', 0, 0, false, MODETYPE_USER, false), Srv(srv) { } + User_r(InspIRCd* Instance, Server* srv) : ModeHandler(Instance, 'r', 0, 0, false, MODETYPE_USER, false), Srv(srv) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -81,7 +81,7 @@ class User_r : public ModeHandler class Channel_R : public ModeHandler { public: - Channel_R() : ModeHandler('R', 0, 0, false, MODETYPE_CHANNEL, false) { } + Channel_R(InspIRCd* Instance) : ModeHandler(Instance, 'R', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -109,7 +109,7 @@ class Channel_R : public ModeHandler class User_R : public ModeHandler { public: - User_R() : ModeHandler('R', 0, 0, false, MODETYPE_USER, false) { } + User_R(InspIRCd* Instance) : ModeHandler(Instance, 'R', 0, 0, false, MODETYPE_USER, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -137,7 +137,7 @@ class User_R : public ModeHandler class Channel_M : public ModeHandler { public: - Channel_M() : ModeHandler('M', 0, 0, false, MODETYPE_CHANNEL, false) { } + Channel_M(InspIRCd* Instance) : ModeHandler(Instance, 'M', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -175,11 +175,11 @@ class ModuleServices : public Module : Module::Module(Me) { Srv = Me; - m1 = new Channel_r(Me); - m2 = new Channel_R(); - m3 = new Channel_M(); - m4 = new User_r(Me); - m5 = new User_R(); + m1 = new Channel_r(ServerInstance, Me); + m2 = new Channel_R(ServerInstance); + m3 = new Channel_M(ServerInstance); + m4 = new User_r(ServerInstance, Me); + m5 = new User_R(ServerInstance); Srv->AddMode(m1, 'r'); Srv->AddMode(m2, 'R'); Srv->AddMode(m3, 'M'); diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index d712a0ec7..19e010b69 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -32,7 +32,7 @@ extern InspIRCd* ServerInstance; class AChannel_R : public ModeHandler { public: - AChannel_R() : ModeHandler('R', 0, 0, false, MODETYPE_CHANNEL, false) { } + AChannel_R(InspIRCd* Instance) : ModeHandler(Instance, 'R', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -60,7 +60,7 @@ class AChannel_R : public ModeHandler class AUser_R : public ModeHandler { public: - AUser_R() : ModeHandler('R', 0, 0, false, MODETYPE_USER, false) { } + AUser_R(InspIRCd* Instance) : ModeHandler(Instance, 'R', 0, 0, false, MODETYPE_USER, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -88,7 +88,7 @@ class AUser_R : public ModeHandler class AChannel_M : public ModeHandler { public: - AChannel_M() : ModeHandler('M', 0, 0, false, MODETYPE_CHANNEL, false) { } + AChannel_M(InspIRCd* Instance) : ModeHandler(Instance, 'M', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -123,9 +123,9 @@ class ModuleServicesAccount : public Module ModuleServicesAccount(Server* Me) : Module::Module(Me) { Srv = Me; - m1 = new AChannel_R(); - m2 = new AChannel_M(); - m3 = new AUser_R(); + m1 = new AChannel_R(ServerInstance); + m2 = new AChannel_M(ServerInstance); + m3 = new AUser_R(ServerInstance); Srv->AddMode(m1, 'R'); Srv->AddMode(m2, 'M'); Srv->AddMode(m3, 'R'); diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index 1343e665f..33f59e756 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -11,10 +11,12 @@ using namespace std; /* $ModDesc: Allows opers to set +W to see when a user uses WHOIS on them */ +extern InspIRCd* ServerInstance; + class SeeWhois : public ModeHandler { public: - SeeWhois() : ModeHandler('W', 0, 0, false, MODETYPE_CHANNEL, false) { } + SeeWhois(InspIRCd* Instance) : ModeHandler(Instance, 'W', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -53,7 +55,7 @@ class ModuleShowwhois : public Module ModuleShowwhois(Server* Me) : Module::Module(Me) { Srv = Me; - sw = new SeeWhois(); + sw = new SeeWhois(ServerInstance); Srv->AddMode(sw, 'W'); } diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index c844e4e01..bc4679fd7 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -12,9 +12,8 @@ extern InspIRCd* ServerInstance; class SSLMode : public ModeHandler { - Server* Srv; public: - SSLMode(Server* s) : ModeHandler('z', 0, 0, false, MODETYPE_CHANNEL, false), Srv(s) { } + SSLMode(InspIRCd* Instance) : ModeHandler(Instance, 'z', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -66,7 +65,7 @@ class ModuleSSLModes : public Module { Srv = Me; - sslm = new SSLMode(Me); + sslm = new SSLMode(ServerInstance); Srv->AddMode(sslm, 'z'); } diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index 05ffd201c..d6b04dd58 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -31,7 +31,7 @@ extern InspIRCd* ServerInstance; class ChannelStripColor : public ModeHandler { public: - ChannelStripColor() : ModeHandler('S', 0, 0, false, MODETYPE_CHANNEL, false) { } + ChannelStripColor(InspIRCd* Instance) : ModeHandler(Instance, 'S', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -63,7 +63,7 @@ class ChannelStripColor : public ModeHandler class UserStripColor : public ModeHandler { public: - UserStripColor() : ModeHandler('S', 0, 0, false, MODETYPE_USER, false) { } + UserStripColor(InspIRCd* Instance) : ModeHandler(Instance, 'S', 0, 0, false, MODETYPE_USER, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -106,8 +106,8 @@ class ModuleStripColor : public Module { Srv = Me; - usc = new UserStripColor(); - csc = new ChannelStripColor(); + usc = new UserStripColor(ServerInstance); + csc = new ChannelStripColor(ServerInstance); Srv->AddMode(usc, 'S'); Srv->AddMode(csc, 'S'); diff --git a/src/socket.cpp b/src/socket.cpp index e0d02a48a..4de038ef1 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -227,7 +227,7 @@ inline void irc::sockets::NonBlocking(int s) * It can only bind to IP addresses, if you wish to bind to hostnames * you should first resolve them using class 'Resolver'. */ -bool irc::sockets::BindSocket(int sockfd, insp_sockaddr client, insp_sockaddr server, int port, char* addr) +bool InspIRCd::BindSocket(int sockfd, insp_sockaddr client, insp_sockaddr server, int port, char* addr) { memset(&server,0,sizeof(server)); insp_inaddr addy; @@ -274,7 +274,7 @@ bool irc::sockets::BindSocket(int sockfd, insp_sockaddr client, insp_sockaddr se else { log(DEBUG,"Bound port %s:%d",*addr ? addr : "*",port); - if (listen(sockfd, ServerInstance->Config->MaxConn) == -1) + if (listen(sockfd, Config->MaxConn) == -1) { log(DEFAULT,"ERROR in listen(): %s",strerror(errno)); return false; @@ -312,10 +312,9 @@ int irc::sockets::OpenTCPSocket() } /* XXX: Probably belongs in class InspIRCd */ -bool HasPort(int port, char* addr) +bool InspIRCd::HasPort(int port, char* addr) { - ServerConfig* Config = ServerInstance->Config; - for (unsigned long count = 0; count < ServerInstance->stats->BoundPortCount; count++) + for (unsigned long count = 0; count < stats->BoundPortCount; count++) { if ((port == Config->ports[count]) && (!strcasecmp(Config->addrs[count],addr))) { @@ -326,17 +325,16 @@ bool HasPort(int port, char* addr) } /* XXX: Probably belongs in class InspIRCd */ -int irc::sockets::BindPorts(bool bail) +int InspIRCd::BindPorts(bool bail) { char configToken[MAXBUF], Addr[MAXBUF], Type[MAXBUF]; insp_sockaddr client, server; int clientportcount = 0; int BoundPortCount = 0; - ServerConfig* Config = ServerInstance->Config; if (!bail) { - int InitialPortCount = ServerInstance->stats->BoundPortCount; + int InitialPortCount = stats->BoundPortCount; log(DEBUG,"Initial port count: %d",InitialPortCount); for (int count = 0; count < Config->ConfValueEnum(Config->config_data, "bind"); count++) @@ -377,7 +375,7 @@ int irc::sockets::BindPorts(bool bail) /* Associate the new open port with a slot in the socket engine */ if (Config->openSockfd[count] > -1) { - if (!ServerInstance->SE->AddFd(Config->openSockfd[count],true,X_LISTEN)) + if (!SE->AddFd(Config->openSockfd[count],true,X_LISTEN)) { log(DEFAULT,"ERK! Failed to add listening port to socket engine!"); shutdown(Config->openSockfd[count],2); diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 9789a2ddf..4d0f38b7c 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -301,7 +301,7 @@ void InspIRCd::DoSocketTimeouts(time_t TIME) */ void InspIRCd::DoBackgroundUserStuff(time_t TIME) { - CullList GlobalGoners; + CullList GlobalGoners(this); /* XXX: IT IS NOT SAFE TO USE AN ITERATOR HERE. DON'T EVEN THINK ABOUT IT. */ for (unsigned long count2 = 0; count2 != this->local_users.size(); count2++) diff --git a/src/xline.cpp b/src/xline.cpp index 6584a70e6..64a5c93a6 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -657,7 +657,7 @@ void apply_lines(const int What) (!pglines.size()) && (!pklines.size()) && (!pzlines.size()) && (!pqlines.size())) return; - CullList* Goners = new CullList(); + CullList* Goners = new CullList(ServerInstance); char* check = NULL; for (std::vector<userrec*>::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++) { |