summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/m_spanningtree/away.cpp4
-rw-r--r--src/modules/m_spanningtree/commands.h96
-rw-r--r--src/modules/m_spanningtree/idle.cpp18
-rw-r--r--src/modules/m_spanningtree/ijoin.cpp15
-rw-r--r--src/modules/m_spanningtree/misccommands.cpp12
-rw-r--r--src/modules/m_spanningtree/nick.cpp5
-rw-r--r--src/modules/m_spanningtree/opertype.cpp2
-rw-r--r--src/modules/m_spanningtree/pong.cpp3
-rw-r--r--src/modules/m_spanningtree/server.cpp6
-rw-r--r--src/modules/m_spanningtree/servercommand.h44
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp4
-rw-r--r--src/modules/m_spanningtree/uid.cpp20
-rw-r--r--src/modules/m_spanningtree/version.cpp9
13 files changed, 123 insertions, 115 deletions
diff --git a/src/modules/m_spanningtree/away.cpp b/src/modules/m_spanningtree/away.cpp
index cf0c87ce4..7b151dfef 100644
--- a/src/modules/m_spanningtree/away.cpp
+++ b/src/modules/m_spanningtree/away.cpp
@@ -23,10 +23,8 @@
#include "utils.h"
#include "commands.h"
-CmdResult CommandAway::Handle(User* u, std::vector<std::string>& params)
+CmdResult CommandAway::HandleRemote(RemoteUser* u, std::vector<std::string>& params)
{
- if (IS_SERVER(u))
- return CMD_INVALID;
if (params.size())
{
FOREACH_MOD(OnSetAway, (u, params[params.size() - 1]));
diff --git a/src/modules/m_spanningtree/commands.h b/src/modules/m_spanningtree/commands.h
index e467cdc8b..96cb42563 100644
--- a/src/modules/m_spanningtree/commands.h
+++ b/src/modules/m_spanningtree/commands.h
@@ -86,18 +86,18 @@ class CommandMetadata : public ServerCommand
CmdResult Handle(User* user, std::vector<std::string>& params);
};
-class CommandUID : public ServerCommand
+class CommandUID : public ServerOnlyServerCommand<CommandUID>
{
public:
- CommandUID(Module* Creator) : ServerCommand(Creator, "UID", 10) { }
- CmdResult Handle(User* user, std::vector<std::string>& params);
+ CommandUID(Module* Creator) : ServerOnlyServerCommand<CommandUID>(Creator, "UID", 10) { }
+ CmdResult HandleServer(TreeServer* server, std::vector<std::string>& params);
};
-class CommandOpertype : public ServerCommand
+class CommandOpertype : public UserOnlyServerCommand<CommandOpertype>
{
public:
- CommandOpertype(Module* Creator) : ServerCommand(Creator, "OPERTYPE", 1) { }
- CmdResult Handle(User* user, std::vector<std::string>& params);
+ CommandOpertype(Module* Creator) : UserOnlyServerCommand<CommandOpertype>(Creator, "OPERTYPE", 1) { }
+ CmdResult HandleRemote(RemoteUser* user, std::vector<std::string>& params);
};
class TreeSocket;
@@ -128,46 +128,46 @@ class CommandFTopic : public ServerCommand
CmdResult Handle(User* user, std::vector<std::string>& params);
};
-class CommandFHost : public ServerCommand
+class CommandFHost : public UserOnlyServerCommand<CommandFHost>
{
public:
- CommandFHost(Module* Creator) : ServerCommand(Creator, "FHOST", 1) { }
- CmdResult Handle(User* user, std::vector<std::string>& params);
+ CommandFHost(Module* Creator) : UserOnlyServerCommand<CommandFHost>(Creator, "FHOST", 1) { }
+ CmdResult HandleRemote(RemoteUser* user, std::vector<std::string>& params);
};
-class CommandFIdent : public ServerCommand
+class CommandFIdent : public UserOnlyServerCommand<CommandFIdent>
{
public:
- CommandFIdent(Module* Creator) : ServerCommand(Creator, "FIDENT", 1) { }
- CmdResult Handle(User* user, std::vector<std::string>& params);
+ CommandFIdent(Module* Creator) : UserOnlyServerCommand<CommandFIdent>(Creator, "FIDENT", 1) { }
+ CmdResult HandleRemote(RemoteUser* user, std::vector<std::string>& params);
};
-class CommandFName : public ServerCommand
+class CommandFName : public UserOnlyServerCommand<CommandFName>
{
public:
- CommandFName(Module* Creator) : ServerCommand(Creator, "FNAME", 1) { }
- CmdResult Handle(User* user, std::vector<std::string>& params);
+ CommandFName(Module* Creator) : UserOnlyServerCommand<CommandFName>(Creator, "FNAME", 1) { }
+ CmdResult HandleRemote(RemoteUser* user, std::vector<std::string>& params);
};
-class CommandIJoin : public ServerCommand
+class CommandIJoin : public UserOnlyServerCommand<CommandIJoin>
{
public:
- CommandIJoin(Module* Creator) : ServerCommand(Creator, "IJOIN", 1) { }
- CmdResult Handle(User* user, std::vector<std::string>& params);
+ CommandIJoin(Module* Creator) : UserOnlyServerCommand<CommandIJoin>(Creator, "IJOIN", 1) { }
+ CmdResult HandleRemote(RemoteUser* user, std::vector<std::string>& params);
};
-class CommandResync : public ServerCommand
+class CommandResync : public ServerOnlyServerCommand<CommandResync>
{
public:
- CommandResync(Module* Creator) : ServerCommand(Creator, "RESYNC", 1) { }
- CmdResult Handle(User* user, std::vector<std::string>& parameters);
+ CommandResync(Module* Creator) : ServerOnlyServerCommand<CommandResync>(Creator, "RESYNC", 1) { }
+ CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters);
};
-class CommandAway : public ServerCommand
+class CommandAway : public UserOnlyServerCommand<CommandAway>
{
public:
- CommandAway(Module* Creator) : ServerCommand(Creator, "AWAY", 0, 2) { }
- CmdResult Handle(User* user, std::vector<std::string>& parameters);
+ CommandAway(Module* Creator) : UserOnlyServerCommand<CommandAway>(Creator, "AWAY", 0, 2) { }
+ CmdResult HandleRemote(RemoteUser* user, std::vector<std::string>& parameters);
};
class CommandAddLine : public ServerCommand
@@ -192,19 +192,19 @@ class CommandEncap : public ServerCommand
RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
};
-class CommandIdle : public ServerCommand
+class CommandIdle : public UserOnlyServerCommand<CommandIdle>
{
public:
- CommandIdle(Module* Creator) : ServerCommand(Creator, "IDLE", 1) { }
- CmdResult Handle(User* user, std::vector<std::string>& parameters);
+ 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) { return ROUTE_UNICAST(parameters[0]); }
};
-class CommandNick : public ServerCommand
+class CommandNick : public UserOnlyServerCommand<CommandNick>
{
public:
- CommandNick(Module* Creator) : ServerCommand(Creator, "NICK", 2) { }
- CmdResult Handle(User* user, std::vector<std::string>& parameters);
+ CommandNick(Module* Creator) : UserOnlyServerCommand<CommandNick>(Creator, "NICK", 2) { }
+ CmdResult HandleRemote(RemoteUser* user, std::vector<std::string>& parameters);
};
class CommandPing : public ServerCommand
@@ -215,11 +215,11 @@ class CommandPing : public ServerCommand
RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) { return ROUTE_UNICAST(parameters[0]); }
};
-class CommandPong : public ServerCommand
+class CommandPong : public ServerOnlyServerCommand<CommandPong>
{
public:
- CommandPong(Module* Creator) : ServerCommand(Creator, "PONG", 1) { }
- CmdResult Handle(User* user, std::vector<std::string>& parameters);
+ CommandPong(Module* Creator) : ServerOnlyServerCommand<CommandPong>(Creator, "PONG", 1) { }
+ CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters);
RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) { return ROUTE_UNICAST(parameters[0]); }
};
@@ -238,18 +238,18 @@ class CommandSave : public ServerCommand
CmdResult Handle(User* user, std::vector<std::string>& parameters);
};
-class CommandServer : public ServerCommand
+class CommandServer : public ServerOnlyServerCommand<CommandServer>
{
public:
- CommandServer(Module* Creator) : ServerCommand(Creator, "SERVER", 5) { }
- CmdResult Handle(User* user, std::vector<std::string>& parameters);
+ CommandServer(Module* Creator) : ServerOnlyServerCommand<CommandServer>(Creator, "SERVER", 5) { }
+ CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters);
};
-class CommandSQuit : public ServerCommand
+class CommandSQuit : public ServerOnlyServerCommand<CommandSQuit>
{
public:
- CommandSQuit(Module* Creator) : ServerCommand(Creator, "SQUIT", 2) { }
- CmdResult Handle(User* user, std::vector<std::string>& parameters);
+ CommandSQuit(Module* Creator) : ServerOnlyServerCommand<CommandSQuit>(Creator, "SQUIT", 2) { }
+ CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters);
};
class CommandSNONotice : public ServerCommand
@@ -259,25 +259,25 @@ class CommandSNONotice : public ServerCommand
CmdResult Handle(User* user, std::vector<std::string>& parameters);
};
-class CommandVersion : public ServerCommand
+class CommandVersion : public ServerOnlyServerCommand<CommandServer>
{
public:
- CommandVersion(Module* Creator) : ServerCommand(Creator, "VERSION", 1) { }
- CmdResult Handle(User* user, std::vector<std::string>& parameters);
+ CommandVersion(Module* Creator) : ServerOnlyServerCommand<CommandServer>(Creator, "VERSION", 1) { }
+ CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters);
};
-class CommandBurst : public ServerCommand
+class CommandBurst : public ServerOnlyServerCommand<CommandBurst>
{
public:
- CommandBurst(Module* Creator) : ServerCommand(Creator, "BURST") { }
- CmdResult Handle(User* user, std::vector<std::string>& parameters);
+ CommandBurst(Module* Creator) : ServerOnlyServerCommand<CommandBurst>(Creator, "BURST") { }
+ CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters);
};
-class CommandEndBurst : public ServerCommand
+class CommandEndBurst : public ServerOnlyServerCommand<CommandEndBurst>
{
public:
- CommandEndBurst(Module* Creator) : ServerCommand(Creator, "ENDBURST") { }
- CmdResult Handle(User* user, std::vector<std::string>& parameters);
+ CommandEndBurst(Module* Creator) : ServerOnlyServerCommand<CommandEndBurst>(Creator, "ENDBURST") { }
+ CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters);
};
class SpanningTreeCommands
diff --git a/src/modules/m_spanningtree/idle.cpp b/src/modules/m_spanningtree/idle.cpp
index 57692ddf5..679948a51 100644
--- a/src/modules/m_spanningtree/idle.cpp
+++ b/src/modules/m_spanningtree/idle.cpp
@@ -21,17 +21,19 @@
#include "utils.h"
#include "commands.h"
-CmdResult CommandIdle::Handle(User* issuer, std::vector<std::string>& params)
+CmdResult CommandIdle::HandleRemote(RemoteUser* issuer, std::vector<std::string>& params)
{
- /* If this is a request, this user did the /whois
- * If this is a reply, this user's information is in params[1] and params[2]
+ /**
+ * There are two forms of IDLE: request and reply. Requests have one parameter,
+ * replies have more than one.
+ *
+ * If this is a request, 'issuer' did a /whois and its server wants to learn the
+ * idle time of the user in params[0].
+ *
+ * If this is a reply, params[0] is the user who did the whois and params.back() is
+ * the number of seconds 'issuer' has been idle.
*/
- if (IS_SERVER(issuer))
- return CMD_FAILURE;
- /* If this is a request, this is the user whose idle information was requested
- * If this is a reply, this user did the /whois
- */
User* target = ServerInstance->FindUUID(params[0]);
if ((!target) || (IS_SERVER(target)))
return CMD_FAILURE;
diff --git a/src/modules/m_spanningtree/ijoin.cpp b/src/modules/m_spanningtree/ijoin.cpp
index 8342e9d24..c549149b3 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::Handle(User* user, std::vector<std::string>& params)
+CmdResult CommandIJoin::HandleRemote(RemoteUser* user, std::vector<std::string>& params)
{
Channel* chan = ServerInstance->FindChan(params[0]);
if (!chan)
@@ -63,7 +63,7 @@ CmdResult CommandIJoin::Handle(User* user, std::vector<std::string>& params)
return CMD_SUCCESS;
}
-CmdResult CommandResync::Handle(User* user, std::vector<std::string>& params)
+CmdResult CommandResync::HandleServer(TreeServer* server, std::vector<std::string>& params)
{
ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Resyncing " + params[0]);
Channel* chan = ServerInstance->FindChan(params[0]);
@@ -74,18 +74,13 @@ CmdResult CommandResync::Handle(User* user, std::vector<std::string>& params)
return CMD_FAILURE;
}
- TreeServer* server = Utils->FindServer(user->server);
- if (!server)
- return CMD_FAILURE;
-
- TreeSocket* socket = server->GetSocket();
- if (!socket)
+ if (!server->IsLocal())
{
- ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Received RESYNC with a source that is not directly connected: " + user->uuid);
+ ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Received RESYNC with a source that is not directly connected: " + server->GetID());
return CMD_INVALID;
}
// Send all known information about the channel
- socket->SyncChannel(chan);
+ server->GetSocket()->SyncChannel(chan);
return CMD_SUCCESS;
}
diff --git a/src/modules/m_spanningtree/misccommands.cpp b/src/modules/m_spanningtree/misccommands.cpp
index 6e66c68a7..5b04c73bc 100644
--- a/src/modules/m_spanningtree/misccommands.cpp
+++ b/src/modules/m_spanningtree/misccommands.cpp
@@ -35,22 +35,14 @@ CmdResult CommandSNONotice::Handle(User* user, std::vector<std::string>& params)
return CMD_SUCCESS;
}
-CmdResult CommandBurst::Handle(User* user, std::vector<std::string>& params)
+CmdResult CommandBurst::HandleServer(TreeServer* server, std::vector<std::string>& params)
{
- if (!IS_SERVER(user))
- return CMD_INVALID;
-
- TreeServer* server = Utils->FindServer(user->server);
server->bursting = true;
return CMD_SUCCESS;
}
-CmdResult CommandEndBurst::Handle(User* user, std::vector<std::string>& params)
+CmdResult CommandEndBurst::HandleServer(TreeServer* server, std::vector<std::string>& params)
{
- if (!IS_SERVER(user))
- return CMD_INVALID;
-
- TreeServer* server = Utils->FindServer(user->server);
server->FinishBurst();
return CMD_SUCCESS;
}
diff --git a/src/modules/m_spanningtree/nick.cpp b/src/modules/m_spanningtree/nick.cpp
index 5de12b51b..7ace9cc73 100644
--- a/src/modules/m_spanningtree/nick.cpp
+++ b/src/modules/m_spanningtree/nick.cpp
@@ -29,11 +29,8 @@
#include "utils.h"
#include "commands.h"
-CmdResult CommandNick::Handle(User* user, std::vector<std::string>& params)
+CmdResult CommandNick::HandleRemote(RemoteUser* user, std::vector<std::string>& params)
{
- if (IS_SERVER(user))
- return CMD_INVALID;
-
if ((isdigit(params[0][0])) && (params[0] != user->uuid))
return CMD_INVALID;
diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp
index c3f9b633c..48f55356f 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::Handle(User* u, std::vector<std::string>& params)
+CmdResult CommandOpertype::HandleRemote(RemoteUser* u, std::vector<std::string>& params)
{
const std::string& opertype = params[0];
if (!u->IsOper())
diff --git a/src/modules/m_spanningtree/pong.cpp b/src/modules/m_spanningtree/pong.cpp
index 006d51a10..ce1715874 100644
--- a/src/modules/m_spanningtree/pong.cpp
+++ b/src/modules/m_spanningtree/pong.cpp
@@ -24,9 +24,8 @@
#include "commands.h"
#include "utils.h"
-CmdResult CommandPong::Handle(User* user, std::vector<std::string>& params)
+CmdResult CommandPong::HandleServer(TreeServer* server, std::vector<std::string>& params)
{
- TreeServer* server = Utils->FindServer(user->server);
if (server->bursting)
{
ServerInstance->SNO->WriteGlobalSno('l', "Server \002%s\002 has not finished burst, forcing end of burst (send ENDBURST!)", server->GetName().c_str());
diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp
index 36bd8620a..807666f49 100644
--- a/src/modules/m_spanningtree/server.cpp
+++ b/src/modules/m_spanningtree/server.cpp
@@ -31,19 +31,15 @@
* Some server somewhere in the network introducing another server.
* -- w
*/
-CmdResult CommandServer::Handle(User* user, std::vector<std::string>& params)
+CmdResult CommandServer::HandleServer(TreeServer* ParentOfThis, std::vector<std::string>& params)
{
std::string servername = params[0];
// password is not used for a remote server
// hopcount is not used (ever)
std::string sid = params[3];
std::string description = params[4];
- TreeServer* ParentOfThis = Utils->FindServer(user->server);
TreeSocket* socket = ParentOfThis->GetSocket();
- if (!IS_SERVER(user))
- return CMD_FAILURE;
-
if (!InspIRCd::IsSID(sid))
{
socket->SendError("Invalid format server ID: "+sid+"!");
diff --git a/src/modules/m_spanningtree/servercommand.h b/src/modules/m_spanningtree/servercommand.h
index 4311dd7b7..2fa964232 100644
--- a/src/modules/m_spanningtree/servercommand.h
+++ b/src/modules/m_spanningtree/servercommand.h
@@ -19,6 +19,12 @@
#pragma once
+#include "utils.h"
+
+class TreeServer;
+
+/** Base class for server-to-server commands that may have a (remote) user source or server source.
+ */
class ServerCommand : public CommandBase
{
public:
@@ -28,6 +34,44 @@ class ServerCommand : public CommandBase
virtual RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
};
+/** Base class for server-to-server command handlers which are only valid if their source is a user.
+ * When a server sends a command of this type and the source is a server (sid), the link is aborted.
+ */
+template <class T>
+class UserOnlyServerCommand : public ServerCommand
+{
+ public:
+ 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)
+ {
+ RemoteUser* remoteuser = IS_REMOTE(user);
+ if (!remoteuser)
+ return CMD_INVALID;
+ return static_cast<T*>(this)->HandleRemote(remoteuser, parameters);
+ }
+};
+
+/** Base class for server-to-server command handlers which are only valid if their source is a server.
+ * When a server sends a command of this type and the source is a user (uuid), the link is aborted.
+ */
+template <class T>
+class ServerOnlyServerCommand : public ServerCommand
+{
+ public:
+ 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)
+ {
+ if (!IS_SERVER(user))
+ return CMD_INVALID;
+ TreeServer* server = Utils->FindServer(user->server);
+ return static_cast<T*>(this)->HandleServer(server, parameters);
+ }
+};
+
class ServerCommandManager
{
typedef TR1NS::unordered_map<std::string, ServerCommand*> ServerCommandMap;
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index ad3a6390d..9376a5514 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -207,7 +207,7 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason)
}
}
-CmdResult CommandSQuit::Handle(User* user, std::vector<std::string>& params)
+CmdResult CommandSQuit::HandleServer(TreeServer* server, std::vector<std::string>& params)
{
TreeServer* quitting = Utils->FindServer(params[0]);
if (!quitting)
@@ -216,7 +216,7 @@ CmdResult CommandSQuit::Handle(User* user, std::vector<std::string>& params)
return CMD_FAILURE;
}
- TreeSocket* sock = Utils->FindServer(user->server)->GetSocket();
+ TreeSocket* sock = server->GetSocket();
sock->Squit(quitting, params[1]);
return CMD_SUCCESS;
}
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;
}
diff --git a/src/modules/m_spanningtree/version.cpp b/src/modules/m_spanningtree/version.cpp
index 9a0710359..b63fc259c 100644
--- a/src/modules/m_spanningtree/version.cpp
+++ b/src/modules/m_spanningtree/version.cpp
@@ -24,14 +24,9 @@
#include "treeserver.h"
#include "commands.h"
-CmdResult CommandVersion::Handle(User* user, std::vector<std::string>& params)
+CmdResult CommandVersion::HandleServer(TreeServer* server, std::vector<std::string>& params)
{
- TreeServer* ServerSource = Utils->FindServer(user->server);
-
- if (ServerSource)
- {
- ServerSource->SetVersion(params[0]);
- }
+ server->SetVersion(params[0]);
return CMD_SUCCESS;
}