summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-07-04 23:02:28 +0200
committerattilamolnar <attilamolnar@hush.com>2013-04-12 21:03:04 +0200
commita04e586eb51b90d71cb76a2605ca9e194fb21b30 (patch)
treebcfc04512ee11214be58432458d7d22005db536d /src
parent7f56a39e972c9dd27826e33f0ec824dda73afd61 (diff)
m_spanningtree Change TreeServerList to be a set, get rid of a function dedicated to adding entries to it
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree/main.cpp4
-rw-r--r--src/modules/m_spanningtree/postcommand.cpp2
-rw-r--r--src/modules/m_spanningtree/protocolinterface.cpp2
-rw-r--r--src/modules/m_spanningtree/utils.cpp8
-rw-r--r--src/modules/m_spanningtree/utils.h6
5 files changed, 6 insertions, 16 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 9aee4a4ce..ac1d12423 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -498,7 +498,7 @@ void ModuleSpanningTree::OnUserNotice(User* user, void* dest, int target_type, c
Utils->GetListOfServersForChannel(c,list,status,exempt_list);
for (TreeServerList::iterator i = list.begin(); i != list.end(); i++)
{
- TreeSocket* Sock = i->second->GetSocket();
+ TreeSocket* Sock = (*i)->GetSocket();
if (Sock)
Sock->WriteLine(":"+std::string(user->uuid)+" NOTICE "+cname+" :"+text);
}
@@ -551,7 +551,7 @@ void ModuleSpanningTree::OnUserMessage(User* user, void* dest, int target_type,
Utils->GetListOfServersForChannel(c,list,status,exempt_list);
for (TreeServerList::iterator i = list.begin(); i != list.end(); i++)
{
- TreeSocket* Sock = i->second->GetSocket();
+ TreeSocket* Sock = (*i)->GetSocket();
if (Sock)
Sock->WriteLine(":"+std::string(user->uuid)+" PRIVMSG "+cname+" :"+text);
}
diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp
index b91435eee..36f326114 100644
--- a/src/modules/m_spanningtree/postcommand.cpp
+++ b/src/modules/m_spanningtree/postcommand.cpp
@@ -121,7 +121,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, const std::string &
data += " " + params[x];
for (TreeServerList::iterator i = list.begin(); i != list.end(); i++)
{
- TreeSocket* Sock = i->second->GetSocket();
+ TreeSocket* Sock = (*i)->GetSocket();
if (origin && origin->GetSocket() == Sock)
continue;
if (Sock)
diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp
index 3ab5dae9d..0440823e6 100644
--- a/src/modules/m_spanningtree/protocolinterface.cpp
+++ b/src/modules/m_spanningtree/protocolinterface.cpp
@@ -145,7 +145,7 @@ void SpanningTreeProtocolInterface::SendChannel(Channel* target, char status, co
Utils->GetListOfServersForChannel(target,list,status,exempt_list);
for (TreeServerList::iterator i = list.begin(); i != list.end(); i++)
{
- TreeSocket* Sock = i->second->GetSocket();
+ TreeSocket* Sock = (*i)->GetSocket();
if (Sock)
Sock->WriteLine(text);
}
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index aa8f74d86..7941970da 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -165,12 +165,6 @@ SpanningTreeUtilities::~SpanningTreeUtilities()
delete TreeRoot;
}
-void SpanningTreeUtilities::AddThisServer(TreeServer* server, TreeServerList &list)
-{
- if (list.find(server) == list.end())
- list[server] = server;
-}
-
/* returns a list of DIRECT servernames for a specific channel */
void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeServerList &list, char status, const CUList &exempt_list)
{
@@ -196,7 +190,7 @@ void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeServerLis
{
TreeServer* best = this->BestRouteTo(i->first->server);
if (best)
- AddThisServer(best,list);
+ list.insert(best);
}
}
return;
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index f3e16230a..fc1d49733 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -37,7 +37,7 @@ class SpanningTreeUtilities;
*/
typedef std::tr1::unordered_map<std::string, TreeServer*, std::tr1::insensitive, irc::StrHashComp> server_hash;
-typedef std::map<TreeServer*,TreeServer*> TreeServerList;
+typedef std::set<TreeServer*> TreeServerList;
/** Contains helper functions and variables for this module,
* and keeps them out of the global namespace
@@ -142,10 +142,6 @@ class SpanningTreeUtilities : public classbase
*/
void ReadConfiguration();
- /** Add a server to the server list for GetListOfServersForChannel
- */
- void AddThisServer(TreeServer* server, TreeServerList &list);
-
/** Compile a list of servers which contain members of channel c
*/
void GetListOfServersForChannel(Channel* c, TreeServerList &list, char status, const CUList &exempt_list);