summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-03-17 11:05:09 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-03-17 11:05:09 +0100
commitd60103cada2c954f6d735c0ae4fb7d9b1b5ed844 (patch)
tree43e0dfde15c012ad9e6e86ab615a6054968639c9 /src/modules
parent869fd6ca2822ef45ad7c3939b9ab7418200daf3e (diff)
Rewrite clone counting to use one map instead of two
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_cgiirc.cpp3
-rw-r--r--src/modules/m_check.cpp5
-rw-r--r--src/modules/m_clones.cpp9
-rw-r--r--src/modules/m_spanningtree/uid.cpp2
4 files changed, 10 insertions, 9 deletions
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index e95b838a2..0f60995a3 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -192,8 +192,7 @@ class ModuleCgiIRC : public Module
{
ServerInstance->Users->RemoveCloneCounts(user);
user->SetClientIP(newip.c_str());
- ServerInstance->Users->AddLocalClone(user);
- ServerInstance->Users->AddGlobalClone(user);
+ ServerInstance->Users->AddClone(user);
}
void HandleIdentOrPass(LocalUser* user, const std::string& newip, bool was_pass)
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index d7cfe74bd..ad0e2394d 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -230,8 +230,9 @@ class CommandCheck : public Command
/*
* Unlike Asuka, I define a clone as coming from the same host. --w00t
*/
- user->SendText("%s member %-3lu %s%s (%s@%s) %s ",
- checkstr.c_str(), ServerInstance->Users->GlobalCloneCount(i->first),
+ const UserManager::CloneCounts& clonecount = ServerInstance->Users->GetCloneCounts(i->first);
+ user->SendText("%s member %-3u %s%s (%s@%s) %s ",
+ checkstr.c_str(), clonecount.global,
i->second->GetAllPrefixChars(), i->first->nick.c_str(),
i->first->ident.c_str(), i->first->dhost.c_str(), i->first->fullname.c_str());
}
diff --git a/src/modules/m_clones.cpp b/src/modules/m_clones.cpp
index 1f505e9a2..c51c8d3b4 100644
--- a/src/modules/m_clones.cpp
+++ b/src/modules/m_clones.cpp
@@ -48,11 +48,12 @@ class CommandClones : public Command
user->WriteServ(clonesstr + " START");
/* hostname or other */
- // XXX I really don't like marking global_clones public for this. at all. -- w00t
- for (clonemap::iterator x = ServerInstance->Users->global_clones.begin(); x != ServerInstance->Users->global_clones.end(); x++)
+ const UserManager::CloneMap& clonemap = ServerInstance->Users->GetCloneMap();
+ for (UserManager::CloneMap::const_iterator i = clonemap.begin(); i != clonemap.end(); ++i)
{
- if (x->second >= limit)
- user->WriteServ(clonesstr + " "+ ConvToStr(x->second) + " " + x->first.str());
+ const UserManager::CloneCounts& counts = i->second;
+ if (counts.global >= limit)
+ user->WriteServ(clonesstr + " " + ConvToStr(counts.global) + " " + i->first.str());
}
user->WriteServ(clonesstr + " END");
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp
index f248b3860..79bd6936f 100644
--- a/src/modules/m_spanningtree/uid.cpp
+++ b/src/modules/m_spanningtree/uid.cpp
@@ -126,7 +126,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vector<std::st
_new->SetClientIP(params[6].c_str());
- ServerInstance->Users->AddGlobalClone(_new);
+ ServerInstance->Users->AddClone(_new);
remoteserver->UserCount++;
bool dosend = true;