Fixed kick command, doesnt accept empty values #37

Merged
aortigos merged 1 commits from fix-kick-cmd into main 2026-05-25 08:00:12 +00:00

View File

@@ -6,23 +6,10 @@
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/05/25 09:27:35 by aortigos #+# #+# */
/* Updated: 2026/05/25 09:46:13 by aortigos ### ########.fr */
/* Updated: 2026/05/25 09:52:27 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* privmsg.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/05/15 15:35:16 by aortigos #+# #+# */
/* Updated: 2026/05/25 09:25:49 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include "../Server/Server.hpp"
void Server::kick_cmd(User &client, std::istringstream &ss)
@@ -36,6 +23,8 @@ void Server::kick_cmd(User &client, std::istringstream &ss)
if (!client.isRegistered()) return (client.send(":" SERVER_NAME " 451 " + client.getNick() + " :You have not registered\r\n"));
if (channel.empty() || user.empty())
return (client.send(":" SERVER_NAME " 461 " + client.getNick() + " KICK :not enough parameters\r\n"));
if (!reason.empty() && reason[0] == ' ')
reason = reason.substr(1);
if (!reason.empty() && reason[0] == ':')