mirror of
https://github.com/Ladebeze66/ft_irc.git
synced 2026-11-09 13:17:13 +01:00
miseajour
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/15 12:15:42 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/05/21 18:03:09 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/05/28 14:09:24 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -35,6 +35,12 @@ public:
|
||||
void authenticate();
|
||||
bool isOperator() const;
|
||||
void setOperator(bool isOperator);
|
||||
|
||||
// Ajout des méthodes pour la gestion du statut "away"
|
||||
bool isAway() const;
|
||||
const std::string &getAwayMessage() const;
|
||||
void setAwayMessage(const std::string &message);
|
||||
void setAway(bool away);
|
||||
|
||||
private:
|
||||
int _fd;
|
||||
@@ -45,6 +51,9 @@ private:
|
||||
std::string _realname;
|
||||
bool _authenticated;
|
||||
bool _operator;
|
||||
bool _away;
|
||||
std::string _awayMessage;
|
||||
};
|
||||
|
||||
#endif // CLIENT_HPP
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/19 15:12:47 by fgras-ca #+# #+# */
|
||||
/* Updated: 2024/05/28 11:20:17 by fgras-ca ### ########.fr */
|
||||
/* Updated: 2024/05/28 13:56:19 by fgras-ca ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -71,6 +71,12 @@ inline std::string RPL_ISUPPORT(Client* client, const std::string& tokens) {
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
inline std::string RPL_AWAY(int clientFd, const std::string& target, const std::string& message) {
|
||||
std::ostringstream oss;
|
||||
oss << ":" << SERVER_NAME << " 301 " << clientFd << " " << target << " :" << message << "\r\n";
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
// WHOIS Command RPLs
|
||||
inline std::string RPL_WHOISUSER(int clientFd, Client* target)
|
||||
{
|
||||
@@ -193,6 +199,12 @@ inline std::string ERR_NOSUCHCHANNEL(int clientFd, const std::string& channel)
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
inline std::string ERR_CANNOTSENDTOCHAN(int clientFd, const std::string& channel) {
|
||||
std::ostringstream oss;
|
||||
oss << ":" << SERVER_NAME << " 404 " << clientFd << " " << channel << " :Cannot send to channel\r\n";
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
inline std::string ERR_TOOMANYCHANNELS(Client* client, const std::string& channel) {
|
||||
std::ostringstream oss;
|
||||
oss << ":" << SERVER_NAME << " 405 " << CLIENT_NICK(client) << " " << channel << " :You have joined too many channels\r\n";
|
||||
@@ -207,6 +219,18 @@ inline std::string ERR_NOORIGIN(Client* client)
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
inline std::string ERR_NORECIPIENT(int clientFd, const std::string& command) {
|
||||
std::ostringstream oss;
|
||||
oss << ":" << SERVER_NAME << " 411 " << clientFd << " :No recipient given (" << command << ")\r\n";
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
inline std::string ERR_NOTEXTTOSEND(int clientFd) {
|
||||
std::ostringstream oss;
|
||||
oss << ":" << SERVER_NAME << " 412 " << clientFd << " :No text to send\r\n";
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
inline std::string ERR_UNKNOWNCOMMAND(Client* client, const std::string& command) {
|
||||
std::ostringstream oss;
|
||||
oss << ":" << SERVER_NAME << " 421 " << CLIENT_NICK(client) << " " << command << " :Unknown command\r\n";
|
||||
@@ -241,6 +265,12 @@ inline std::string ERR_NICKNAMEINUSE(Client* client, const std::string& nickname
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
inline std::string ERR_NOTONCHANNEL(int clientFd, const std::string& channel) {
|
||||
std::ostringstream oss;
|
||||
oss << ":" << SERVER_NAME << " 442 " << clientFd << " " << channel << " :You're not on that channel\r\n";
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
inline std::string ERR_NOTREGISTERED(Client* client)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@@ -331,14 +361,6 @@ inline std::string RPL_CAP(int clientFd, const std::string& subcommand, const st
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
// ERR_NOTREGISTERED
|
||||
inline std::string ERR_NOTREGISTERED(int clientFd)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << ":" << SERVER_NAME << " 451 " << clientFd << " :You have not registered\r\n";
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
inline std::string RPL_PASSACCEPTED(Client* client)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
||||
Reference in New Issue
Block a user