petit fix

This commit is contained in:
jcheca 2024-06-05 12:11:48 +02:00
parent ad3f0bae39
commit 489263b521
20 changed files with 10 additions and 9 deletions

View File

@ -183,10 +183,10 @@ inline std::string RPL_ENDOFINVITELIST(Client *client, const std::string& channe
return oss.str();
}
inline std::string RPL_INVITING(Client* client, const std::string& channel)
inline std::string RPL_INVITING(Client* client, Client* clientTarget, const std::string& channel)
{
std::ostringstream oss;
oss << ":" << SERVER_NAME << " 341 " << CLIENT_NICK(client) << " " << CLIENT_NICK(client) << " " << channel << "\r\n";
oss << ":" << SERVER_NAME << " 341 " << CLIENT_NICK(client) << " " << CLIENT_NICK(clientTarget) << " " << channel << "\r\n";
return oss.str();
}
@ -215,7 +215,7 @@ inline std::string RPL_WHOREPLY(const std::string& channel, Client* target)
{
std::ostringstream oss;
oss << ":" << SERVER_NAME << " 352 " << CLIENT_NICK(target) << " " << channel << " "
<< CLIENT_USER(target) << " " << CLIENT_HOST(target) << " " << SERVER_NAME << " "
<< CLIENT_USER(target) << " " << CLIENT_HOST(target) << SERVER_NAME << " "
<< CLIENT_NICK(target) << " H :0 " << CLIENT_REALNAME(target) << "\r\n";
return oss.str();
}
@ -508,7 +508,7 @@ inline std::string ERR_INVALIDMODEPARAM(Client* client, const std::string& param
inline std::string RPL_PONG(const std::string& token)
{
std::ostringstream oss;
oss << ":" << SERVER_NAME << " PONG " << SERVER_NAME << " " << token << "\r\n";
oss << ":" << SERVER_NAME << " PONG " << SERVER_NAME << " :" << token << "\r\n";
return oss.str();
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -107,6 +107,8 @@ void AdditionalCommands::handlePartCommand(Server *server, Client *client, const
partMsg << ":" << client->getNickname() << " PART " << channelName << "\r\n";
server->sendToClient(client->getFd(), partMsg.str());
channel->broadcast(partMsg.str(), client, server);
if (channel->isEmpty())
{
delete channel;

View File

@ -268,9 +268,8 @@ void CommandHandler::handlePingCommand(Client* client, const std::vector<std::st
return;
}
std::string serverName = tokens[1];
std::string pongMessage = ":" + serverName + " PONG " + serverName + "\r\n";
_server->sendToClient(client->getFd(), pongMessage);
std::string latence = tokens[1];
_server->sendToClient(client->getFd(), RPL_PONG(latence));
}

View File

@ -39,7 +39,7 @@ void InviteHandler::handleInviteCommand(Client* client, const std::string& comma
return;
}
if (!channel->isOperator(client) && channel->isInviteOnly())
if (!channel->isOperator(client))
{
_server->sendToClient(client->getFd(), ERR_CHANOPRIVSNEEDED(client, channelName));
return;
@ -59,7 +59,7 @@ void InviteHandler::handleInviteCommand(Client* client, const std::string& comma
}
channel->addInvitedClient(targetClient);
_server->sendToClient(client->getFd(), RPL_INVITING(client, channel->getName()));
_server->sendToClient(client->getFd(), RPL_INVITING(client, targetClient, channel->getName()));
std::ostringstream inviteMsg;
inviteMsg << ":" << client->getNickname() << " INVITE " << nickname << " " << channelName << "\r\n";