diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-21 23:44:58 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-21 23:44:58 +0000 |
commit | bbb5f6ee63b4a226e6679119a1ee8c725d7d2abc (patch) | |
tree | 893615b964fb792773a4647c33a0cb424c33fb79 /src | |
parent | 9924e5631193ad581d885380fd11ae8bfb91fa0b (diff) |
Move SetClass to LocalUser
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11941 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/commands.cpp | 28 | ||||
-rw-r--r-- | src/commands/cmd_oper.cpp | 8 | ||||
-rw-r--r-- | src/userprocess.cpp | 2 | ||||
-rw-r--r-- | src/users.cpp | 7 |
4 files changed, 35 insertions, 10 deletions
diff --git a/src/commands.cpp b/src/commands.cpp index 1aeba2d80..41ba0aada 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -108,3 +108,31 @@ bool InspIRCd::NickMatchesEveryone(const std::string &nick, User* user) } return false; } + +CmdResult SplitCommand::Handle(const std::vector<std::string>& parms, User* u) +{ + if (IS_LOCAL(u)) + return HandleLocal(parms, static_cast<LocalUser*>(u)); + if (IS_MODULE_CREATED(u)) + return HandleRemote(parms, static_cast<RemoteUser*>(u)); + if (IS_SERVER(u)) + return HandleServer(parms, static_cast<FakeUser*>(u)); + ServerInstance->Logs->Log("COMMAND", ERROR, "Unknown user type in command (fd=%d)!", u->GetFd()); + return CMD_INVALID; +} + +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; +} + diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp index 683df9091..dc15a5415 100644 --- a/src/commands/cmd_oper.cpp +++ b/src/commands/cmd_oper.cpp @@ -21,19 +21,19 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist); * the same way, however, they can be fully unloaded, where these * may not. */ -class CommandOper : public Command +class CommandOper : public SplitCommand { public: /** Constructor for oper. */ - CommandOper ( Module* parent) : Command(parent,"OPER",2,2) { syntax = "<username> <password>"; } + CommandOper ( Module* parent) : SplitCommand(parent,"OPER",2,2) { syntax = "<username> <password>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command * @param user The user issuing the command * @return A value from CmdResult to indicate command success or failure. */ - CmdResult Handle(const std::vector<std::string>& parameters, User *user); + CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser *user); }; bool OneOfMatches(const char* host, const char* ip, const std::string& hostlist) @@ -50,7 +50,7 @@ bool OneOfMatches(const char* host, const char* ip, const std::string& hostlist) return false; } -CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User *user) +CmdResult CommandOper::HandleLocal(const std::vector<std::string>& parameters, LocalUser *user) { char TheHost[MAXBUF]; char TheIP[MAXBUF]; diff --git a/src/userprocess.cpp b/src/userprocess.cpp index aa05504d5..4cc3f0a88 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -49,7 +49,7 @@ void InspIRCd::DoBackgroundUserStuff() std::vector<LocalUser*>::reverse_iterator count2 = this->Users->local_users.rbegin(); while (count2 != this->Users->local_users.rend()) { - User *curr = *count2; + LocalUser *curr = *count2; count2++; if (curr->quitting) diff --git a/src/users.cpp b/src/users.cpp index e24f59a0c..899db8bc6 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -834,7 +834,7 @@ bool User::CheckLines(bool doZline) return false; } -void User::FullConnect() +void LocalUser::FullConnect() { ServerInstance->stats->statsConnects++; this->idle_lastmsg = ServerInstance->Time(); @@ -1631,13 +1631,10 @@ void User::SplitChanList(User* dest, const std::string &cl) * then their ip will be taken as 'priority' anyway, so for example, * <connect allow="127.0.0.1"> will match joe!bloggs@localhost */ -ConnectClass* User::SetClass(const std::string &explicit_name) +ConnectClass* LocalUser::SetClass(const std::string &explicit_name) { ConnectClass *found = NULL; - if (!IS_LOCAL(this)) - return NULL; - ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Setting connect class for UID %s", this->uuid.c_str()); if (!explicit_name.empty()) |