mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 11:09:04 -04:00
Move RemoteUser into spanningtree
This commit is contained in:
parent
2f59baa889
commit
375fac384e
@ -218,7 +218,6 @@ class CoreExport SplitCommand : public Command
|
||||
: Command(me, cmd, minpara, maxpara) {}
|
||||
virtual CmdResult Handle(const std::vector<std::string>& parameters, User* user);
|
||||
virtual CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user);
|
||||
virtual CmdResult HandleRemote(const std::vector<std::string>& parameters, RemoteUser* user);
|
||||
virtual CmdResult HandleServer(const std::vector<std::string>& parameters, FakeUser* user);
|
||||
};
|
||||
|
||||
|
@ -34,7 +34,6 @@ class ModePermissionData;
|
||||
class Module;
|
||||
class ModuleState;
|
||||
class OperInfo;
|
||||
class RemoteUser;
|
||||
class ServerConfig;
|
||||
class ServerLimits;
|
||||
class StreamSocket;
|
||||
|
@ -795,15 +795,6 @@ class CoreExport LocalUser : public User
|
||||
bool HasModePermission(ModeID mode);
|
||||
};
|
||||
|
||||
class CoreExport RemoteUser : public User
|
||||
{
|
||||
public:
|
||||
RemoteUser(const std::string& uid, const std::string& srv) : User(uid, srv, USERTYPE_REMOTE)
|
||||
{
|
||||
}
|
||||
virtual void SendText(const std::string& line);
|
||||
};
|
||||
|
||||
class CoreExport FakeUser : public User
|
||||
{
|
||||
public:
|
||||
@ -823,11 +814,6 @@ inline LocalUser* IS_LOCAL(User* u)
|
||||
{
|
||||
return u->usertype == USERTYPE_LOCAL ? static_cast<LocalUser*>(u) : NULL;
|
||||
}
|
||||
/** Is a remote user */
|
||||
inline RemoteUser* IS_REMOTE(User* u)
|
||||
{
|
||||
return u->usertype == USERTYPE_REMOTE ? static_cast<RemoteUser*>(u) : NULL;
|
||||
}
|
||||
/** Is a server fakeuser */
|
||||
inline FakeUser* IS_SERVER(User* u)
|
||||
{
|
||||
|
@ -113,8 +113,6 @@ CmdResult SplitCommand::Handle(const std::vector<std::string>& parms, User* u)
|
||||
{
|
||||
if (IS_LOCAL(u))
|
||||
return HandleLocal(parms, IS_LOCAL(u));
|
||||
if (IS_REMOTE(u))
|
||||
return HandleRemote(parms, IS_REMOTE(u));
|
||||
if (IS_SERVER(u))
|
||||
return HandleServer(parms, IS_SERVER(u));
|
||||
ServerInstance->Logs->Log("COMMAND", DEFAULT, "Unknown user type in command (uuid=%s)!", u->uuid.c_str());
|
||||
@ -126,11 +124,6 @@ CmdResult SplitCommand::HandleLocal(const std::vector<std::string>&, LocalUser*)
|
||||
return CMD_INVALID;
|
||||
}
|
||||
|
||||
CmdResult SplitCommand::HandleRemote(const std::vector<std::string>&, RemoteUser*)
|
||||
{
|
||||
return CMD_INVALID;
|
||||
}
|
||||
|
||||
CmdResult SplitCommand::HandleServer(const std::vector<std::string>&, FakeUser*)
|
||||
{
|
||||
return CMD_INVALID;
|
||||
|
13
src/modules/m_spanningtree/remoteuser.h
Normal file
13
src/modules/m_spanningtree/remoteuser.h
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
class CoreExport RemoteUser : public User
|
||||
{
|
||||
public:
|
||||
TreeServer* srv;
|
||||
RemoteUser(const std::string& uid, TreeServer* Srv) :
|
||||
User(uid, Srv->GetName(), USERTYPE_REMOTE), srv(Srv)
|
||||
{
|
||||
}
|
||||
virtual void SendText(const std::string& line);
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "treesocket.h"
|
||||
#include "treeserver.h"
|
||||
#include "resolvers.h"
|
||||
#include "remoteuser.h"
|
||||
|
||||
CmdResult CommandUID::Handle(const parameterlist ¶ms, User* serversrc)
|
||||
{
|
||||
@ -79,7 +80,7 @@ CmdResult CommandUID::Handle(const parameterlist ¶ms, User* serversrc)
|
||||
User* _new = NULL;
|
||||
try
|
||||
{
|
||||
_new = new RemoteUser(params[0], remoteserver->GetName());
|
||||
_new = new RemoteUser(params[0], remoteserver);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
12
src/modules/m_spanningtree/user.cpp
Normal file
12
src/modules/m_spanningtree/user.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "inspircd.h"
|
||||
#include "treeserver.h"
|
||||
#include "remoteuser.h"
|
||||
|
||||
void RemoteUser::SendText(const std::string& line)
|
||||
{
|
||||
char buf[MAXBUF+30];
|
||||
snprintf(buf, MAXBUF+30, ":%s PUSH %s :%s",
|
||||
ServerInstance->Config->GetSID().c_str(), uuid.c_str(), line.c_str());
|
||||
TreeSocket* sock = srv->GetRoute()->GetSocket();
|
||||
sock->WriteLine(buf);
|
||||
}
|
@ -194,8 +194,8 @@ class CommandTest : public Command
|
||||
{
|
||||
// work around printf's lack of a size_t format specification
|
||||
#define szl(x) static_cast<unsigned long>(sizeof(x))
|
||||
user->SendText(":z.z NOTICE !info :User=%lu/%lu/%lu Channel=%lu Membership=%lu ban=%lu",
|
||||
szl(LocalUser), szl(RemoteUser), szl(FakeUser), szl(Channel),
|
||||
user->SendText(":z.z NOTICE !info :User=%lu/%lu Channel=%lu Membership=%lu ban=%lu",
|
||||
szl(LocalUser), szl(FakeUser), szl(Channel),
|
||||
szl(Membership), szl(BanItem));
|
||||
}
|
||||
else if (parameters[0] == "check")
|
||||
|
@ -1282,11 +1282,6 @@ void LocalUser::SendText(const std::string& line)
|
||||
Write(line);
|
||||
}
|
||||
|
||||
void RemoteUser::SendText(const std::string& line)
|
||||
{
|
||||
ServerInstance->PI->PushToClient(this, line);
|
||||
}
|
||||
|
||||
void FakeUser::SendText(const std::string& line)
|
||||
{
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user