33 bool _isAuthenticated;
37 bool _isMarkedForDisconnect;
Represents an IRC client connected to the server.
std::time_t _lastPingSentTime
Timestamp of the last PING sent to the client.
void setNickname(const std::string &nickname)
Sets the client's nickname.
const std::string & getSendBuffer() const
Gets the client's send buffer content.
void setUsername(const std::string &username)
Sets the client's username.
bool isRegistered() const
Checks if the client is registered.
const std::vector< Channel * > & getChannels() const
Gets the list of channels the client is in.
void removeChannel(Channel *channel)
Removes a channel from the client's list of joined channels.
static const size_t MAX_SENDBUFF_SIZE
Maximum size of the send buffer (1MB).
void clearPingSentTime()
Clears the last PING sent time, indicating no PING is currently pending a PONG. This should be called...
const std::string & getRealname() const
Gets the client's real name.
std::string getPrefix() const
Generates the client's IRC prefix (e.g., :nick!user@host).
void setRealname(const std::string &realname)
Sets the client's real name.
void updateActivityTime()
Updates the client's last activity time to the current time.
std::time_t getLastActivityTime() const
Gets the timestamp of the client's last activity.
bool isAuthenticated() const
Checks if the client is authenticated.
void appendBuffer(const std::string &data)
Appends data to the client's receive buffer.
virtual void sendMessage(const std::string &message) const
Sends a message to the client by appending it to the send buffer.
const std::string & getNickname() const
Gets the client's nickname.
virtual ~Client()
Destroys the Client object.
void setLastPingSentTime(std::time_t time)
Sets the timestamp of the last PING sent to the client.
const std::string & getHostname() const
Gets the client's hostname.
std::time_t getLastPingSentTime() const
Gets the timestamp of the last PING sent to the client.
const std::string & getUsername() const
Gets the client's username.
void addChannel(Channel *channel)
Adds a channel to the client's list of joined channels.
void markForDisconnect(const std::string &message)
Marks the client for disconnection with a specified message.
const std::string & getQuitMessage() const
Gets the client's quit message.
void appendToSendBuffer(const std::string &data)
Appends data to the client's send buffer.
bool isMarkedForDisconnect() const
Checks if the client is marked for disconnection.
std::string readLineFromBuffer()
Reads a single line from the receive buffer.
std::time_t _lastActivityTime
Timestamp of the last activity from the client.
int getFd() const
Gets the client's file descriptor.
void removeSentData(size_t bytes_sent)
Removes a specified number of bytes from the beginning of the send buffer.
void setRegistered(bool value)
Sets the client's registration status.
void setAuthenticated(bool value)
Sets the client's authentication status.