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 /include | |
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 'include')
-rw-r--r-- | include/fakeuser.h | 32 | ||||
-rw-r--r-- | include/inspircd.h | 1 | ||||
-rw-r--r-- | include/modules.h | 23 | ||||
-rw-r--r-- | include/usermanager.h | 2 | ||||
-rw-r--r-- | include/users.h | 58 |
5 files changed, 57 insertions, 59 deletions
diff --git a/include/fakeuser.h b/include/fakeuser.h deleted file mode 100644 index a46971091..000000000 --- a/include/fakeuser.h +++ /dev/null @@ -1,32 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#ifndef __FAKEUSER_H__ -#define __FAKEUSER_H__ - -#include "users.h" - -class CoreExport FakeUser : public User -{ - public: - FakeUser(const std::string &uid) : User(uid) - { - SetFd(FD_FAKEUSER_NUMBER); - } - - virtual const std::string GetFullHost(); - virtual const std::string GetFullRealHost(); - void SetFakeServer(std::string name); -}; - -#endif diff --git a/include/inspircd.h b/include/inspircd.h index b4f73d571..caebe2eeb 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -87,7 +87,6 @@ CoreExport extern InspIRCd* ServerInstance; #include "inspstring.h" #include "protocol.h" #include "threadengine.h" -#include "fakeuser.h" #ifndef PATH_MAX #warning Potentially broken system, PATH_MAX undefined diff --git a/include/modules.h b/include/modules.h index 5e6cf13f5..ae29b2176 100644 --- a/include/modules.h +++ b/include/modules.h @@ -198,29 +198,6 @@ do { \ WHILE_EACH_HOOK(n); \ } while (0) -/** Represents a non-local user. - * (in fact, any FD less than -1 does) - */ -#define FD_MAGIC_NUMBER -42 -/** Represents a fake user (i.e. a server) - */ -#define FD_FAKEUSER_NUMBER -7 - -/* Useful macros */ - -/** Is a local user */ -#define IS_LOCAL(x) (x->GetFd() > -1) -/** Is a remote user */ -#define IS_REMOTE(x) (x->GetFd() < 0) -/** Is a fake user */ -#define IS_SERVER(x) (x->GetFd() == FD_FAKEUSER_NUMBER) -/** Is a module created user */ -#define IS_MODULE_CREATED(x) (x->GetFd() == FD_MAGIC_NUMBER) -/** Is an oper */ -#define IS_OPER(x) (!x->oper.empty()) -/** Is away */ -#define IS_AWAY(x) (!x->awaymsg.empty()) - /** Holds a module's Version information. * The members (set by the constructor only) indicate details as to the version number * of a module. A class of type Version is returned by the GetVersion method of the Module class. diff --git a/include/usermanager.h b/include/usermanager.h index 4c1f94248..885394f76 100644 --- a/include/usermanager.h +++ b/include/usermanager.h @@ -48,7 +48,7 @@ class CoreExport UserManager /** Local client list, a vector containing only local clients */ - std::vector<User*> local_users; + std::vector<LocalUser*> local_users; /** Oper list, a vector containing all local and remote opered users */ diff --git a/include/users.h b/include/users.h index 5153ebdd4..c60d5f033 100644 --- a/include/users.h +++ b/include/users.h @@ -479,7 +479,7 @@ class CoreExport User : public StreamSocket * @param Instance Creator instance * @param uid User UUID, or empty to allocate one automatically */ - User(const std::string &uid = ""); + User(const std::string &uid); /** Check if the user matches a G or K line, and disconnect them if they do. * @param doZline True if ZLines should be checked (if IP has changed since initial connect) @@ -753,7 +753,7 @@ class CoreExport User : public StreamSocket /** Write to the user, routing the line if the user is remote. */ - void SendText(const std::string& line); + virtual void SendText(const std::string& line) = 0; /** Write to the user, routing the line if the user is remote. */ @@ -862,6 +862,60 @@ class CoreExport User : public StreamSocket virtual CullResult cull(); }; +/** Represents a non-local user. + * (in fact, any FD less than -1 does) + */ +#define FD_MAGIC_NUMBER -42 +/** Represents a fake user (i.e. a server) + */ +#define FD_FAKEUSER_NUMBER -7 + +/* Useful macros */ + +/** Is a local user */ +#define IS_LOCAL(x) (x->GetFd() > -1) +/** Is a remote user */ +#define IS_REMOTE(x) (x->GetFd() < 0) +/** Is a fake user */ +#define IS_SERVER(x) (x->GetFd() == FD_FAKEUSER_NUMBER) +/** Is a module created user */ +#define IS_MODULE_CREATED(x) (x->GetFd() == FD_MAGIC_NUMBER) +/** Is an oper */ +#define IS_OPER(x) (!x->oper.empty()) +/** Is away */ +#define IS_AWAY(x) (!x->awaymsg.empty()) + +class CoreExport LocalUser : public User +{ + public: + LocalUser(); + virtual void SendText(const std::string& line); +}; + +class CoreExport RemoteUser : public User +{ + public: + RemoteUser(const std::string& uid) : User(uid) + { + SetFd(FD_MAGIC_NUMBER); + } + virtual void SendText(const std::string& line); +}; + +class CoreExport FakeUser : public User +{ + public: + FakeUser(const std::string &uid) : User(uid) + { + SetFd(FD_FAKEUSER_NUMBER); + } + + virtual void SendText(const std::string& line); + virtual const std::string GetFullHost(); + virtual const std::string GetFullRealHost(); + void SetFakeServer(std::string name); +}; + /** Derived from Resolver, and performs user forward/reverse lookups. */ class CoreExport UserResolver : public Resolver |