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(); 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; 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(); return oss.str();
} }
@ -215,7 +215,7 @@ inline std::string RPL_WHOREPLY(const std::string& channel, Client* target)
{ {
std::ostringstream oss; std::ostringstream oss;
oss << ":" << SERVER_NAME << " 352 " << CLIENT_NICK(target) << " " << channel << " " 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"; << CLIENT_NICK(target) << " H :0 " << CLIENT_REALNAME(target) << "\r\n";
return oss.str(); 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) inline std::string RPL_PONG(const std::string& token)
{ {
std::ostringstream oss; std::ostringstream oss;
oss << ":" << SERVER_NAME << " PONG " << SERVER_NAME << " " << token << "\r\n"; oss << ":" << SERVER_NAME << " PONG " << SERVER_NAME << " :" << token << "\r\n";
return oss.str(); 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"; partMsg << ":" << client->getNickname() << " PART " << channelName << "\r\n";
server->sendToClient(client->getFd(), partMsg.str()); server->sendToClient(client->getFd(), partMsg.str());
channel->broadcast(partMsg.str(), client, server);
if (channel->isEmpty()) if (channel->isEmpty())
{ {
delete channel; delete channel;

View File

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

View File

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