diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-21 23:44:48 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-21 23:44:48 +0000 |
commit | 9924e5631193ad581d885380fd11ae8bfb91fa0b (patch) | |
tree | a818b0bd77cf16e793a4a54c1aeafc0cbf1d0ddf /src/users.cpp | |
parent | 30583ca1f1687927e8bae2bc6cdd7cfde423bfd6 (diff) |
Split LocalUser and RemoteUser
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11940 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/users.cpp')
-rw-r--r-- | src/users.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/users.cpp b/src/users.cpp index fbb2309c3..e24f59a0c 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -233,13 +233,9 @@ User::User(const std::string &uid) server_sa.sa.sa_family = AF_UNSPEC; client_sa.sa.sa_family = AF_UNSPEC; AllowedPrivs = AllowedOperCommands = NULL; + uuid = uid; - if (uid.empty()) - uuid = ServerInstance->GetUID(); - else - uuid = uid; - - ServerInstance->Logs->Log("USERS", DEBUG,"New UUID for user: %s (%s)", uuid.c_str(), uid.empty() ? "allocated new" : "used remote"); + ServerInstance->Logs->Log("USERS", DEBUG, "New UUID for user: %s", uuid.c_str()); user_hash::iterator finduuid = ServerInstance->Users->uuidlist->find(uuid); if (finduuid == ServerInstance->Users->uuidlist->end()) @@ -248,6 +244,10 @@ User::User(const std::string &uid) throw CoreException("Duplicate UUID "+std::string(uuid)+" in User constructor"); } +LocalUser::LocalUser() : User(ServerInstance->GetUID()) +{ +} + User::~User() { if (uuid.length()) @@ -603,7 +603,7 @@ CullResult User::cull() if (fd != INT_MAX) Close(); - std::vector<User*>::iterator x = find(ServerInstance->Users->local_users.begin(),ServerInstance->Users->local_users.end(),this); + std::vector<LocalUser*>::iterator x = find(ServerInstance->Users->local_users.begin(),ServerInstance->Users->local_users.end(),this); if (x != ServerInstance->Users->local_users.end()) ServerInstance->Users->local_users.erase(x); else @@ -1341,12 +1341,18 @@ void User::WriteCommonQuit(const std::string &normal_text, const std::string &op } } -void User::SendText(const std::string& line) +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) { - if (IS_LOCAL(this)) - Write(line); - else if (!IS_SERVER(this)) - ServerInstance->PI->PushToClient(this, line); } void User::SendText(const char *text, ...) @@ -1557,7 +1563,7 @@ void User::SendAll(const char* command, const char* text, ...) snprintf(formatbuffer,MAXBUF,":%s %s $* :%s", this->GetFullHost().c_str(), command, textbuffer); std::string fmt = formatbuffer; - for (std::vector<User*>::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); i++) + for (std::vector<LocalUser*>::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); i++) { (*i)->Write(fmt); } |