-/* +------------------------------------+
- * | Inspire Internet Relay Chat Daemon |
- * +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
*
- * InspIRCd: (C) 2002-2010 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ * Copyright (C) 2007-2008 Craig Edwards <craigedwards@brainbox.cc>
+ * Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
+ * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
*
- * This program is free but copyrighted software; see
- * the file COPYING for details.
+ * This file is part of InspIRCd. InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
*
- * ---------------------------------------------------
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "inspircd.h"
-#include "socket.h"
#include "xline.h"
#include "main.h"
-#include "../spanningtree.h"
+#include "modules/spanningtree.h"
#include "utils.h"
#include "treeserver.h"
bursting = false;
Parent = NULL;
VersionString.clear();
- ServerUserCount = ServerOperCount = 0;
+ UserCount = OperCount = 0;
VersionString = ServerInstance->GetVersionString();
Route = NULL;
Socket = NULL; /* Fix by brain */
age = ServerInstance->Time();
bursting = true;
VersionString.clear();
- ServerUserCount = ServerOperCount = 0;
+ UserCount = OperCount = 0;
SetNextPingTime(ServerInstance->Time() + Utils->PingFreq);
SetPingFlag();
Warned = false;
long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000);
this->StartBurst = ts;
- ServerInstance->Logs->Log("m_spanningtree",DEBUG, "Started bursting at time %lu", ts);
+ ServerInstance->Logs->Log("m_spanningtree", LOG_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)
SetID(id);
}
-std::string& TreeServer::GetID()
+const std::string& TreeServer::GetID()
{
return sid;
}
void TreeServer::SetID(const std::string &id)
{
- ServerInstance->Logs->Log("m_spanningtree",DEBUG, "Setting SID to " + id);
+ ServerInstance->Logs->Log("m_spanningtree", LOG_DEBUG, "Setting SID to " + id);
sid = id;
Utils->sidlist[sid] = this;
}
return ServerName.c_str();
}
-std::string TreeServer::GetDesc()
+const std::string& TreeServer::GetDesc()
{
return ServerDesc;
}
-std::string TreeServer::GetVersion()
+const std::string& TreeServer::GetVersion()
{
return VersionString;
}
LastPingWasGood = true;
}
-unsigned int TreeServer::GetUserCount()
-{
- return ServerUserCount;
-}
-
-void TreeServer::SetUserCount(int diff)
-{
- ServerUserCount += diff;
-}
-
-void TreeServer::SetOperCount(int diff)
-{
- ServerOperCount += diff;
-}
-
-unsigned int TreeServer::GetOperCount()
-{
- return ServerOperCount;
-}
-
TreeSocket* TreeServer::GetSocket()
{
return Socket;
bool TreeServer::DelChild(TreeServer* Child)
{
- for (std::vector<TreeServer*>::iterator a = Children.begin(); a != Children.end(); a++)
+ std::vector<TreeServer*>::iterator it = std::find(Children.begin(), Children.end(), Child);
+ if (it != Children.end())
{
- if (*a == Child)
- {
- Children.erase(a);
- return true;
- }
+ Children.erase(it);
+ return true;
}
return false;
}