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 /src/modules/m_spanningtree | |
parent | 810c662c9b55908101ca085293c52c3239ef22d1 (diff) |
Remove InspIRCd* parameters and fields
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11763 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
22 files changed, 64 insertions, 71 deletions
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 */ |