]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/users.h
Remote user messaging fixes
[user/henk/code/inspircd.git] / include / users.h
index e681ef32629f3fd189abb81f46469cec04e26666..5338deb4c145e3d3a0eb93f4392bfde5706006fb 100644 (file)
@@ -218,27 +218,6 @@ typedef UserChanList::iterator UCListIter;
  */
 class User;
 
-/** Visibility data for a user.
- * If a user has a non-null instance of this class in their User,
- * then it is used to determine if this user is visible to other users
- * or not.
- */
-class CoreExport VisData
-{
- public:
-       /** Create a visdata
-        */
-       VisData();
-       /** Destroy a visdata
-        */
-       virtual ~VisData();
-       /** Is this user visible to some other user?
-        * @param user The other user to compare to
-        * @return true True if the user is visible to the other user, false if not
-        */
-       virtual bool VisibleTo(User* 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
@@ -300,10 +279,6 @@ class CoreExport User : public EventHandler
         */
        ConnectClass *MyClass;
 
-       /** User visibility state, see definition of VisData.
-        */
-       VisData* Visibility;
-
        /** Hostname of connection.
         * This should be valid as per RFC1035.
         */
@@ -339,6 +314,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.
@@ -453,14 +432,6 @@ class CoreExport User : public EventHandler
         */
        std::string sendq;
 
-       /** Message user will quit with. Not to be set externally.
-        */
-       std::string quitmsg;
-
-       /** Quit message shown to opers - not to be set externally.
-        */
-       std::string operquitmsg;
-
        /** Whether or not to send an snotice about this user's quitting
         */
        bool quietquit;
@@ -472,23 +443,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 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 +738,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 +835,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
@@ -931,16 +919,6 @@ class CoreExport User : public EventHandler
         */
        void ShowRULES();
 
-       /** Set oper-specific quit message shown to opers only when the user quits
-        * (overrides any sent by QuitUser)
-        */
-       void SetOperQuit(const std::string &oquit);
-
-       /** Get oper-specific quit message shown only to opers when the user quits.
-        * (overrides any sent by QuitUser)
-        */
-       const std::string& GetOperQuit();
-
        /** Increases a user's command penalty by a set amount.
         */
        void IncreasePenalty(int increase);