summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree/main.cpp2
-rw-r--r--src/modules/m_spanningtree/postcommand.cpp10
-rw-r--r--src/modules/m_spanningtree/server.cpp2
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp4
-rw-r--r--src/modules/m_spanningtree/utils.cpp15
-rw-r--r--src/modules/m_spanningtree/utils.h7
6 files changed, 13 insertions, 27 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 6e4277c08..316ed6e96 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -641,7 +641,7 @@ void ModuleSpanningTree::OnPreRehash(User* user, const std::string &parameter)
{
parameterlist params;
params.push_back(parameter);
- Utils->DoOneToAllButSender(user ? user->uuid : ServerInstance->Config->GetSID(), "REHASH", params, user ? user->server : ServerInstance->Config->ServerName);
+ Utils->DoOneToAllButSender(user ? user->uuid : ServerInstance->Config->GetSID(), "REHASH", params, user ? Utils->BestRouteTo(user->server) : NULL);
}
}
diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp
index 3fb3d5b07..ac416031d 100644
--- a/src/modules/m_spanningtree/postcommand.cpp
+++ b/src/modules/m_spanningtree/postcommand.cpp
@@ -108,10 +108,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm
}
else if (dest[0] == '$')
{
- if (origin)
- DoOneToAllButSender(user->uuid, sent_cmd, params, origin->GetName());
- else
- DoOneToMany(user->uuid, sent_cmd, params);
+ DoOneToAllButSender(user->uuid, sent_cmd, params, origin);
}
else
{
@@ -128,10 +125,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm
}
else if (routing.type == ROUTE_TYPE_BROADCAST || routing.type == ROUTE_TYPE_OPT_BCAST)
{
- if (origin)
- DoOneToAllButSender(user->uuid, sent_cmd, params, origin->GetName());
- else
- DoOneToMany(user->uuid, sent_cmd, params);
+ DoOneToAllButSender(user->uuid, sent_cmd, params, origin);
}
else if (routing.type == ROUTE_TYPE_UNICAST || routing.type == ROUTE_TYPE_OPT_UCAST)
{
diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp
index 538d28dbd..36bd8620a 100644
--- a/src/modules/m_spanningtree/server.cpp
+++ b/src/modules/m_spanningtree/server.cpp
@@ -150,7 +150,7 @@ bool TreeSocket::Outbound_Reply_Server(parameterlist &params)
/* IMPORTANT: Take password/hmac hash OUT of here before we broadcast the introduction! */
params[1] = "*";
- Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(),"SERVER",params,sname);
+ Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(),"SERVER",params,MyRoot);
return true;
}
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 986e71cfe..5181dfeea 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -184,8 +184,8 @@ void TreeSocket::ProcessLine(std::string &line)
sparams.push_back("0");
sparams.push_back(MyRoot->GetID());
sparams.push_back(":" + MyRoot->GetDesc());
- Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(), "SERVER", sparams, MyRoot->GetName());
- Utils->DoOneToAllButSender(MyRoot->GetID(), "BURST", params, MyRoot->GetName());
+ Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(), "SERVER", sparams, MyRoot);
+ Utils->DoOneToAllButSender(MyRoot->GetID(), "BURST", params, MyRoot);
}
else if (command == "ERROR")
{
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index ef1070a12..e7edc65d6 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -205,9 +205,8 @@ std::string SpanningTreeUtilities::ConstructLine(const std::string& prefix, cons
return FullLine;
}
-void SpanningTreeUtilities::DoOneToAllButSender(const std::string& prefix, const std::string& command, const parameterlist& params, const std::string& omit)
+void SpanningTreeUtilities::DoOneToAllButSender(const std::string& prefix, const std::string& command, const parameterlist& params, TreeServer* omitroute)
{
- TreeServer* omitroute = this->BestRouteTo(omit);
std::string FullLine = ConstructLine(prefix, command, params);
unsigned int items = this->TreeRoot->ChildCount();
@@ -222,18 +221,6 @@ void SpanningTreeUtilities::DoOneToAllButSender(const std::string& prefix, const
}
}
-void SpanningTreeUtilities::DoOneToMany(const std::string &prefix, const std::string &command, const parameterlist &params)
-{
- std::string FullLine = ConstructLine(prefix, command, params);
-
- unsigned int items = this->TreeRoot->ChildCount();
- for (unsigned int x = 0; x < items; x++)
- {
- TreeServer* Route = this->TreeRoot->GetChild(x);
- Route->GetSocket()->WriteLine(FullLine);
- }
-}
-
bool SpanningTreeUtilities::DoOneToOne(const std::string& prefix, const std::string& command, const parameterlist& params, const std::string& target)
{
TreeServer* Route = this->BestRouteTo(target);
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 58821bd2b..491c4126f 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -134,7 +134,7 @@ class SpanningTreeUtilities : public classbase
/** Send a message from this server to all but one other, local or remote
*/
- void DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist& params, const std::string& omit);
+ void DoOneToAllButSender(const std::string& prefix, const std::string& command, const parameterlist& params, TreeServer* omit);
/** Send a message from this server to all others
*/
@@ -180,3 +180,8 @@ class SpanningTreeUtilities : public classbase
*/
void SendChannelMessage(const std::string& prefix, Channel* target, const std::string &text, char status, const CUList& exempt_list, const char* message_type);
};
+
+inline void SpanningTreeUtilities::DoOneToMany(const std::string& prefix, const std::string& command, const parameterlist& params)
+{
+ DoOneToAllButSender(prefix, command, params, NULL);
+}