summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree/main.cpp6
-rw-r--r--src/modules/m_spanningtree/override_map.cpp4
-rw-r--r--src/modules/m_spanningtree/protocolinterface.cpp4
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp24
-rw-r--r--src/modules/m_spanningtree/treeserver.h21
-rw-r--r--src/modules/m_spanningtree/uid.cpp2
6 files changed, 13 insertions, 48 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index f1c6ce521..77ef6a0fd 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -87,7 +87,7 @@ void ModuleSpanningTree::init()
loopCall = false;
// update our local user count
- Utils->TreeRoot->SetUserCount(ServerInstance->Users->local_users.size());
+ Utils->TreeRoot->UserCount = ServerInstance->Users->local_users.size();
}
void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops)
@@ -548,7 +548,7 @@ void ModuleSpanningTree::OnUserConnect(LocalUser* user)
ServerInstance->PI->SendMetaData(user, item->name, value);
}
- Utils->TreeRoot->SetUserCount(1); // increment by 1
+ Utils->TreeRoot->UserCount++;
}
void ModuleSpanningTree::OnUserJoin(Membership* memb, bool sync, bool created, CUList& excepts)
@@ -631,7 +631,7 @@ void ModuleSpanningTree::OnUserQuit(User* user, const std::string &reason, const
TreeServer* SourceServer = Utils->FindServer(user->server);
if (SourceServer)
{
- SourceServer->SetUserCount(-1); // decrement by 1
+ SourceServer->UserCount--;
}
}
diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp
index 5c69aef16..5c4572e26 100644
--- a/src/modules/m_spanningtree/override_map.cpp
+++ b/src/modules/m_spanningtree/override_map.cpp
@@ -48,7 +48,7 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, int
}
else
{
- percent = Current->GetUserCount() * 100.0 / ServerInstance->Users->clientlist->size();
+ percent = Current->UserCount * 100.0 / ServerInstance->Users->clientlist->size();
}
const std::string operdata = user->IsOper() ? MapOperInfo(Current) : "";
@@ -70,7 +70,7 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, int
memset(myname + w, ' ', 100 - w);
if (w > maxnamew)
maxnamew = w;
- snprintf(mystat, 49, "%5d [%5.2f%%]%s", Current->GetUserCount(), percent, operdata.c_str());
+ snprintf(mystat, 49, "%5d [%5.2f%%]%s", Current->UserCount, percent, operdata.c_str());
line++;
diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp
index aacf5ce8d..a329aca20 100644
--- a/src/modules/m_spanningtree/protocolinterface.cpp
+++ b/src/modules/m_spanningtree/protocolinterface.cpp
@@ -38,8 +38,8 @@ void SpanningTreeProtocolInterface::GetServerList(ProtoServerList &sl)
ps.servername = i->second->GetName();
TreeServer* s = i->second->GetParent();
ps.parentname = s ? s->GetName() : "";
- ps.usercount = i->second->GetUserCount();
- ps.opercount = i->second->GetOperCount();
+ ps.usercount = i->second->UserCount;
+ ps.opercount = i->second->OperCount;
ps.gecos = i->second->GetDesc();
ps.latencyms = i->second->rtt;
sl.push_back(ps);
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index 42cd37fb9..e2ed6a748 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -42,7 +42,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, std::string Name, std::strin
bursting = false;
Parent = NULL;
VersionString.clear();
- ServerUserCount = ServerOperCount = 0;
+ UserCount = OperCount = 0;
VersionString = ServerInstance->GetVersionString();
Route = NULL;
Socket = NULL; /* Fix by brain */
@@ -62,7 +62,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, std::string Name, std::strin
age = ServerInstance->Time();
bursting = true;
VersionString.clear();
- ServerUserCount = ServerOperCount = 0;
+ UserCount = OperCount = 0;
SetNextPingTime(ServerInstance->Time() + Utils->PingFreq);
SetPingFlag();
Warned = false;
@@ -257,26 +257,6 @@ void TreeServer::SetPingFlag()
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;
diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h
index f5d81bc73..460231502 100644
--- a/src/modules/m_spanningtree/treeserver.h
+++ b/src/modules/m_spanningtree/treeserver.h
@@ -45,8 +45,6 @@ class TreeServer : public classbase
irc::string ServerName; /* Server's name */
std::string ServerDesc; /* Server's description */
std::string VersionString; /* Version string or empty string */
- unsigned int ServerUserCount; /* How many users are on this server? [note: doesn't care about +i] */
- unsigned int ServerOperCount; /* How many opers are on this server? */
TreeSocket* Socket; /* For directly connected servers this points at the socket object */
time_t NextPing; /* After this time, the server should be PINGed*/
bool LastPingWasGood; /* True if the server responded to the last PING with a PONG */
@@ -66,6 +64,9 @@ class TreeServer : public classbase
bool Warned; /* True if we've warned opers about high latency on this server */
bool bursting; /* whether or not this server is bursting */
+ unsigned int UserCount; /* How many users are on this server? [note: doesn't care about +i] */
+ unsigned int OperCount; /* How many opers are on this server? */
+
/** We use this constructor only to create the 'root' item, Utils->TreeRoot, which
* 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.
@@ -142,22 +143,6 @@ class TreeServer : public classbase
*/
void SetPingFlag();
- /** Get the number of users on this server.
- */
- unsigned int GetUserCount();
-
- /** Increment or decrement the user count by diff.
- */
- void SetUserCount(int diff);
-
- /** Gets the numbers of opers on this server.
- */
- unsigned int GetOperCount();
-
- /** Increment or decrement the oper count by diff.
- */
- void SetOperCount(int diff);
-
/** Get the TreeSocket pointer for local servers.
* For remote servers, this returns NULL.
*/
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp
index 8e4c631f2..83c8c5bb3 100644
--- a/src/modules/m_spanningtree/uid.cpp
+++ b/src/modules/m_spanningtree/uid.cpp
@@ -139,7 +139,7 @@ CmdResult CommandUID::Handle(const parameterlist &params, User* serversrc)
_new->SetClientIP(params[6].c_str());
ServerInstance->Users->AddGlobalClone(_new);
- remoteserver->SetUserCount(1); // increment by 1
+ remoteserver->UserCount++;
bool dosend = true;