diff options
author | Peter Powell <petpow@saberuk.com> | 2018-07-26 19:43:54 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2018-07-26 20:12:14 +0100 |
commit | 384ef31bc01e4a1a2e59d082c9066002410ba54a (patch) | |
tree | 06bd81f9e0e48183c1ada07cf7a8757a5028cad1 /src/modules/m_spanningtree | |
parent | 09c5439c02f31e9875083e51966dad535af005a9 (diff) |
Use CommandBase::Params instead of std::vector<std::string>.
This is presently a typedef but will soon be replaced with a class
that encapsulates both tags and parameters.
Diffstat (limited to 'src/modules/m_spanningtree')
43 files changed, 138 insertions, 138 deletions
diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp index 1bf847604..cd11b8d58 100644 --- a/src/modules/m_spanningtree/addline.cpp +++ b/src/modules/m_spanningtree/addline.cpp @@ -24,7 +24,7 @@ #include "utils.h" #include "commands.h" -CmdResult CommandAddLine::Handle(User* usr, std::vector<std::string>& params) +CmdResult CommandAddLine::Handle(User* usr, Params& params) { XLineFactory* xlf = ServerInstance->XLines->GetFactory(params[0]); const std::string& setter = usr->nick; diff --git a/src/modules/m_spanningtree/away.cpp b/src/modules/m_spanningtree/away.cpp index 28cbf8f73..e65b3099b 100644 --- a/src/modules/m_spanningtree/away.cpp +++ b/src/modules/m_spanningtree/away.cpp @@ -23,7 +23,7 @@ #include "utils.h" #include "commands.h" -CmdResult CommandAway::HandleRemote(::RemoteUser* u, std::vector<std::string>& params) +CmdResult CommandAway::HandleRemote(::RemoteUser* u, Params& params) { if (!params.empty()) { diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp index 7f9f9edb7..79019b668 100644 --- a/src/modules/m_spanningtree/capab.cpp +++ b/src/modules/m_spanningtree/capab.cpp @@ -221,7 +221,7 @@ void TreeSocket::ListDifference(const std::string &one, const std::string &two, } } -bool TreeSocket::Capab(const parameterlist ¶ms) +bool TreeSocket::Capab(const CommandBase::Params& params) { if (params.size() < 1) { diff --git a/src/modules/m_spanningtree/commands.h b/src/modules/m_spanningtree/commands.h index 05fafd1a7..b98512578 100644 --- a/src/modules/m_spanningtree/commands.h +++ b/src/modules/m_spanningtree/commands.h @@ -44,55 +44,55 @@ class CommandRConnect : public Command { public: CommandRConnect(Module* Creator); - CmdResult Handle(const std::vector<std::string>& parameters, User* user) CXX11_OVERRIDE; - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE; + CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE; + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE; }; class CommandRSQuit : public Command { public: CommandRSQuit(Module* Creator); - CmdResult Handle(const std::vector<std::string>& parameters, User* user) CXX11_OVERRIDE; - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE; + CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE; + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE; }; class CommandMap : public Command { public: CommandMap(Module* Creator); - CmdResult Handle(const std::vector<std::string>& parameters, User* user) CXX11_OVERRIDE; - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE; + CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE; + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE; }; class CommandSVSJoin : public ServerCommand { public: CommandSVSJoin(Module* Creator) : ServerCommand(Creator, "SVSJOIN", 2) { } - CmdResult Handle(User* user, std::vector<std::string>& params) CXX11_OVERRIDE; - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE; + CmdResult Handle(User* user, Params& params) CXX11_OVERRIDE; + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE; }; class CommandSVSPart : public ServerCommand { public: CommandSVSPart(Module* Creator) : ServerCommand(Creator, "SVSPART", 2) { } - CmdResult Handle(User* user, std::vector<std::string>& params) CXX11_OVERRIDE; - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE; + CmdResult Handle(User* user, Params& params) CXX11_OVERRIDE; + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE; }; class CommandSVSNick : public ServerCommand { public: CommandSVSNick(Module* Creator) : ServerCommand(Creator, "SVSNICK", 3) { } - CmdResult Handle(User* user, std::vector<std::string>& params) CXX11_OVERRIDE; - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE; + CmdResult Handle(User* user, Params& params) CXX11_OVERRIDE; + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE; }; class CommandMetadata : public ServerCommand { public: CommandMetadata(Module* Creator) : ServerCommand(Creator, "METADATA", 2) { } - CmdResult Handle(User* user, std::vector<std::string>& params) CXX11_OVERRIDE; + CmdResult Handle(User* user, Params& params) CXX11_OVERRIDE; class Builder : public CmdBuilder { @@ -107,7 +107,7 @@ class CommandUID : public ServerOnlyServerCommand<CommandUID> { public: CommandUID(Module* Creator) : ServerOnlyServerCommand<CommandUID>(Creator, "UID", 10) { } - CmdResult HandleServer(TreeServer* server, std::vector<std::string>& params); + CmdResult HandleServer(TreeServer* server, CommandBase::Params& params); class Builder : public CmdBuilder { @@ -120,7 +120,7 @@ class CommandOpertype : public UserOnlyServerCommand<CommandOpertype> { public: CommandOpertype(Module* Creator) : UserOnlyServerCommand<CommandOpertype>(Creator, "OPERTYPE", 1) { } - CmdResult HandleRemote(RemoteUser* user, std::vector<std::string>& params); + CmdResult HandleRemote(RemoteUser* user, Params& params); class Builder : public CmdBuilder { @@ -149,8 +149,8 @@ class CommandFJoin : public ServerCommand void ProcessModeUUIDPair(const std::string& item, TreeServer* sourceserver, Channel* chan, Modes::ChangeList* modechangelist, FwdFJoinBuilder& fwdfjoin); public: CommandFJoin(Module* Creator) : ServerCommand(Creator, "FJOIN", 3) { } - CmdResult Handle(User* user, std::vector<std::string>& params) CXX11_OVERRIDE; - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE { return ROUTE_LOCALONLY; } + CmdResult Handle(User* user, Params& params) CXX11_OVERRIDE; + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE { return ROUTE_LOCALONLY; } class Builder : public CmdBuilder { @@ -186,14 +186,14 @@ class CommandFMode : public ServerCommand { public: CommandFMode(Module* Creator) : ServerCommand(Creator, "FMODE", 3) { } - CmdResult Handle(User* user, std::vector<std::string>& params) CXX11_OVERRIDE; + CmdResult Handle(User* user, Params& params) CXX11_OVERRIDE; }; class CommandFTopic : public ServerCommand { public: CommandFTopic(Module* Creator) : ServerCommand(Creator, "FTOPIC", 4, 5) { } - CmdResult Handle(User* user, std::vector<std::string>& params) CXX11_OVERRIDE; + CmdResult Handle(User* user, Params& params) CXX11_OVERRIDE; class Builder : public CmdBuilder { @@ -207,43 +207,43 @@ class CommandFHost : public UserOnlyServerCommand<CommandFHost> { public: CommandFHost(Module* Creator) : UserOnlyServerCommand<CommandFHost>(Creator, "FHOST", 1) { } - CmdResult HandleRemote(RemoteUser* user, std::vector<std::string>& params); + CmdResult HandleRemote(RemoteUser* user, Params& params); }; class CommandFIdent : public UserOnlyServerCommand<CommandFIdent> { public: CommandFIdent(Module* Creator) : UserOnlyServerCommand<CommandFIdent>(Creator, "FIDENT", 1) { } - CmdResult HandleRemote(RemoteUser* user, std::vector<std::string>& params); + CmdResult HandleRemote(RemoteUser* user, Params& params); }; class CommandFName : public UserOnlyServerCommand<CommandFName> { public: CommandFName(Module* Creator) : UserOnlyServerCommand<CommandFName>(Creator, "FNAME", 1) { } - CmdResult HandleRemote(RemoteUser* user, std::vector<std::string>& params); + CmdResult HandleRemote(RemoteUser* user, Params& params); }; class CommandIJoin : public UserOnlyServerCommand<CommandIJoin> { public: CommandIJoin(Module* Creator) : UserOnlyServerCommand<CommandIJoin>(Creator, "IJOIN", 2) { } - CmdResult HandleRemote(RemoteUser* user, std::vector<std::string>& params); + CmdResult HandleRemote(RemoteUser* user, Params& params); }; class CommandResync : public ServerOnlyServerCommand<CommandResync> { public: CommandResync(Module* Creator) : ServerOnlyServerCommand<CommandResync>(Creator, "RESYNC", 1) { } - CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters); - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE { return ROUTE_LOCALONLY; } + CmdResult HandleServer(TreeServer* server, Params& parameters); + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE { return ROUTE_LOCALONLY; } }; class SpanningTree::CommandAway : public UserOnlyServerCommand<SpanningTree::CommandAway> { public: CommandAway(Module* Creator) : UserOnlyServerCommand<SpanningTree::CommandAway>(Creator, "AWAY", 0, 2) { } - CmdResult HandleRemote(::RemoteUser* user, std::vector<std::string>& parameters); + CmdResult HandleRemote(::RemoteUser* user, Params& parameters); class Builder : public CmdBuilder { @@ -258,7 +258,7 @@ class CommandAddLine : public ServerCommand { public: CommandAddLine(Module* Creator) : ServerCommand(Creator, "ADDLINE", 6, 6) { } - CmdResult Handle(User* user, std::vector<std::string>& parameters) CXX11_OVERRIDE; + CmdResult Handle(User* user, Params& parameters) CXX11_OVERRIDE; class Builder : public CmdBuilder { @@ -271,46 +271,46 @@ class CommandDelLine : public ServerCommand { public: CommandDelLine(Module* Creator) : ServerCommand(Creator, "DELLINE", 2, 2) { } - CmdResult Handle(User* user, std::vector<std::string>& parameters) CXX11_OVERRIDE; + CmdResult Handle(User* user, Params& parameters) CXX11_OVERRIDE; }; class CommandEncap : public ServerCommand { public: CommandEncap(Module* Creator) : ServerCommand(Creator, "ENCAP", 2) { } - CmdResult Handle(User* user, std::vector<std::string>& parameters) CXX11_OVERRIDE; - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE; + CmdResult Handle(User* user, Params& parameters) CXX11_OVERRIDE; + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE; }; class CommandIdle : public UserOnlyServerCommand<CommandIdle> { public: CommandIdle(Module* Creator) : UserOnlyServerCommand<CommandIdle>(Creator, "IDLE", 1) { } - CmdResult HandleRemote(RemoteUser* user, std::vector<std::string>& parameters); - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE { return ROUTE_UNICAST(parameters[0]); } + CmdResult HandleRemote(RemoteUser* user, Params& parameters); + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE { return ROUTE_UNICAST(parameters[0]); } }; class SpanningTree::CommandNick : public UserOnlyServerCommand<SpanningTree::CommandNick> { public: CommandNick(Module* Creator) : UserOnlyServerCommand<SpanningTree::CommandNick>(Creator, "NICK", 2) { } - CmdResult HandleRemote(::RemoteUser* user, std::vector<std::string>& parameters); + CmdResult HandleRemote(::RemoteUser* user, Params& parameters); }; class SpanningTree::CommandPing : public ServerCommand { public: CommandPing(Module* Creator) : ServerCommand(Creator, "PING", 1) { } - CmdResult Handle(User* user, std::vector<std::string>& parameters) CXX11_OVERRIDE; - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE { return ROUTE_UNICAST(parameters[0]); } + CmdResult Handle(User* user, Params& parameters) CXX11_OVERRIDE; + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE { return ROUTE_UNICAST(parameters[0]); } }; class SpanningTree::CommandPong : public ServerOnlyServerCommand<SpanningTree::CommandPong> { public: CommandPong(Module* Creator) : ServerOnlyServerCommand<SpanningTree::CommandPong>(Creator, "PONG", 1) { } - CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters); - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE { return ROUTE_UNICAST(parameters[0]); } + CmdResult HandleServer(TreeServer* server, Params& parameters); + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE { return ROUTE_UNICAST(parameters[0]); } }; class CommandSave : public ServerCommand @@ -321,16 +321,16 @@ class CommandSave : public ServerCommand static const time_t SavedTimestamp = 100; CommandSave(Module* Creator) : ServerCommand(Creator, "SAVE", 2) { } - CmdResult Handle(User* user, std::vector<std::string>& parameters) CXX11_OVERRIDE; + CmdResult Handle(User* user, Params& parameters) CXX11_OVERRIDE; }; class SpanningTree::CommandServer : public ServerOnlyServerCommand<SpanningTree::CommandServer> { - static void HandleExtra(TreeServer* newserver, const std::vector<std::string>& params); + static void HandleExtra(TreeServer* newserver, Params& params); public: CommandServer(Module* Creator) : ServerOnlyServerCommand<SpanningTree::CommandServer>(Creator, "SERVER", 3) { } - CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters); + CmdResult HandleServer(TreeServer* server, Params& parameters); class Builder : public CmdBuilder { @@ -347,28 +347,28 @@ class CommandSQuit : public ServerOnlyServerCommand<CommandSQuit> { public: CommandSQuit(Module* Creator) : ServerOnlyServerCommand<CommandSQuit>(Creator, "SQUIT", 2) { } - CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters); + CmdResult HandleServer(TreeServer* server, Params& parameters); }; class CommandSNONotice : public ServerCommand { public: CommandSNONotice(Module* Creator) : ServerCommand(Creator, "SNONOTICE", 2) { } - CmdResult Handle(User* user, std::vector<std::string>& parameters) CXX11_OVERRIDE; + CmdResult Handle(User* user, Params& parameters) CXX11_OVERRIDE; }; class CommandEndBurst : public ServerOnlyServerCommand<CommandEndBurst> { public: CommandEndBurst(Module* Creator) : ServerOnlyServerCommand<CommandEndBurst>(Creator, "ENDBURST") { } - CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters); + CmdResult HandleServer(TreeServer* server, Params& parameters); }; class CommandSInfo : public ServerOnlyServerCommand<CommandSInfo> { public: CommandSInfo(Module* Creator) : ServerOnlyServerCommand<CommandSInfo>(Creator, "SINFO", 2) { } - CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters); + CmdResult HandleServer(TreeServer* server, Params& parameters); class Builder : public CmdBuilder { @@ -381,8 +381,8 @@ class CommandNum : public ServerOnlyServerCommand<CommandNum> { public: CommandNum(Module* Creator) : ServerOnlyServerCommand<CommandNum>(Creator, "NUM", 3) { } - CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters); - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE; + CmdResult HandleServer(TreeServer* server, Params& parameters); + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE; class Builder : public CmdBuilder { diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index 98b4be88d..dc00d6ff3 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -320,7 +320,7 @@ void TreeSocket::WriteLine(const std::string& original_line) namespace { - bool InsertCurrentChannelTS(std::vector<std::string>& params, unsigned int chanindex = 0, unsigned int pos = 1) + bool InsertCurrentChannelTS(CommandBase::Params& params, unsigned int chanindex = 0, unsigned int pos = 1) { Channel* chan = ServerInstance->FindChan(params[chanindex]); if (!chan) @@ -332,7 +332,7 @@ namespace } } -bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, std::vector<std::string>& params) +bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, CommandBase::Params& params) { if ((cmd == "METADATA") && (params.size() >= 3) && (params[0][0] == '#')) { @@ -381,7 +381,7 @@ bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, std: if ((params.size() != 1) && (params.size() != 3)) return false; - parameterlist p; + CommandBase::Params p; p.push_back(cmd.substr(0, 1)); p.push_back(params[0]); diff --git a/src/modules/m_spanningtree/delline.cpp b/src/modules/m_spanningtree/delline.cpp index f790dc885..c64bec654 100644 --- a/src/modules/m_spanningtree/delline.cpp +++ b/src/modules/m_spanningtree/delline.cpp @@ -22,7 +22,7 @@ #include "commands.h" -CmdResult CommandDelLine::Handle(User* user, std::vector<std::string>& params) +CmdResult CommandDelLine::Handle(User* user, Params& params) { const std::string& setter = user->nick; diff --git a/src/modules/m_spanningtree/encap.cpp b/src/modules/m_spanningtree/encap.cpp index 8059d2a39..4bc321065 100644 --- a/src/modules/m_spanningtree/encap.cpp +++ b/src/modules/m_spanningtree/encap.cpp @@ -23,11 +23,11 @@ #include "main.h" /** ENCAP */ -CmdResult CommandEncap::Handle(User* user, std::vector<std::string>& params) +CmdResult CommandEncap::Handle(User* user, Params& params) { if (ServerInstance->Config->GetSID() == params[0] || InspIRCd::Match(ServerInstance->Config->ServerName, params[0])) { - parameterlist plist(params.begin() + 2, params.end()); + CommandBase::Params plist(params.begin() + 2, params.end()); // XXX: Workaround for SVS* commands provided by spanningtree not being registered in the core if ((params[1] == "SVSNICK") || (params[1] == "SVSJOIN") || (params[1] == "SVSPART")) @@ -48,7 +48,7 @@ CmdResult CommandEncap::Handle(User* user, std::vector<std::string>& params) return CMD_SUCCESS; } -RouteDescriptor CommandEncap::GetRouting(User* user, const std::vector<std::string>& params) +RouteDescriptor CommandEncap::GetRouting(User* user, const Params& params) { if (params[0].find_first_of("*?") != std::string::npos) return ROUTE_BROADCAST; diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index c292373b3..cfbaeb917 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -42,7 +42,7 @@ class FwdFJoinBuilder : public CommandFJoin::Builder }; /** FJOIN, almost identical to TS6 SJOIN, except for nicklist handling. */ -CmdResult CommandFJoin::Handle(User* srcuser, std::vector<std::string>& params) +CmdResult CommandFJoin::Handle(User* srcuser, Params& params) { /* 1.1+ FJOIN works as follows: * diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp index e6f49c5b9..a15b5ddc2 100644 --- a/src/modules/m_spanningtree/fmode.cpp +++ b/src/modules/m_spanningtree/fmode.cpp @@ -22,7 +22,7 @@ #include "commands.h" /** FMODE command - channel mode change with timestamp checks */ -CmdResult CommandFMode::Handle(User* who, std::vector<std::string>& params) +CmdResult CommandFMode::Handle(User* who, Params& params) { time_t TS = ServerCommand::ExtractTS(params[1]); diff --git a/src/modules/m_spanningtree/ftopic.cpp b/src/modules/m_spanningtree/ftopic.cpp index de72d162a..01826e8f6 100644 --- a/src/modules/m_spanningtree/ftopic.cpp +++ b/src/modules/m_spanningtree/ftopic.cpp @@ -22,7 +22,7 @@ #include "commands.h" /** FTOPIC command */ -CmdResult CommandFTopic::Handle(User* user, std::vector<std::string>& params) +CmdResult CommandFTopic::Handle(User* user, Params& params) { Channel* c = ServerInstance->FindChan(params[0]); if (!c) diff --git a/src/modules/m_spanningtree/idle.cpp b/src/modules/m_spanningtree/idle.cpp index ad58e52f0..11e665531 100644 --- a/src/modules/m_spanningtree/idle.cpp +++ b/src/modules/m_spanningtree/idle.cpp @@ -21,7 +21,7 @@ #include "utils.h" #include "commands.h" -CmdResult CommandIdle::HandleRemote(RemoteUser* issuer, std::vector<std::string>& params) +CmdResult CommandIdle::HandleRemote(RemoteUser* issuer, Params& params) { /** * There are two forms of IDLE: request and reply. Requests have one parameter, diff --git a/src/modules/m_spanningtree/ijoin.cpp b/src/modules/m_spanningtree/ijoin.cpp index c2dbcf7f5..d33ef3d4e 100644 --- a/src/modules/m_spanningtree/ijoin.cpp +++ b/src/modules/m_spanningtree/ijoin.cpp @@ -23,7 +23,7 @@ #include "treeserver.h" #include "treesocket.h" -CmdResult CommandIJoin::HandleRemote(RemoteUser* user, std::vector<std::string>& params) +CmdResult CommandIJoin::HandleRemote(RemoteUser* user, Params& params) { Channel* chan = ServerInstance->FindChan(params[0]); if (!chan) @@ -55,7 +55,7 @@ CmdResult CommandIJoin::HandleRemote(RemoteUser* user, std::vector<std::string>& return CMD_SUCCESS; } -CmdResult CommandResync::HandleServer(TreeServer* server, std::vector<std::string>& params) +CmdResult CommandResync::HandleServer(TreeServer* server, CommandBase::Params& params) { ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Resyncing " + params[0]); Channel* chan = ServerInstance->FindChan(params[0]); diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 21251983c..0d153737f 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -136,7 +136,7 @@ void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops) InspIRCd::Format("%d %s", (((Utils->FlatLinks) && (!user->IsOper())) ? 0 : hops), Current->GetDesc().c_str())); } -void ModuleSpanningTree::HandleLinks(const std::vector<std::string>& parameters, User* user) +void ModuleSpanningTree::HandleLinks(const CommandBase::Params& parameters, User* user) { ShowLinks(Utils->TreeRoot,user,0); user->WriteNumeric(RPL_ENDOFLINKS, '*', "End of /LINKS list."); @@ -305,7 +305,7 @@ void ModuleSpanningTree::DoConnectTimeout(time_t curtime) } } -ModResult ModuleSpanningTree::HandleVersion(const std::vector<std::string>& parameters, User* user) +ModResult ModuleSpanningTree::HandleVersion(const CommandBase::Params& parameters, User* user) { // We've already confirmed that !parameters.empty(), so this is safe TreeServer* found = Utils->FindServerMask(parameters[0]); @@ -332,7 +332,7 @@ ModResult ModuleSpanningTree::HandleVersion(const std::vector<std::string>& para return MOD_RES_DENY; } -ModResult ModuleSpanningTree::HandleConnect(const std::vector<std::string>& parameters, User* user) +ModResult ModuleSpanningTree::HandleConnect(const CommandBase::Params& parameters, User* user) { for (std::vector<reference<Link> >::iterator i = Utils->LinkBlocks.begin(); i < Utils->LinkBlocks.end(); i++) { diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 5add15e8a..20c1ac2b9 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -98,15 +98,15 @@ class ModuleSpanningTree : public Module, public Stats::EventListener /** Handle LINKS command */ - void HandleLinks(const std::vector<std::string>& parameters, User* user); + void HandleLinks(const CommandBase::Params& parameters, User* user); /** Handle SQUIT */ - ModResult HandleSquit(const std::vector<std::string>& parameters, User* user); + ModResult HandleSquit(const CommandBase::Params& parameters, User* user); /** Handle remote WHOIS */ - ModResult HandleRemoteWhois(const std::vector<std::string>& parameters, User* user); + ModResult HandleRemoteWhois(const CommandBase::Params& parameters, User* user); /** Connect a server locally */ @@ -126,11 +126,11 @@ class ModuleSpanningTree : public Module, public Stats::EventListener /** Handle remote VERSON */ - ModResult HandleVersion(const std::vector<std::string>& parameters, User* user); + ModResult HandleVersion(const CommandBase::Params& parameters, User* user); /** Handle CONNECT */ - ModResult HandleConnect(const std::vector<std::string>& parameters, User* user); + ModResult HandleConnect(const CommandBase::Params& parameters, User* user); /** Display a time as a human readable string */ @@ -142,8 +142,8 @@ class ModuleSpanningTree : public Module, public Stats::EventListener ** *** MODULE EVENTS *** **/ - ModResult OnPreCommand(std::string &command, std::vector<std::string>& parameters, LocalUser *user, bool validated, const std::string &original_line) CXX11_OVERRIDE; - void OnPostCommand(Command*, const std::vector<std::string>& parameters, LocalUser* user, CmdResult result, const std::string& original_line) CXX11_OVERRIDE; + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE; + void OnPostCommand(Command*, const CommandBase::Params& parameters, LocalUser* user, CmdResult result, const std::string& original_line) CXX11_OVERRIDE; void OnUserConnect(LocalUser* source) CXX11_OVERRIDE; void OnUserInvite(User* source, User* dest, Channel* channel, time_t timeout, unsigned int notifyrank, CUList& notifyexcepts) CXX11_OVERRIDE; ModResult OnPreTopicChange(User* user, Channel* chan, const std::string& topic) CXX11_OVERRIDE; diff --git a/src/modules/m_spanningtree/metadata.cpp b/src/modules/m_spanningtree/metadata.cpp index 47c2f8bc5..52267c522 100644 --- a/src/modules/m_spanningtree/metadata.cpp +++ b/src/modules/m_spanningtree/metadata.cpp @@ -21,7 +21,7 @@ #include "inspircd.h" #include "commands.h" -CmdResult CommandMetadata::Handle(User* srcuser, std::vector<std::string>& params) +CmdResult CommandMetadata::Handle(User* srcuser, Params& params) { if (params[0] == "*") { diff --git a/src/modules/m_spanningtree/misccommands.cpp b/src/modules/m_spanningtree/misccommands.cpp index 00f31d668..8fc1b178f 100644 --- a/src/modules/m_spanningtree/misccommands.cpp +++ b/src/modules/m_spanningtree/misccommands.cpp @@ -29,13 +29,13 @@ #include "commands.h" #include "treeserver.h" -CmdResult CommandSNONotice::Handle(User* user, std::vector<std::string>& params) +CmdResult CommandSNONotice::Handle(User* user, Params& params) { ServerInstance->SNO->WriteToSnoMask(params[0][0], "From " + user->nick + ": " + params[1]); return CMD_SUCCESS; } -CmdResult CommandEndBurst::HandleServer(TreeServer* server, std::vector<std::string>& params) +CmdResult CommandEndBurst::HandleServer(TreeServer* server, Params& params) { server->FinishBurst(); return CMD_SUCCESS; diff --git a/src/modules/m_spanningtree/nick.cpp b/src/modules/m_spanningtree/nick.cpp index 9e290e07f..4f53941ce 100644 --- a/src/modules/m_spanningtree/nick.cpp +++ b/src/modules/m_spanningtree/nick.cpp @@ -30,7 +30,7 @@ #include "commands.h" #include "treeserver.h" -CmdResult CommandNick::HandleRemote(::RemoteUser* user, std::vector<std::string>& params) +CmdResult CommandNick::HandleRemote(::RemoteUser* user, Params& params) { if ((isdigit(params[0][0])) && (params[0] != user->uuid)) throw ProtocolException("Attempted to change nick to an invalid or non-matching UUID"); diff --git a/src/modules/m_spanningtree/num.cpp b/src/modules/m_spanningtree/num.cpp index 2c8697c9a..f83f91286 100644 --- a/src/modules/m_spanningtree/num.cpp +++ b/src/modules/m_spanningtree/num.cpp @@ -23,7 +23,7 @@ #include "commands.h" #include "remoteuser.h" -CmdResult CommandNum::HandleServer(TreeServer* server, std::vector<std::string>& params) +CmdResult CommandNum::HandleServer(TreeServer* server, CommandBase::Params& params) { User* const target = ServerInstance->FindUUID(params[1]); if (!target) @@ -42,7 +42,7 @@ CmdResult CommandNum::HandleServer(TreeServer* server, std::vector<std::string>& return CMD_SUCCESS; } -RouteDescriptor CommandNum::GetRouting(User* user, const std::vector<std::string>& params) +RouteDescriptor CommandNum::GetRouting(User* user, const Params& params) { return ROUTE_UNICAST(params[1]); } @@ -52,10 +52,10 @@ CommandNum::Builder::Builder(SpanningTree::RemoteUser* target, const Numeric::Nu { TreeServer* const server = (numeric.GetServer() ? (static_cast<TreeServer*>(numeric.GetServer())) : Utils->TreeRoot); push(server->GetID()).push(target->uuid).push(InspIRCd::Format("%03u", numeric.GetNumeric())); - const std::vector<std::string>& params = numeric.GetParams(); + const CommandBase::Params& params = numeric.GetParams(); if (!params.empty()) { - for (std::vector<std::string>::const_iterator i = params.begin(); i != params.end()-1; ++i) + for (CommandBase::Params::const_iterator i = params.begin(); i != params.end()-1; ++i) push(*i); push_last(params.back()); } diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp index 4b1dce23c..473cdb857 100644 --- a/src/modules/m_spanningtree/opertype.cpp +++ b/src/modules/m_spanningtree/opertype.cpp @@ -26,7 +26,7 @@ /** Because the core won't let users or even SERVERS set +o, * we use the OPERTYPE command to do this. */ -CmdResult CommandOpertype::HandleRemote(RemoteUser* u, std::vector<std::string>& params) +CmdResult CommandOpertype::HandleRemote(RemoteUser* u, CommandBase::Params& params) { const std::string& opertype = params[0]; if (!u->IsOper()) diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp index d1a00ed84..693b07bad 100644 --- a/src/modules/m_spanningtree/override_map.cpp +++ b/src/modules/m_spanningtree/override_map.cpp @@ -168,7 +168,7 @@ static std::vector<std::string> GetMap(User* user, TreeServer* current, unsigned return map; } -CmdResult CommandMap::Handle(const std::vector<std::string>& parameters, User* user) +CmdResult CommandMap::Handle(User* user, const Params& parameters) { if (parameters.size() > 0) { @@ -215,7 +215,7 @@ CmdResult CommandMap::Handle(const std::vector<std::string>& parameters, User* u return CMD_SUCCESS; } -RouteDescriptor CommandMap::GetRouting(User* user, const std::vector<std::string>& parameters) +RouteDescriptor CommandMap::GetRouting(User* user, const Params& parameters) { if (!parameters.empty()) return ROUTE_UNICAST(parameters[0]); diff --git a/src/modules/m_spanningtree/override_squit.cpp b/src/modules/m_spanningtree/override_squit.cpp index 9cec527d3..eb224660d 100644 --- a/src/modules/m_spanningtree/override_squit.cpp +++ b/src/modules/m_spanningtree/override_squit.cpp @@ -25,7 +25,7 @@ #include "treeserver.h" #include "treesocket.h" -ModResult ModuleSpanningTree::HandleSquit(const std::vector<std::string>& parameters, User* user) +ModResult ModuleSpanningTree::HandleSquit(const CommandBase::Params& parameters, User* user) { TreeServer* s = Utils->FindServerMask(parameters[0]); if (s) diff --git a/src/modules/m_spanningtree/override_whois.cpp b/src/modules/m_spanningtree/override_whois.cpp index 7f7189854..6a64a9403 100644 --- a/src/modules/m_spanningtree/override_whois.cpp +++ b/src/modules/m_spanningtree/override_whois.cpp @@ -21,7 +21,7 @@ #include "main.h" #include "commandbuilder.h" -ModResult ModuleSpanningTree::HandleRemoteWhois(const std::vector<std::string>& parameters, User* user) +ModResult ModuleSpanningTree::HandleRemoteWhois(const CommandBase::Params& parameters, User* user) { User* remote = ServerInstance->FindNickOnly(parameters[1]); if (remote && !IS_LOCAL(remote)) diff --git a/src/modules/m_spanningtree/ping.cpp b/src/modules/m_spanningtree/ping.cpp index 878f8af3a..844feb35b 100644 --- a/src/modules/m_spanningtree/ping.cpp +++ b/src/modules/m_spanningtree/ping.cpp @@ -24,7 +24,7 @@ #include "commands.h" #include "utils.h" -CmdResult CommandPing::Handle(User* user, std::vector<std::string>& params) +CmdResult CommandPing::Handle(User* user, Params& params) { if (params[0] == ServerInstance->Config->GetSID()) { diff --git a/src/modules/m_spanningtree/pong.cpp b/src/modules/m_spanningtree/pong.cpp index 5d97f2af2..718d5f0bb 100644 --- a/src/modules/m_spanningtree/pong.cpp +++ b/src/modules/m_spanningtree/pong.cpp @@ -24,7 +24,7 @@ #include "commands.h" #include "utils.h" -CmdResult CommandPong::HandleServer(TreeServer* server, std::vector<std::string>& params) +CmdResult CommandPong::HandleServer(TreeServer* server, CommandBase::Params& params) { if (server->IsBursting()) { diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp index 64ca72977..b50b5e852 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -24,13 +24,13 @@ #include "treeserver.h" #include "commandbuilder.h" -void ModuleSpanningTree::OnPostCommand(Command* command, const std::vector<std::string>& parameters, LocalUser* user, CmdResult result, const std::string& original_line) +void ModuleSpanningTree::OnPostCommand(Command* command, const CommandBase::Params& parameters, LocalUser* user, CmdResult result, const std::string& original_line) { if (result == CMD_SUCCESS) Utils->RouteCommand(NULL, command, parameters, user); } -void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscmd, const parameterlist& parameters, User* user) +void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscmd, const CommandBase::Params& parameters, User* user) { const std::string& command = thiscmd->name; RouteDescriptor routing = thiscmd->GetRouting(user, parameters); diff --git a/src/modules/m_spanningtree/precommand.cpp b/src/modules/m_spanningtree/precommand.cpp index 4733d0071..0d5268493 100644 --- a/src/modules/m_spanningtree/precommand.cpp +++ b/src/modules/m_spanningtree/precommand.cpp @@ -22,7 +22,7 @@ #include "main.h" -ModResult ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::string>& parameters, LocalUser *user, bool validated, const std::string &original_line) +ModResult ModuleSpanningTree::OnPreCommand(std::string &command, CommandBase::Params& parameters, LocalUser *user, bool validated, const std::string &original_line) { /* If the command doesnt appear to be valid, we dont want to mess with it. */ if (!validated) diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp index b3326581b..e54a528d9 100644 --- a/src/modules/m_spanningtree/protocolinterface.cpp +++ b/src/modules/m_spanningtree/protocolinterface.cpp @@ -44,7 +44,7 @@ void SpanningTreeProtocolInterface::GetServerList(ServerList& sl) } } -bool SpanningTreeProtocolInterface::SendEncapsulatedData(const std::string& targetmask, const std::string& cmd, const parameterlist& params, User* source) +bool SpanningTreeProtocolInterface::SendEncapsulatedData(const std::string& targetmask, const std::string& cmd, const CommandBase::Params& params, User* source) { if (!source) source = ServerInstance->FakeClient; @@ -71,7 +71,7 @@ bool SpanningTreeProtocolInterface::SendEncapsulatedData(const std::string& targ return true; } -void SpanningTreeProtocolInterface::BroadcastEncap(const std::string& cmd, const parameterlist& params, User* source, User* omit) +void SpanningTreeProtocolInterface::BroadcastEncap(const std::string& cmd, const CommandBase::Params& params, User* source, User* omit) { if (!source) source = ServerInstance->FakeClient; diff --git a/src/modules/m_spanningtree/protocolinterface.h b/src/modules/m_spanningtree/protocolinterface.h index b0609005c..969ed68bf 100644 --- a/src/modules/m_spanningtree/protocolinterface.h +++ b/src/modules/m_spanningtree/protocolinterface.h @@ -31,8 +31,8 @@ class SpanningTreeProtocolInterface : public ProtocolInterface void SendMetaData(const std::string& key, const std::string& data) CXX11_OVERRIDE; }; - bool SendEncapsulatedData(const std::string& targetmask, const std::string& cmd, const parameterlist& params, User* source) CXX11_OVERRIDE; - void BroadcastEncap(const std::string& cmd, const parameterlist& params, User* source, User* omit) CXX11_OVERRIDE; + bool SendEncapsulatedData(const std::string& targetmask, const std::string& cmd, const CommandBase::Params& params, User* source) CXX11_OVERRIDE; + void BroadcastEncap(const std::string& cmd, const CommandBase::Params& params, User* source, User* omit) CXX11_OVERRIDE; void SendMetaData(User* user, const std::string& key, const std::string& data) CXX11_OVERRIDE; void SendMetaData(Channel* chan, const std::string& key, const std::string& data) CXX11_OVERRIDE; void SendMetaData(const std::string& key, const std::string& data) CXX11_OVERRIDE; diff --git a/src/modules/m_spanningtree/rconnect.cpp b/src/modules/m_spanningtree/rconnect.cpp index 8b8757a07..7779355e2 100644 --- a/src/modules/m_spanningtree/rconnect.cpp +++ b/src/modules/m_spanningtree/rconnect.cpp @@ -31,7 +31,7 @@ CommandRConnect::CommandRConnect (Module* Creator) syntax = "<remote-server-mask> <target-server-mask>"; } -CmdResult CommandRConnect::Handle (const std::vector<std::string>& parameters, User *user) +CmdResult CommandRConnect::Handle(User* user, const Params& parameters) { /* First see if the server which is being asked to connect to another server in fact exists */ if (!Utils->FindServerMask(parameters[0])) @@ -45,7 +45,7 @@ CmdResult CommandRConnect::Handle (const std::vector<std::string>& parameters, U { /* Yes, initiate the given connect */ ServerInstance->SNO->WriteToSnoMask('l',"Remote CONNECT from %s matching \002%s\002, connecting server \002%s\002",user->nick.c_str(),parameters[0].c_str(),parameters[1].c_str()); - std::vector<std::string> para; + CommandBase::Params para; para.push_back(parameters[1]); ((ModuleSpanningTree*)(Module*)creator)->HandleConnect(para, user); } @@ -67,7 +67,7 @@ CmdResult CommandRConnect::Handle (const std::vector<std::string>& parameters, U return CMD_SUCCESS; } -RouteDescriptor CommandRConnect::GetRouting(User* user, const std::vector<std::string>& parameters) +RouteDescriptor CommandRConnect::GetRouting(User* user, const Params& parameters) { return ROUTE_UNICAST(parameters[0]); } diff --git a/src/modules/m_spanningtree/rsquit.cpp b/src/modules/m_spanningtree/rsquit.cpp index 487db2826..7ede80b4c 100644 --- a/src/modules/m_spanningtree/rsquit.cpp +++ b/src/modules/m_spanningtree/rsquit.cpp @@ -32,7 +32,7 @@ CommandRSQuit::CommandRSQuit(Module* Creator) syntax = "<target-server-mask> [reason]"; } -CmdResult CommandRSQuit::Handle (const std::vector<std::string>& parameters, User *user) +CmdResult CommandRSQuit::Handle(User* user, const Params& parameters) { TreeServer *server_target; // Server to squit @@ -60,7 +60,7 @@ CmdResult CommandRSQuit::Handle (const std::vector<std::string>& parameters, Use return CMD_SUCCESS; } -RouteDescriptor CommandRSQuit::GetRouting(User* user, const std::vector<std::string>& parameters) +RouteDescriptor CommandRSQuit::GetRouting(User* user, const Params& parameters) { return ROUTE_UNICAST(parameters[0]); } diff --git a/src/modules/m_spanningtree/save.cpp b/src/modules/m_spanningtree/save.cpp index d77c2a382..be3a0a687 100644 --- a/src/modules/m_spanningtree/save.cpp +++ b/src/modules/m_spanningtree/save.cpp @@ -26,7 +26,7 @@ /** * SAVE command - force nick change to UID on timestamp match */ -CmdResult CommandSave::Handle(User* user, std::vector<std::string>& params) +CmdResult CommandSave::Handle(User* user, Params& params) { User* u = ServerInstance->FindUUID(params[0]); if (!u) diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index ecdad87f8..07004a1e8 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -32,7 +32,7 @@ * Some server somewhere in the network introducing another server. * -- w */ -CmdResult CommandServer::HandleServer(TreeServer* ParentOfThis, std::vector<std::string>& params) +CmdResult CommandServer::HandleServer(TreeServer* ParentOfThis, Params& params) { const std::string& servername = params[0]; const std::string& sid = params[1]; @@ -70,9 +70,9 @@ CmdResult CommandServer::HandleServer(TreeServer* ParentOfThis, std::vector<std: return CMD_SUCCESS; } -void CommandServer::HandleExtra(TreeServer* newserver, const std::vector<std::string>& params) +void CommandServer::HandleExtra(TreeServer* newserver, Params& params) { - for (std::vector<std::string>::const_iterator i = params.begin() + 2; i != params.end() - 1; ++i) + for (CommandBase::Params::const_iterator i = params.begin() + 2; i != params.end() - 1; ++i) { const std::string& prop = *i; std::string::size_type p = prop.find('='); @@ -90,7 +90,7 @@ void CommandServer::HandleExtra(TreeServer* newserver, const std::vector<std::st } } -Link* TreeSocket::AuthRemote(const parameterlist& params) +Link* TreeSocket::AuthRemote(const CommandBase::Params& params) { if (params.size() < 5) { @@ -148,7 +148,7 @@ Link* TreeSocket::AuthRemote(const parameterlist& params) * This is used after the other side of a connection has accepted our credentials. * They are then introducing themselves to us, BEFORE either of us burst. -- w */ -bool TreeSocket::Outbound_Reply_Server(parameterlist ¶ms) +bool TreeSocket::Outbound_Reply_Server(CommandBase::Params& params) { const Link* x = AuthRemote(params); if (x) @@ -200,7 +200,7 @@ bool TreeSocket::CheckDuplicate(const std::string& sname, const std::string& sid * Someone else is attempting to connect to us if this is called. Validate their credentials etc. * -- w */ -bool TreeSocket::Inbound_Server(parameterlist ¶ms) +bool TreeSocket::Inbound_Server(CommandBase::Params& params) { const Link* x = AuthRemote(params); if (x) diff --git a/src/modules/m_spanningtree/servercommand.cpp b/src/modules/m_spanningtree/servercommand.cpp index ef55cd00e..5b8152846 100644 --- a/src/modules/m_spanningtree/servercommand.cpp +++ b/src/modules/m_spanningtree/servercommand.cpp @@ -32,7 +32,7 @@ void ServerCommand::RegisterService() st->CmdManager.AddCommand(this); } -RouteDescriptor ServerCommand::GetRouting(User* user, const std::vector<std::string>& parameters) +RouteDescriptor ServerCommand::GetRouting(User* user, const Params& parameters) { // Broadcast server-to-server commands unless overridden return ROUTE_BROADCAST; diff --git a/src/modules/m_spanningtree/servercommand.h b/src/modules/m_spanningtree/servercommand.h index 84488bd68..6ea5a9251 100644 --- a/src/modules/m_spanningtree/servercommand.h +++ b/src/modules/m_spanningtree/servercommand.h @@ -42,8 +42,8 @@ class ServerCommand : public CommandBase */ void RegisterService() CXX11_OVERRIDE; - virtual CmdResult Handle(User* user, std::vector<std::string>& parameters) = 0; - RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE; + virtual CmdResult Handle(User* user, Params& parameters) = 0; + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE; /** * Extract the TS from a string. @@ -65,7 +65,7 @@ class UserOnlyServerCommand : public ServerCommand UserOnlyServerCommand(Module* Creator, const std::string& Name, unsigned int MinPara = 0, unsigned int MaxPara = 0) : ServerCommand(Creator, Name, MinPara, MaxPara) { } - CmdResult Handle(User* user, std::vector<std::string>& parameters) CXX11_OVERRIDE + CmdResult Handle(User* user, Params& parameters) CXX11_OVERRIDE { RemoteUser* remoteuser = IS_REMOTE(user); if (!remoteuser) @@ -84,7 +84,7 @@ class ServerOnlyServerCommand : public ServerCommand ServerOnlyServerCommand(Module* Creator, const std::string& Name, unsigned int MinPara = 0, unsigned int MaxPara = 0) : ServerCommand(Creator, Name, MinPara, MaxPara) { } - CmdResult Handle(User* user, std::vector<std::string>& parameters) CXX11_OVERRIDE + CmdResult Handle(User* user, CommandBase::Params& parameters) CXX11_OVERRIDE { if (!IS_SERVER(user)) throw ProtocolException("Invalid source"); diff --git a/src/modules/m_spanningtree/sinfo.cpp b/src/modules/m_spanningtree/sinfo.cpp index 7f175bafb..a5dae783c 100644 --- a/src/modules/m_spanningtree/sinfo.cpp +++ b/src/modules/m_spanningtree/sinfo.cpp @@ -21,7 +21,7 @@ #include "treeserver.h" #include "commands.h" -CmdResult CommandSInfo::HandleServer(TreeServer* server, std::vector<std::string>& params) +CmdResult CommandSInfo::HandleServer(TreeServer* server, CommandBase::Params& params) { const std::string& key = params.front(); const std::string& value = params.back(); diff --git a/src/modules/m_spanningtree/svsjoin.cpp b/src/modules/m_spanningtree/svsjoin.cpp index c85e4f412..92187ddf7 100644 --- a/src/modules/m_spanningtree/svsjoin.cpp +++ b/src/modules/m_spanningtree/svsjoin.cpp @@ -22,7 +22,7 @@ #include "commands.h" -CmdResult CommandSVSJoin::Handle(User* user, std::vector<std::string>& parameters) +CmdResult CommandSVSJoin::Handle(User* user, Params& parameters) { // Check for valid channel name if (!ServerInstance->IsChannel(parameters[1])) @@ -52,7 +52,7 @@ CmdResult CommandSVSJoin::Handle(User* user, std::vector<std::string>& parameter return CMD_SUCCESS; } -RouteDescriptor CommandSVSJoin::GetRouting(User* user, const std::vector<std::string>& parameters) +RouteDescriptor CommandSVSJoin::GetRouting(User* user, const Params& parameters) { return ROUTE_OPT_UCAST(parameters[0]); } diff --git a/src/modules/m_spanningtree/svsnick.cpp b/src/modules/m_spanningtree/svsnick.cpp index 84cf8558c..2514dfd6f 100644 --- a/src/modules/m_spanningtree/svsnick.cpp +++ b/src/modules/m_spanningtree/svsnick.cpp @@ -23,7 +23,7 @@ #include "main.h" #include "commands.h" -CmdResult CommandSVSNick::Handle(User* user, std::vector<std::string>& parameters) +CmdResult CommandSVSNick::Handle(User* user, Params& parameters) { User* u = ServerInstance->FindNick(parameters[0]); @@ -70,7 +70,7 @@ CmdResult CommandSVSNick::Handle(User* user, std::vector<std::string>& parameter return CMD_SUCCESS; } -RouteDescriptor CommandSVSNick::GetRouting(User* user, const std::vector<std::string>& parameters) +RouteDescriptor CommandSVSNick::GetRouting(User* user, const Params& parameters) { return ROUTE_OPT_UCAST(parameters[0]); } diff --git a/src/modules/m_spanningtree/svspart.cpp b/src/modules/m_spanningtree/svspart.cpp index c4163ef3d..505a033e3 100644 --- a/src/modules/m_spanningtree/svspart.cpp +++ b/src/modules/m_spanningtree/svspart.cpp @@ -22,7 +22,7 @@ #include "commands.h" -CmdResult CommandSVSPart::Handle(User* user, std::vector<std::string>& parameters) +CmdResult CommandSVSPart::Handle(User* user, Params& parameters) { User* u = ServerInstance->FindUUID(parameters[0]); if (!u) @@ -40,7 +40,7 @@ CmdResult CommandSVSPart::Handle(User* user, std::vector<std::string>& parameter return CMD_SUCCESS; } -RouteDescriptor CommandSVSPart::GetRouting(User* user, const std::vector<std::string>& parameters) +RouteDescriptor CommandSVSPart::GetRouting(User* user, const Params& parameters) { return ROUTE_OPT_UCAST(parameters[0]); } diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 3571f2816..d99dc9104 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -149,7 +149,7 @@ class TreeSocket : public BufferedSocket * @param params Parameters they sent in the SERVER command * @return Link block for the remote server, or NULL if an error occurred */ - Link* AuthRemote(const parameterlist& params); + Link* AuthRemote(const CommandBase::Params& params); /** Write a line on this socket with a new line character appended, skipping all translation for old protocols * @param line Line to write without a new line character at the end @@ -246,7 +246,7 @@ class TreeSocket : public BufferedSocket void ListDifference(const std::string &one, const std::string &two, char sep, std::string& mleft, std::string& mright); - bool Capab(const parameterlist ¶ms); + bool Capab(const CommandBase::Params& params); /** Send one or more FJOINs for a channel of users. * If the length of a single line is more than 480-NICKMAX @@ -277,25 +277,25 @@ class TreeSocket : public BufferedSocket void WriteLine(const std::string& line); /** Handle ERROR command */ - void Error(parameterlist ¶ms); + void Error(CommandBase::Params& params); /** (local) -> SERVER */ - bool Outbound_Reply_Server(parameterlist ¶ms); + bool Outbound_Reply_Server(CommandBase::Params& params); /** (local) <- SERVER */ - bool Inbound_Server(parameterlist ¶ms); + bool Inbound_Server(CommandBase::Params& params); /** Handle IRC line split */ - void Split(const std::string &line, std::string& prefix, std::string& command, parameterlist ¶ms); + void Split(const std::string &line, std::string& prefix, std::string& command, CommandBase::Params& params); /** Process complete line from buffer */ void ProcessLine(std::string &line); - void ProcessConnectedLine(std::string& prefix, std::string& command, parameterlist& params); + void ProcessConnectedLine(std::string& prefix, std::string& command, CommandBase::Params& params); /** Handle socket timeout from connect() */ @@ -306,5 +306,5 @@ class TreeSocket : public BufferedSocket /** Fixes messages coming from old servers so the new command handlers understand them */ - bool PreProcessOldProtocolMessage(User*& who, std::string& cmd, std::vector<std::string>& params); + bool PreProcessOldProtocolMessage(User*& who, std::string& cmd, CommandBase::Params& params); }; diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index a91fbd8eb..062d04222 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -145,7 +145,7 @@ void TreeSocket::SendError(const std::string &errormessage) SetError(errormessage); } -CmdResult CommandSQuit::HandleServer(TreeServer* server, std::vector<std::string>& params) +CmdResult CommandSQuit::HandleServer(TreeServer* server, CommandBase::Params& params) { TreeServer* quitting = Utils->FindServer(params[0]); if (!quitting) diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 04b850755..d9083016c 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -32,13 +32,13 @@ #include "commands.h" /* Handle ERROR command */ -void TreeSocket::Error(parameterlist ¶ms) +void TreeSocket::Error(CommandBase::Params& params) { std::string msg = params.size() ? params[0] : ""; SetError("received ERROR " + msg); } -void TreeSocket::Split(const std::string& line, std::string& prefix, std::string& command, parameterlist& params) +void TreeSocket::Split(const std::string& line, std::string& prefix, std::string& command, CommandBase::Params& params) { irc::tokenstream tokens(line); @@ -79,7 +79,7 @@ void TreeSocket::ProcessLine(std::string &line) { std::string prefix; std::string command; - parameterlist params; + CommandBase::Params params; ServerInstance->Logs->Log(MODNAME, LOG_RAWIO, "S[%d] I %s", this->GetFd(), line.c_str()); @@ -263,7 +263,7 @@ User* TreeSocket::FindSource(const std::string& prefix, const std::string& comma return NULL; } -void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, parameterlist& params) +void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, CommandBase::Params& params) { User* who = FindSource(prefix, command); if (!who) @@ -343,7 +343,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, res = scmd->Handle(who, params); else { - res = cmd->Handle(params, who); + res = cmd->Handle(who, params); if (res == CMD_INVALID) throw ProtocolException("Error in command handler"); } diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 905061cc7..f9cff6c0d 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -26,7 +26,7 @@ #include "treeserver.h" #include "remoteuser.h" -CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vector<std::string>& params) +CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params& params) { /** * 0 1 2 3 4 5 6 7 8 9 (n-1) @@ -133,19 +133,19 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vector<std::st return CMD_SUCCESS; } -CmdResult CommandFHost::HandleRemote(RemoteUser* src, std::vector<std::string>& params) -{ +CmdResult CommandFHost::HandleRemote(RemoteUser* src, Params& params) +{ src->ChangeDisplayedHost(params[0]); return CMD_SUCCESS; } -CmdResult CommandFIdent::HandleRemote(RemoteUser* src, std::vector<std::string>& params) +CmdResult CommandFIdent::HandleRemote(RemoteUser* src, Params& params) { src->ChangeIdent(params[0]); return CMD_SUCCESS; } -CmdResult CommandFName::HandleRemote(RemoteUser* src, std::vector<std::string>& params) +CmdResult CommandFName::HandleRemote(RemoteUser* src, Params& params) { src->ChangeName(params[0]); return CMD_SUCCESS; diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index 3d34b93a6..495b09414 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -114,7 +114,7 @@ class SpanningTreeUtilities : public classbase */ ~SpanningTreeUtilities(); - void RouteCommand(TreeServer* origin, CommandBase* cmd, const parameterlist& parameters, User* user); + void RouteCommand(TreeServer* origin, CommandBase* cmd, const CommandBase::Params& parameters, User* user); /** Send a message from this server to one other local or remote */ |