gg
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/21 10:35:52 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/24 18:42:31 by vvaas ### ########.fr */
|
||||
/* Updated: 2024/01/25 20:24:16 by vvaas ### ########.fr */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -28,13 +28,14 @@ namespace irc
|
||||
void Client::sendCode(const std::string& code, const std::string& msg)
|
||||
{
|
||||
const std::string command = code + " :" + msg;
|
||||
//logs::report(log_message, "C<-%s", command.c_str());
|
||||
logs::report(log_message, "C<-%s", command.c_str());
|
||||
if(send(_fd, command.c_str(), command.size(), 0) != static_cast<ssize_t>(command.length()))
|
||||
logs::report(log_error, "server failed to send a code to '%s' (:sadge:)", _username.c_str());
|
||||
}
|
||||
|
||||
void Client::sendPlainText(const std::string& str)
|
||||
{
|
||||
logs::report(log_message,"<- S %s", str.c_str());
|
||||
if(send(_fd, str.c_str(), str.length(), 0) != static_cast<ssize_t>(str.length()))
|
||||
logs::report(log_error, "server failed to send a message to '%s' (:sadge:)", _username.c_str());
|
||||
}
|
||||
@@ -42,7 +43,7 @@ namespace irc
|
||||
void Client::sendMsg(const std::string& sender, const std::string& cmd, const std::string& trailing)
|
||||
{
|
||||
const std::string out = ':' + sender + ' ' + cmd + " :" + trailing + "\r\n";
|
||||
//logs::report(log_message,"<- S %s", out.c_str());
|
||||
logs::report(log_message,"<- S %s", out.c_str());
|
||||
if(send(_fd, out.c_str(), out.length(), 0) != static_cast<ssize_t>(out.length()))
|
||||
logs::report(log_error, "server failed to send a message from '%s' to '%s' (:sadge:)", sender.c_str(), _username.c_str());
|
||||
}
|
||||
@@ -56,6 +57,7 @@ namespace irc
|
||||
vsnprintf(buffer, LOGS_BUFFER_SIZE, message.c_str(), al);
|
||||
va_end(al);
|
||||
|
||||
logs::report(log_message,"<- S %s", buffer);
|
||||
if (send(_fd, buffer, std::strlen(buffer), 0) < static_cast<ssize_t>(std::strlen(buffer)))
|
||||
logs::report(log_error, "server failed to send a message to '%s'", _nickname.c_str());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user