aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_spanningtree/ijoin.cpp
diff options
context:
space:
mode:
authorGravatar attilamolnar2013-08-19 19:11:02 +0200
committerGravatar attilamolnar2013-08-25 13:42:01 +0200
commitd9d9cbe025f94523265daa72de7596467d71f5c8 (patch)
tree3bd29833312c61949ddbbcb6cfa815c4de5781ce /src/modules/m_spanningtree/ijoin.cpp
parentClean up the protocol interface (diff)
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/ijoin.cpp')
-rw-r--r--src/modules/m_spanningtree/ijoin.cpp15
1 files changed, 5 insertions, 10 deletions
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;
}