]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/users.h
Remove unneeded Extensible inheritance and remove "age" field from classbase
[user/henk/code/inspircd.git] / include / users.h
index 0964de9b91800c62f97e94d8fd0d2a91c446e6d3..19d78ec23c37314d2b24f0cddbc98edb7c93c396 100644 (file)
@@ -339,6 +339,10 @@ class CoreExport User : public EventHandler
         */
        time_t lastping;
 
+       /** Time that the object was instantiated (used for TS calculation etc)
+       */
+       time_t age;
+
        /** Time the connection was created, set in the constructor. This
         * may be different from the time the user's classbase object was
         * created.
@@ -472,23 +476,32 @@ class CoreExport User : public EventHandler
         */
        bool quitting;
 
-       /** IPV4 or IPV6 ip address, binary format. Use SetSockAddr to set this and
-        * GetIPString/GetPort to obtain its value in a readable manner
+       /** Server address and port that this user is connected to.
+        * If unknown, address family is AF_UNKNOWN
+        */
+       irc::sockets::sockaddrs server_sa;
+       /** Client address that the user is connected from.
+        * Port number is only valid if local.
+        *
+        * Do not modify this value directly, use SetClientIP() to change it
         */
-       irc::sockets::sockaddrs ip;
+       irc::sockets::sockaddrs client_sa;
 
-       /** Initialize the clients sockaddr
-        * @param ip A human-readable IP address for this user
-        * @param port The port number of this user (zero if unknown)
+       /** Sets the client IP for this user
+        * @return true if the conversion was successful
         */
-       void SetSockAddr(const char* ip, int port);
+       bool SetClientIP(const char* sip);
 
-       /** Get port number from sockaddr
+       /**
         * @return The port number of this user.
         */
-       int GetPort();
+       int GetServerPort();
+       /**
+        * @return The server IP address
+        */
+       std::string GetServerIP();
 
-       /** Get IP string from sockaddr, using static internal buffer
+       /** Get client IP string from sockaddr, using static internal buffer
         * @return The IP string
         */
        const char* GetIPString();
@@ -758,7 +771,7 @@ class CoreExport User : public EventHandler
        /** Write text to this user, appending CR/LF.
         * @param text A std::string to send to the user
         */
-       void Write(std::string text);
+       void Write(const std::string &text);
 
        /** Write text to this user, appending CR/LF.
         * @param text The format string for text to send to the user
@@ -855,6 +868,14 @@ class CoreExport User : public EventHandler
         */
        bool SharesChannelWith(User *other);
 
+       /** Send fake quit/join messages for host or ident cycle.
+        * Run this after the item in question has changed.
+        * You should not need to use this function, call ChangeDisplayedHost instead
+        *
+        * @param The entire QUIT line, including the source using the old value
+        */
+       void DoHostCycle(const std::string &quitline);
+
        /** Change the displayed host of a user.
         * ALWAYS use this function, rather than writing User::dhost directly,
         * as this triggers module events allowing the change to be syncronized to