From 4c83624ed825ca123401a45c8d2844ba6453a85b Mon Sep 17 00:00:00 2001 From: special Date: Sun, 2 Sep 2007 05:33:10 +0000 Subject: Fixed an issue that could cause empty parameters in module commands to not be sent to other servers properly git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8012 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/main.cpp | 8 ++++++-- src/modules/m_spanningtree/treesocket2.cpp | 3 +-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 6d71fc872..4e92f07a6 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -822,6 +822,10 @@ void ModuleSpanningTree::OnPostCommand(const std::string &command, const char** int n_translate = thiscmd->translation.size(); TranslateType translate_to; + /* To make sure that parameters with spaces, or empty + * parameters, etc, are always sent properly, *always* + * prefix the last parameter with a :. This also removes + * an extra strchr() */ for (int j = 0; j < pcnt; j++) { std::string target; @@ -837,8 +841,8 @@ void ModuleSpanningTree::OnPostCommand(const std::string &command, const char** ServerInstance->Log(DEBUG,"TRANSLATION: %s - type is %d", parameters[j], translate_to); ServerInstance->Parser->TranslateUIDs(translate_to, parameters[j], target); - - if (strchr(parameters[j],' ')) + + if (j == (pcnt - 1)) params.push_back(":" + target); else params.push_back(target); diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index ff5e7b203..1d6b0dfa8 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -1040,8 +1040,7 @@ void TreeSocket::Split(const std::string &line, std::deque &n) std::string param; while (tokens.GetToken(param)) { - if (!param.empty()) - n.push_back(param); + n.push_back(param); } return; } -- cgit v1.2.3