]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/users.h
Rename User::nping to nextping for consistency with lastping.
[user/henk/code/inspircd.git] / include / users.h
index 4aed944eee63267b7f4812760484560aef4ca713..39e7e90f00d08a10da2107176f280bc530ddb515 100644 (file)
@@ -380,9 +380,9 @@ class CoreExport User : public Extensible
        /** Sets the client IP for this user
         * @return true if the conversion was successful
         */
-       virtual bool SetClientIP(const std::string& address, bool recheck_eline = true);
+       virtual bool SetClientIP(const std::string& address);
 
-       virtual void SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline = true);
+       virtual void SetClientIP(const irc::sockets::sockaddrs& sa);
 
        /** Constructor
         * @throw CoreException if the UID allocated to the user already exists
@@ -681,11 +681,18 @@ class CoreExport User : public Extensible
 
 class CoreExport UserIOHandler : public StreamSocket
 {
+ private:
+        size_t checked_until;
  public:
        LocalUser* const user;
-       UserIOHandler(LocalUser* me) : user(me) {}
+       UserIOHandler(LocalUser* me)
+               : StreamSocket(StreamSocket::SS_USER)
+               , checked_until(0)
+               , user(me)
+       {
+       }
        void OnDataReady() CXX11_OVERRIDE;
-       void OnSetEndPoint(const irc::sockets::sockaddrs& local, const irc::sockets::sockaddrs& remote) CXX11_OVERRIDE;
+       bool OnSetEndPoint(const irc::sockets::sockaddrs& local, const irc::sockets::sockaddrs& remote) CXX11_OVERRIDE;
        void OnError(BufferedSocketError error) CXX11_OVERRIDE;
 
        /** Adds to the user's write buffer.
@@ -780,13 +787,12 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local
         */
        unsigned int lastping:1;
 
-       /** This is true if the user matched an exception (E:Line). It is used to save time on ban checks.
+       /** This is true if the user matched an exception (E-line). It is used to save time on ban checks.
         */
        unsigned int exempt:1;
 
-       /** Used by PING checking code
-        */
-       time_t nping;
+       /** The time at which this user should be pinged next. */
+       time_t nextping;
 
        /** Time that the connection last sent a message, used to calculate idle time
         */
@@ -799,14 +805,14 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local
 
        already_sent_t already_sent;
 
-       /** 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)
+       /** Check if the user matches a G- or K-line, and disconnect them if they do.
+        * @param doZline True if Z-lines should be checked (if IP has changed since initial connect)
         * Returns true if the user matched a ban, false else.
         */
        bool CheckLines(bool doZline = false);
 
        /** Use this method to fully connect a user.
-        * This will send the message of the day, check G/K/E lines, etc.
+        * This will send the message of the day, check G/K/E-lines, etc.
         */
        void FullConnect();
 
@@ -816,9 +822,9 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local
         */
        void SetClass(const std::string &explicit_name = "");
 
-       bool SetClientIP(const std::string& address, bool recheck_eline = true) CXX11_OVERRIDE;
+       bool SetClientIP(const std::string& address) CXX11_OVERRIDE;
 
-       void SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline = true) CXX11_OVERRIDE;
+       void SetClientIP(const irc::sockets::sockaddrs& sa) CXX11_OVERRIDE;
 
        /** Send a NOTICE message from the local server to the user.
         * The message will be sent even if the user is connected to a remote server.
@@ -928,5 +934,6 @@ inline bool User::IsModeSet(UserModeReference& moderef) const
 
 inline void User::SetMode(ModeHandler* mh, bool value)
 {
-       modes[mh->GetId()] = value;
+       if (mh && mh->GetId() != ModeParser::MODEID_MAX)
+               modes[mh->GetId()] = value;
 }