|
ft_irc 1.0
|
Represents an IRC client connected to the server. [詳解]
#include <Client.hpp>

公開メンバ関数 | |
| Client (int fd, const std::string &hostname) | |
| Constructs a new Client object. | |
| virtual | ~Client () |
| Destroys the Client object. | |
| int | getFd () const |
| Gets the client's file descriptor. | |
| const std::string & | getNickname () const |
| Gets the client's nickname. | |
| const std::string & | getUsername () const |
| Gets the client's username. | |
| const std::string & | getHostname () const |
| Gets the client's hostname. | |
| bool | isAuthenticated () const |
| Checks if the client is authenticated. | |
| bool | isRegistered () const |
| Checks if the client is registered. | |
| std::string | getPrefix () const |
| Generates the client's IRC prefix (e.g., :nick!user@host). | |
| bool | isMarkedForDisconnect () const |
| Checks if the client is marked for disconnection. | |
| const std::string & | getQuitMessage () const |
| Gets the client's quit message. | |
| const std::string & | getRealname () const |
| Gets the client's real name. | |
| const std::string & | getSendBuffer () const |
| Gets the client's send buffer content. | |
| const std::vector< Channel * > & | getChannels () const |
| Gets the list of channels the client is in. | |
| std::time_t | getLastActivityTime () const |
| Gets the timestamp of the client's last activity. | |
| std::time_t | getLastPingSentTime () const |
| Gets the timestamp of the last PING sent to the client. | |
| void | setNickname (const std::string &nickname) |
| Sets the client's nickname. | |
| void | setUsername (const std::string &username) |
| Sets the client's username. | |
| void | setRealname (const std::string &realname) |
| Sets the client's real name. | |
| void | setAuthenticated (bool value) |
| Sets the client's authentication status. | |
| void | setRegistered (bool value) |
| Sets the client's registration status. | |
| void | markForDisconnect (const std::string &message) |
| Marks the client for disconnection with a specified message. | |
| void | addChannel (Channel *channel) |
| Adds a channel to the client's list of joined channels. | |
| void | removeChannel (Channel *channel) |
| Removes a channel from the client's list of joined channels. | |
| void | updateActivityTime () |
| Updates the client's last activity time to the current time. | |
| void | setLastPingSentTime (std::time_t time) |
| Sets the timestamp of the last PING sent to the client. | |
| void | clearPingSentTime () |
| Clears the last PING sent time, indicating no PING is currently pending a PONG. This should be called when a valid PONG response is received from the client. | |
| void | appendBuffer (const std::string &data) |
| Appends data to the client's receive buffer. | |
| void | appendToSendBuffer (const std::string &data) |
| Appends data to the client's send buffer. | |
| std::string | readLineFromBuffer () |
| Reads a single line from the receive buffer. | |
| void | removeSentData (size_t bytes_sent) |
| Removes a specified number of bytes from the beginning of the send buffer. | |
| virtual void | sendMessage (const std::string &message) const |
| Sends a message to the client by appending it to the send buffer. | |
静的公開変数類 | |
| static const size_t | MAX_SENDBUFF_SIZE = 1024 * 1024 |
| Maximum size of the send buffer (1MB). | |
限定公開変数類 | |
| std::time_t | _lastActivityTime |
| Timestamp of the last activity from the client. | |
| std::time_t | _lastPingSentTime |
| Timestamp of the last PING sent to the client. | |
Represents an IRC client connected to the server.
This class manages the state and attributes of a single IRC client, including its file descriptor, nickname, username, hostname, authentication and registration status, and communication buffers. It also tracks the client's activity and ping times.
Client.hpp の 25 行目に定義があります。
| Client::Client | ( | int | fd, |
| const std::string & | hostname | ||
| ) |
Constructs a new Client object.
| fd | The client's file descriptor. |
| hostname | The client's hostname. |
Client.cpp の 15 行目に定義があります。
|
virtual |
Destroys the Client object.
Client.cpp の 20 行目に定義があります。
| void Client::addChannel | ( | Channel * | channel | ) |
Adds a channel to the client's list of joined channels.
| channel | A pointer to the Channel object. |
Client.cpp の 73 行目に定義があります。
| void Client::appendBuffer | ( | const std::string & | data | ) |
| void Client::appendToSendBuffer | ( | const std::string & | data | ) |
| void Client::clearPingSentTime | ( | ) |
Clears the last PING sent time, indicating no PING is currently pending a PONG. This should be called when a valid PONG response is received from the client.
Client.cpp の 91 行目に定義があります。
| const std::vector< Channel * > & Client::getChannels | ( | ) | const |
Gets the list of channels the client is in.
Client.cpp の 43 行目に定義があります。
| int Client::getFd | ( | ) | const |
| const std::string & Client::getHostname | ( | ) | const |
| time_t Client::getLastActivityTime | ( | ) | const |
Gets the timestamp of the client's last activity.
Client.cpp の 45 行目に定義があります。
| time_t Client::getLastPingSentTime | ( | ) | const |
Gets the timestamp of the last PING sent to the client.
Client.cpp の 47 行目に定義があります。
| const std::string & Client::getNickname | ( | ) | const |
| std::string Client::getPrefix | ( | ) | const |
Generates the client's IRC prefix (e.g., :nick!user@host).
Client.cpp の 50 行目に定義があります。
| const std::string & Client::getQuitMessage | ( | ) | const |
| const std::string & Client::getRealname | ( | ) | const |
| const std::string & Client::getSendBuffer | ( | ) | const |
| const std::string & Client::getUsername | ( | ) | const |
| bool Client::isAuthenticated | ( | ) | const |
Checks if the client is authenticated.
Client.cpp の 31 行目に定義があります。
| bool Client::isMarkedForDisconnect | ( | ) | const |
Checks if the client is marked for disconnection.
Client.cpp の 35 行目に定義があります。
| bool Client::isRegistered | ( | ) | const |
Checks if the client is registered.
Client.cpp の 33 行目に定義があります。
| void Client::markForDisconnect | ( | const std::string & | message | ) |
Marks the client for disconnection with a specified message.
| message | The quit message. |
Client.cpp の 68 行目に定義があります。
| std::string Client::readLineFromBuffer | ( | ) |
Reads a single line from the receive buffer.
Client.cpp の 118 行目に定義があります。
| void Client::removeChannel | ( | Channel * | channel | ) |
Removes a channel from the client's list of joined channels.
| channel | A pointer to the Channel object. |
Client.cpp の 83 行目に定義があります。
| void Client::removeSentData | ( | size_t | bytes_sent | ) |
Removes a specified number of bytes from the beginning of the send buffer.
| bytes_sent | The number of bytes to remove. |
Client.cpp の 109 行目に定義があります。
|
virtual |
Sends a message to the client by appending it to the send buffer.
| message | The message to send. |
Client.cpp の 135 行目に定義があります。
| void Client::setAuthenticated | ( | bool | value | ) |
Sets the client's authentication status.
| value | True for authenticated, false otherwise. |
Client.cpp の 64 行目に定義があります。
| void Client::setLastPingSentTime | ( | std::time_t | time | ) |
Sets the timestamp of the last PING sent to the client.
| time | The new timestamp. |
Client.cpp の 89 行目に定義があります。
| void Client::setNickname | ( | const std::string & | nickname | ) |
Sets the client's nickname.
| nickname | The new nickname. |
Client.cpp の 58 行目に定義があります。
| void Client::setRealname | ( | const std::string & | realname | ) |
| void Client::setRegistered | ( | bool | value | ) |
Sets the client's registration status.
| value | True for registered, false otherwise. |
Client.cpp の 66 行目に定義があります。
| void Client::setUsername | ( | const std::string & | username | ) |
| void Client::updateActivityTime | ( | ) |
Updates the client's last activity time to the current time.
Client.cpp の 87 行目に定義があります。
|
protected |
Timestamp of the last activity from the client.
Client.hpp の 43 行目に定義があります。
|
protected |
Timestamp of the last PING sent to the client.
Client.hpp の 44 行目に定義があります。
|
static |
Maximum size of the send buffer (1MB).
Client.hpp の 27 行目に定義があります。