Remove some useless getter methods and make the members public.

This isn't part of a public API so we don't need to care about
exposing implementation details.
This commit is contained in:
Sadie Powell 2021-04-14 23:11:53 +01:00
parent eee4ef7d33
commit ff7c1adf1b
6 changed files with 13 additions and 27 deletions

View File

@ -707,7 +707,7 @@ void ModuleSpanningTree::OnUnloadModule(Module* mod)
for (const auto& [_, server] : Utils->serverlist)
{
if (!server->IsRoot())
GetLinkEventProvider().Call(&ServerProtocol::LinkEventListener::OnServerSplit, server, false);
linkeventprov.Call(&ServerProtocol::LinkEventListener::OnServerSplit, server, false);
}
return;
}

View File

@ -90,6 +90,7 @@ class ModuleSpanningTree
*/
Membership::Id currmembid = 0;
public:
/** The specialized ProtocolInterface that is assigned to ServerInstance->PI on load
*/
SpanningTreeProtocolInterface protocolinterface;
@ -115,12 +116,13 @@ class ModuleSpanningTree
/** Tag for marking services pseudoclients. */
ServiceTag servicetag;
public:
/** The DNS manager service provided by core_dns. */
dynamic_reference<DNS::Manager> DNS;
/** Event provider for message tags. */
ClientProtocol::MessageTagEvent tagevprov;
/** Manager for server commands. */
ServerCommandManager CmdManager;
/** Set to true if inside a spanningtree call, to prevent sending
@ -173,22 +175,6 @@ class ModuleSpanningTree
*/
ModResult HandleConnect(const CommandBase::Params& parameters, User* user);
/** Retrieves the event provider for broadcast events. */
const Events::ModuleEventProvider& GetBroadcastEventProvider() const { return broadcasteventprov; }
/** Retrieves the event provider for link events. */
const Events::ModuleEventProvider& GetLinkEventProvider() const { return linkeventprov; }
/** Retrieves the event provider for message events. */
const Events::ModuleEventProvider& GetMessageEventProvider() const { return messageeventprov; }
/** Retrieves the event provider for sync events. */
const Events::ModuleEventProvider& GetSyncEventProvider() const { return synceventprov; }
/**
** *** MODULE EVENTS ***
**/
ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) override;
void OnPostCommand(Command*, const CommandBase::Params& parameters, LocalUser* user, CmdResult result, bool loop) override;
void OnUserConnect(LocalUser* source) override;

View File

@ -29,7 +29,7 @@ void CmdBuilder::FireEvent(Server* target, const char* cmd, ClientProtocol::TagM
if (!Utils->Creator || Utils->Creator->dying)
return;
Utils->Creator->GetMessageEventProvider().Call(&ServerProtocol::MessageEventListener::OnBuildServerMessage, target, cmd, taglist);
Utils->Creator->messageeventprov.Call(&ServerProtocol::MessageEventListener::OnBuildServerMessage, target, cmd, taglist);
UpdateTags();
}
@ -38,7 +38,7 @@ void CmdBuilder::FireEvent(User* target, const char* cmd, ClientProtocol::TagMap
if (!Utils->Creator || Utils->Creator->dying)
return;
Utils->Creator->GetMessageEventProvider().Call(&ServerProtocol::MessageEventListener::OnBuildUserMessage, target, cmd, taglist);
Utils->Creator->messageeventprov.Call(&ServerProtocol::MessageEventListener::OnBuildUserMessage, target, cmd, taglist);
UpdateTags();
}

View File

@ -117,7 +117,7 @@ void TreeSocket::DoBurst(TreeServer* s)
// Send all xlines
this->SendXLines();
Utils->Creator->GetSyncEventProvider().Call(&ServerProtocol::SyncEventListener::OnSyncNetwork, bs.server);
Utils->Creator->synceventprov.Call(&ServerProtocol::SyncEventListener::OnSyncNetwork, bs.server);
this->WriteLine(CmdBuilder("ENDBURST"));
ServerInstance->SNO.WriteToSnoMask('l',"Finished bursting to \002"+ s->GetName()+"\002.");
}
@ -258,7 +258,7 @@ void TreeSocket::SyncChannel(Channel* chan, BurstState& bs)
}
}
Utils->Creator->GetSyncEventProvider().Call(&ServerProtocol::SyncEventListener::OnSyncChannel, chan, bs.server);
Utils->Creator->synceventprov.Call(&ServerProtocol::SyncEventListener::OnSyncChannel, chan, bs.server);
}
void TreeSocket::SyncChannel(Channel* chan)
@ -290,6 +290,6 @@ void TreeSocket::SendUsers(BurstState& bs)
this->WriteLine(CommandMetadata::Builder(user, item->name, value));
}
Utils->Creator->GetSyncEventProvider().Call(&ServerProtocol::SyncEventListener::OnSyncUser, user, bs.server);
Utils->Creator->synceventprov.Call(&ServerProtocol::SyncEventListener::OnSyncUser, user, bs.server);
}
}

View File

@ -126,7 +126,7 @@ TreeServer::TreeServer(const std::string& Name, const std::string& Desc, const s
this->AddHashEntry();
Parent->Children.push_back(this);
Utils->Creator->GetLinkEventProvider().Call(&ServerProtocol::LinkEventListener::OnServerLink, this);
Utils->Creator->linkeventprov.Call(&ServerProtocol::LinkEventListener::OnServerLink, this);
}
void TreeServer::BeginBurst(uint64_t startms)
@ -160,7 +160,7 @@ void TreeServer::FinishBurst()
unsigned long bursttime = ts - this->StartBurst;
ServerInstance->SNO.WriteToSnoMask(Parent == Utils->TreeRoot ? 'l' : 'L', "Received end of netburst from \002%s\002 (burst time: %lu %s)",
GetName().c_str(), (bursttime > 10000 ? bursttime / 1000 : bursttime), (bursttime > 10000 ? "secs" : "msecs"));
Utils->Creator->GetLinkEventProvider().Call(&ServerProtocol::LinkEventListener::OnServerBurst, this);
Utils->Creator->linkeventprov.Call(&ServerProtocol::LinkEventListener::OnServerBurst, this);
StartBurst = 0;
FinishBurstInternal();
@ -211,7 +211,7 @@ void TreeServer::SQuitInternal(unsigned int& num_lost_servers, bool error)
RemoveHash();
if (!Utils->Creator->dying)
Utils->Creator->GetLinkEventProvider().Call(&ServerProtocol::LinkEventListener::OnServerSplit, this, error);
Utils->Creator->linkeventprov.Call(&ServerProtocol::LinkEventListener::OnServerSplit, this, error);
}
unsigned int TreeServer::QuitUsers(const std::string& reason)

View File

@ -168,7 +168,7 @@ void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeSocketSet
// is used to keep the chanhistory module synchronised between servers.
for (const auto& child : children)
{
ModResult result = Creator->GetBroadcastEventProvider().FirstResult(&ServerProtocol::BroadcastEventListener::OnBroadcastMessage, c, child);
ModResult result = Creator->broadcasteventprov.FirstResult(&ServerProtocol::BroadcastEventListener::OnBroadcastMessage, c, child);
if (result == MOD_RES_ALLOW)
list.insert(child->GetSocket());
}