From d00914ed6f5de67ab69c69e1cd1efa0797b5f62d Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sat, 1 Dec 2012 21:33:42 +0100 Subject: Add a flag to Command that controls whether an empty last parameter is allowed or not --- src/modules/m_spanningtree/treesocket2.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index e93dece5f..9c3fe9c36 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -458,6 +458,14 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, return; } + if ((!params.empty()) && (params.back().empty()) && (!cmd->allow_empty_last_param)) + { + // the last param is empty and the command handler doesn't allow that, check if there will be enough params if we drop the last + if (params.size()-1 < cmd->min_params) + return; + params.pop_back(); + } + CmdResult res = cmd->Handle(params, who); if (res == CMD_INVALID) -- cgit v1.2.3