]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/treeserver.cpp
Add ConfigTag::getDuration() with optional bounds checking
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / treeserver.cpp
index 393485cceb3cd4248e8d41e8f7442e4146c3c135..991f98784cf2a5b3d7d30a6752c2a29fe438e076 100644 (file)
@@ -35,7 +35,7 @@
  * no socket associated with it. Its version string is our own local version.
  */
 TreeServer::TreeServer(SpanningTreeUtilities* Util)
-       : Parent(NULL), Route(NULL), ServerName(ServerInstance->Config->ServerName.c_str()), ServerDesc(ServerInstance->Config->ServerDesc)
+       : Parent(NULL), Route(NULL), ServerName(ServerInstance->Config->ServerName), ServerDesc(ServerInstance->Config->ServerDesc)
        , VersionString(ServerInstance->GetVersionString()), Socket(NULL), Utils(Util), sid(ServerInstance->Config->GetSID()), ServerUser(ServerInstance->FakeClient)
        , age(ServerInstance->Time()), Warned(false), bursting(false), UserCount(0), OperCount(0), rtt(0), StartBurst(0), Hidden(false)
 {
@@ -47,7 +47,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util)
  * its ping counters so that it will be pinged one minute from now.
  */
 TreeServer::TreeServer(SpanningTreeUtilities* Util, const std::string& Name, const 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), sid(id), ServerUser(new FakeUser(id, Name))
+       : Parent(Above), ServerName(Name), ServerDesc(Desc), Socket(Sock), Utils(Util), sid(id), ServerUser(new FakeUser(id, Name))
        , age(ServerInstance->Time()), Warned(false), bursting(true), UserCount(0), OperCount(0), rtt(0), Hidden(Hide)
 {
        SetNextPingTime(ServerInstance->Time() + Utils->PingFreq);
@@ -55,7 +55,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, const std::string& Name, con
 
        long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000);
        this->StartBurst = ts;
-       ServerInstance->Logs->Log("m_spanningtree", LOG_DEBUG, "Server %s started bursting at time %lu", sid.c_str(), ts);
+       ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Server %s started bursting at time %lu", sid.c_str(), ts);
 
        /* find the 'route' for this server (e.g. the one directly connected
         * to the local server, which we can use to reach it)
@@ -136,7 +136,7 @@ void TreeServer::FinishBurst()
        unsigned long bursttime = ts - this->StartBurst;
        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"));
-       AddServerEvent(Utils->Creator, ServerName.c_str());
+       AddServerEvent(Utils->Creator, ServerName);
 }
 
 int TreeServer::QuitUsers(const std::string &reason)
@@ -173,7 +173,7 @@ int TreeServer::QuitUsers(const std::string &reason)
  */
 void TreeServer::AddHashEntry()
 {
-       Utils->serverlist[ServerName.c_str()] = this;
+       Utils->serverlist[ServerName] = this;
        Utils->sidlist[sid] = this;
 }
 
@@ -185,11 +185,6 @@ TreeServer* TreeServer::GetRoute()
        return Route;
 }
 
-std::string TreeServer::GetName()
-{
-       return ServerName.c_str();
-}
-
 const std::string& TreeServer::GetDesc()
 {
        return ServerDesc;
@@ -307,5 +302,5 @@ TreeServer::~TreeServer()
                delete ServerUser;
 
        Utils->sidlist.erase(sid);
-       Utils->serverlist.erase(ServerName.c_str());
+       Utils->serverlist.erase(ServerName);
 }