diff options
author | Robin Burchell <robin+git@viroteck.net> | 2012-04-18 15:02:54 +0200 |
---|---|---|
committer | Robin Burchell <robin+git@viroteck.net> | 2012-04-18 15:02:54 +0200 |
commit | 1a3f2a192124f316ee21df357e11280151a25cec (patch) | |
tree | 2b38391933aa4a6da856a73b0a6cf5dbb0ff82ea /src/modules/m_spanningtree | |
parent | d383ce9b72bf5c58bb0571998b282cf67cf7635c (diff) |
Be more helpful when processing commands from a linked server.
When diagnosing errors with s2s traffic, it costs us next to nothing to try a
little harder to generate useful errors so errors are immediately apparent.
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 0628c900a..bb9d389ac 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -415,18 +415,31 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, else { Command* cmd = ServerInstance->Parser->GetHandler(command); - CmdResult res = CMD_INVALID; - if (cmd && params.size() >= cmd->min_params) + + if (!cmd) { - res = cmd->Handle(params, who); + irc::stringjoiner pmlist(" ", params, 0, params.size() - 1); + ServerInstance->Logs->Log("spanningtree", SPARSE, "Unrecognised S2S command :%s %s %s", + who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str()); + SendError("Unrecognised command '" + command + "' -- possibly loaded mismatched modules"); + } + + if (params.size() < cmd->min_params) + { + irc::stringjoiner pmlist(" ", params, 0, params.size() - 1); + ServerInstance->Logs->Log("spanningtree", SPARSE, "Insufficient parameters for S2S command :%s %s %s", + who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str()); + SendError("Insufficient parameters for command '" + command + "'"); } + CmdResult res = cmd->Handle(params, who); + if (res == CMD_INVALID) { irc::stringjoiner pmlist(" ", params, 0, params.size() - 1); - ServerInstance->Logs->Log("spanningtree", SPARSE, "Invalid S2S command :%s %s %s", + ServerInstance->Logs->Log("spanningtree", SPARSE, "Error handing S2S command :%s %s %s", who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str()); - SendError("Unrecognised or malformed command '" + command + "' -- possibly loaded mismatched modules"); + SendError("Error handling '" + command + "' -- possibly loaded mismatched modules"); } if (res == CMD_SUCCESS) Utils->RouteCommand(route_back_again, command, params, who); |