+ irc::sockets::sockaddrs server_sa;
+
+ /**
+ * @return The port number of this user.
+ */
+ int GetServerPort();
+
+ /** Recursion fix: user is out of SendQ and will be quit as soon as possible.
+ * This can't be handled normally because QuitUser itself calls Write on other
+ * users, which could trigger their SendQ to overrun.
+ */
+ unsigned int quitting_sendq:1;
+
+ /** True when DNS lookups are completed.
+ * The UserResolver classes res_forward and res_reverse will
+ * set this value once they complete.
+ */
+ unsigned int dns_done:1;
+
+ /** has the user responded to their previous ping?
+ */
+ unsigned int lastping:1;
+
+ /** 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;
+
+ /** Time that the connection last sent a message, used to calculate idle time
+ */
+ time_t idle_lastmsg;
+
+ /** This value contains how far into the penalty threshold the user is.
+ * This is used either to enable fake lag or for excess flood quits
+ */
+ unsigned int CommandFloodPenalty;
+
+ static already_sent_t already_sent_id;
+ already_sent_t already_sent;
+
+ /** Stored reverse lookup from res_forward. Should not be used after resolution.
+ */
+ std::string stored_host;
+
+ /** Starts a DNS lookup of the user's IP.
+ * This will cause two UserResolver classes to be instantiated.
+ * When complete, these objects set User::dns_done to true.
+ */
+ void StartDNSLookup();
+
+ /** 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)
+ * 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.
+ */
+ void FullConnect();
+
+ /** Set the connect class to which this user belongs to.
+ * @param explicit_name Set this string to tie the user to a specific class name. Otherwise, the class is fitted by checking \<connect> tags from the configuration file.
+ * @return A reference to this user's current connect class.
+ */
+ void SetClass(const std::string &explicit_name = "");
+
+ bool SetClientIP(const char* sip, bool recheck_eline = true);
+
+ void SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline = true);
+
+ void SendText(const std::string& line);
+ void Write(const std::string& text);
+ void Write(const char*, ...) CUSTOM_PRINTF(2, 3);
+
+ /** Returns the list of channels this user has been invited to but has not yet joined.
+ * @return A list of channels the user is invited to
+ */
+ InviteList& GetInviteList();
+
+ /** Returns true if a user is invited to a channel.
+ * @param channel A channel to look up
+ * @return True if the user is invited to the given channel
+ */
+ bool IsInvited(Channel* chan) { return (Invitation::Find(chan, this) != NULL); }
+
+ /** Removes a channel from a users invite list.
+ * This member function is called on successfully joining an invite only channel
+ * to which the user has previously been invited, to clear the invitation.
+ * @param channel The channel to remove the invite to
+ * @return True if the user was invited to the channel and the invite was erased, false if the user wasn't invited
+ */
+ bool RemoveInvite(Channel* chan);
+
+ void RemoveExpiredInvites();
+
+ /** Returns true or false for if a user can execute a privilaged oper command.
+ * This is done by looking up their oper type from User::oper, then referencing
+ * this to their oper classes and checking the commands they can execute.
+ * @param command A command (should be all CAPS)
+ * @return True if this user can execute the command
+ */
+ bool HasPermission(const std::string &command);
+
+ /** Returns true if a user has a given permission.
+ * This is used to check whether or not users may perform certain actions which admins may not wish to give to
+ * all operators, yet are not commands. An example might be oper override, mass messaging (/notice $*), etc.
+ *
+ * @param privstr The priv to chec, e.g. "users/override/topic". These are loaded free-form from the config file.
+ * @param noisy If set to true, the user is notified that they do not have the specified permission where applicable. If false, no notification is sent.
+ * @return True if this user has the permission in question.
+ */
+ bool HasPrivPermission(const std::string &privstr, bool noisy = false);
+
+ /** Returns true or false if a user can set a privileged user or channel mode.
+ * This is done by looking up their oper type from User::oper, then referencing
+ * this to their oper classes, and checking the modes they can set.
+ * @param mode The mode the check
+ * @param type ModeType (MODETYPE_CHANNEL or MODETYPE_USER).
+ * @return True if the user can set or unset this mode.
+ */
+ bool HasModePermission(unsigned char mode, ModeType type);