diff options
| author | 2013-08-19 19:11:02 +0200 | |
|---|---|---|
| committer | 2013-08-25 13:42:01 +0200 | |
| commit | d9d9cbe025f94523265daa72de7596467d71f5c8 (patch) | |
| tree | 3bd29833312c61949ddbbcb6cfa815c4de5781ce /src/modules/m_spanningtree/uid.cpp | |
| parent | Clean up the protocol interface (diff) | |
| download | inspircd++-d9d9cbe025f94523265daa72de7596467d71f5c8.tar.gz inspircd++-d9d9cbe025f94523265daa72de7596467d71f5c8.tar.bz2 inspircd++-d9d9cbe025f94523265daa72de7596467d71f5c8.zip | |
m_spanningtree Allow server-to-server command handlers to specify whether they accept servers, remote users or both as the command source
To make life easier for handlers accepting servers only as source, pass them a TreeServer* so they don't have to call FindServer()
Diffstat (limited to 'src/modules/m_spanningtree/uid.cpp')
| -rw-r--r-- | src/modules/m_spanningtree/uid.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index da75eebec..55a6e3939 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -25,7 +25,7 @@ #include "utils.h" #include "treeserver.h" -CmdResult CommandUID::Handle(User* serversrc, std::vector<std::string>& params) +CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vector<std::string>& params) { /** Do we have enough parameters: * 0 1 2 3 4 5 6 7 8 9 (n-1) @@ -36,12 +36,8 @@ CmdResult CommandUID::Handle(User* serversrc, std::vector<std::string>& params) std::string empty; const std::string& modestr = params[8]; - TreeServer* remoteserver = Utils->FindServer(serversrc->server); - - if (!remoteserver) - return CMD_INVALID; /* Is this a valid UID, and not misrouted? */ - if (params[0].length() != 9 || params[0].substr(0,3) != serversrc->uuid) + if (params[0].length() != UIDGenerator::UUID_LENGTH || params[0].substr(0, 3) != remoteserver->GetID()) return CMD_INVALID; /* Check parameters for validity before introducing the client, discovered by dmb */ if (!age_t) @@ -147,26 +143,20 @@ CmdResult CommandUID::Handle(User* serversrc, std::vector<std::string>& params) return CMD_SUCCESS; } -CmdResult CommandFHost::Handle(User* src, std::vector<std::string>& params) +CmdResult CommandFHost::HandleRemote(RemoteUser* src, std::vector<std::string>& params) { - if (IS_SERVER(src)) - return CMD_FAILURE; src->ChangeDisplayedHost(params[0]); return CMD_SUCCESS; } -CmdResult CommandFIdent::Handle(User* src, std::vector<std::string>& params) +CmdResult CommandFIdent::HandleRemote(RemoteUser* src, std::vector<std::string>& params) { - if (IS_SERVER(src)) - return CMD_FAILURE; src->ChangeIdent(params[0]); return CMD_SUCCESS; } -CmdResult CommandFName::Handle(User* src, std::vector<std::string>& params) +CmdResult CommandFName::HandleRemote(RemoteUser* src, std::vector<std::string>& params) { - if (IS_SERVER(src)) - return CMD_FAILURE; src->ChangeName(params[0]); return CMD_SUCCESS; } |
