fix(cmds): sending the message ERR_NEEDMOREPARAMS (461)

This commit is contained in:
Raphael 2025-06-18 12:58:04 +02:00
parent f84492e175
commit 1c0e771dd5
12 changed files with 40 additions and 27 deletions

View file

@ -6,7 +6,7 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
/* Updated: 2025/06/17 18:00:26 by rparodi ### ########.fr */
/* Updated: 2025/06/18 12:53:44 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -74,8 +74,11 @@ void Mode::checkMode() {
* @return return the e_code if there is an error else return _PARSING_OK
*/
e_code Mode::checkArgs() {
if (this->_args.size() < 2)
if (this->_args.size() < 2) {
std::string msg461 = ":localhost 461 " + this->_sender->getNickname() + " " + this->_command + " :Not enough parameters\r\n";
this->_sender->appendToWriteBuffer(msg461);
return ERR_NEEDMOREPARAMS;
}
if (this->_args.at(1).at(0) != '#') {
WARNING_MSG("Invalid channel name for INVITE command");
INFO_MSG("Channel names must start with a '#' character");