]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/users.h
Create irc::sockets::cidr_mask
[user/henk/code/inspircd.git] / include / users.h
index 49e43f0bf4a748bef63f3cb934125a69049ebf92..0fc6e37238e8d2475ea5eaed5c50122cd3b67a5b 100644 (file)
@@ -56,12 +56,6 @@ enum RegistrationState {
        REG_ALL = 7             /* REG_NICKUSER plus next bit along */
 };
 
-/* Required forward declaration */
-class Channel;
-class UserResolver;
-struct ConfigTag;
-class OperInfo;
-
 /** Holds information relevent to <connect allow> and <connect deny> tags in the config file.
  */
 struct CoreExport ConnectClass : public refcountbase
@@ -208,26 +202,6 @@ struct CoreExport ConnectClass : public refcountbase
        }
 };
 
-/** Holds a complete list of all channels to which a user has been invited and has not yet joined, and the time at which they'll expire.
- */
-typedef std::vector< std::pair<irc::string, time_t> > InvitedList;
-
-/** Holds a complete list of all allow and deny tags from the configuration file (connection classes)
- */
-typedef std::vector<reference<ConnectClass> > ClassVector;
-
-/** Typedef for the list of user-channel records for a user
- */
-typedef std::set<Channel*> UserChanList;
-
-/** Shorthand for an iterator into a UserChanList
- */
-typedef UserChanList::iterator UCListIter;
-
-/* Required forward declaration
- */
-class User;
-
 /** Holds all information about a user
  * This class stores all information about a user connected to the irc server. Everything about a
  * connection is stored here primarily, from the user's socket ID (file descriptor) through to the
@@ -297,7 +271,7 @@ class CoreExport User : public StreamSocket
        /** The user's unique identifier.
         * This is the unique identifier which the user has across the network.
         */
-       std::string uuid;
+       const std::string uuid;
 
        /** The users ident reply.
         * Two characters are added to the user-defined limit to compensate for the tilde etc.
@@ -336,7 +310,7 @@ class CoreExport User : public StreamSocket
 
        /** The server the user is connected to.
         */
-       std::string server;
+       const std::string server;
 
        /** The user's away message.
         * If this string is empty, the user is not marked as away.
@@ -388,26 +362,22 @@ class CoreExport User : public StreamSocket
         */
        const char* GetIPString();
 
+       /** Get CIDR mask, using default range, for this user
+        */
+       irc::sockets::cidr_mask GetCIDRMask();
+
        /** Sets the client IP for this user
         * @return true if the conversion was successful
         */
        bool SetClientIP(const char* sip);
 
-       /** Get a CIDR mask from the IP of this user, using a static internal buffer.
-        * e.g., GetCIDRMask(16) for 223.254.214.52 returns 223.254.0.0/16
-        * This may be used for CIDR clone detection, etc.
-        *
-        * (XXX, brief note: when we do the sockets rewrite, this should move down a
-        * level so it may be used on more derived objects. -- w00t)
-        */
-       const char *GetCIDRMask(int range);
-
        /** Default constructor
         * @throw CoreException if the UID allocated to the user already exists
         * @param Instance Creator instance
         * @param uid User UUID, or empty to allocate one automatically
+        * @param srv Server that this user is from
         */
-       User(const std::string &uid);
+       User(const std::string &uid, const std::string& srv);
 
        /** 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)
@@ -420,7 +390,7 @@ class CoreExport User : public StreamSocket
         * on the server, in nick!ident&at;host form.
         * @return The full masked host of the user
         */
-       virtual const std::string GetFullHost();
+       virtual const std::string& GetFullHost();
 
        /** Returns the full real host of the user
         * This member function returns the hostname of the user as seen by other users
@@ -428,7 +398,7 @@ class CoreExport User : public StreamSocket
         * e.g. through a module, then this method will ignore it and return the true hostname.
         * @return The full real host of the user
         */
-       virtual const std::string GetFullRealHost();
+       virtual const std::string& GetFullRealHost();
 
        /** This clears any cached results that are used for GetFullRealHost() etc.
         * The results of these calls are cached as generating them can be generally expensive.
@@ -896,7 +866,7 @@ class CoreExport LocalUser : public User
 class CoreExport RemoteUser : public User
 {
  public:
-       RemoteUser(const std::string& uid) : User(uid)
+       RemoteUser(const std::string& uid, const std::string& srv) : User(uid, srv)
        {
                SetFd(FD_MAGIC_NUMBER);
        }
@@ -906,15 +876,16 @@ class CoreExport RemoteUser : public User
 class CoreExport FakeUser : public User
 {
  public:
-       FakeUser(const std::string &uid) : User(uid)
+       FakeUser(const std::string &uid, const std::string& srv) : User(uid, srv)
        {
                SetFd(FD_FAKEUSER_NUMBER);
+               nick = srv;
        }
 
+       virtual CullResult cull();
        virtual void SendText(const std::string& line);
-       virtual const std::string GetFullHost();
-       virtual const std::string GetFullRealHost();
-       void SetFakeServer(std::string name);
+       virtual const std::string& GetFullHost();
+       virtual const std::string& GetFullRealHost();
 };
 
 /* Faster than dynamic_cast */