fix(cmds): sending the message ERR_NEEDMOREPARAMS (461)
This commit is contained in:
parent
f84492e175
commit
1c0e771dd5
12 changed files with 40 additions and 27 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/06/08 22:10:24 by sben-tay #+# #+# */
|
/* Created: 2025/06/08 22:10:24 by sben-tay #+# #+# */
|
||||||
/* Updated: 2025/06/14 22:26:07 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/18 12:54:41 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,12 +16,12 @@
|
||||||
using namespace cmd;
|
using namespace cmd;
|
||||||
|
|
||||||
e_code Cap::checkArgs() {
|
e_code Cap::checkArgs() {
|
||||||
if (_args.size() < 2){
|
if (_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;
|
return ERR_NEEDMOREPARAMS;
|
||||||
|
|
||||||
_sender->appendToReadBuffer(_command);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
_sender->appendToReadBuffer(_command);
|
||||||
return (_PARSING_OK);
|
return (_PARSING_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/06/12 13:24:05 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/18 12:52:35 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,7 +18,8 @@ using namespace cmd;
|
||||||
|
|
||||||
e_code Invite::checkArgs() {
|
e_code Invite::checkArgs() {
|
||||||
if (_args.size() < 3) {
|
if (_args.size() < 3) {
|
||||||
WARNING_MSG("Not enough arguments for INVITE command");
|
std::string msg461 = ":localhost 461 " + this->_sender->getNickname() + " " + this->_command + " :Not enough parameters\r\n";
|
||||||
|
this->_sender->appendToWriteBuffer(msg461);
|
||||||
return ERR_NEEDMOREPARAMS;
|
return ERR_NEEDMOREPARAMS;
|
||||||
}
|
}
|
||||||
if (_args.at(1).at(0) != '#') {
|
if (_args.at(1).at(0) != '#') {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/06/18 00:58:16 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/18 12:51:54 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,7 +19,8 @@ using namespace cmd;
|
||||||
|
|
||||||
e_code Join::checkArgs() {
|
e_code Join::checkArgs() {
|
||||||
if (_args.size() < 2 || _args[1].empty()) {
|
if (_args.size() < 2 || _args[1].empty()) {
|
||||||
WARNING_MSG("Not enough arguments for Join command");
|
std::string msg461 = ":localhost 461 " + this->_sender->getNickname() + " " + this->_command + " :Not enough parameters\r\n";
|
||||||
|
this->_sender->appendToWriteBuffer(msg461);
|
||||||
return ERR_NEEDMOREPARAMS;
|
return ERR_NEEDMOREPARAMS;
|
||||||
}
|
}
|
||||||
if (_args[1][0] != '#') {
|
if (_args[1][0] != '#') {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/06/12 13:24:16 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/18 12:55:06 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,7 +18,8 @@ using namespace cmd;
|
||||||
|
|
||||||
e_code Kick::checkArgs() {
|
e_code Kick::checkArgs() {
|
||||||
if (_args.size() < 3) {
|
if (_args.size() < 3) {
|
||||||
WARNING_MSG("Not enough arguments for KICK command");
|
std::string msg461 = ":localhost 461 " + this->_sender->getNickname() + " " + this->_command + " :Not enough parameters\r\n";
|
||||||
|
this->_sender->appendToWriteBuffer(msg461);
|
||||||
return ERR_NEEDMOREPARAMS;
|
return ERR_NEEDMOREPARAMS;
|
||||||
}
|
}
|
||||||
if (_args.at(1).at(0) != '#') {
|
if (_args.at(1).at(0) != '#') {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/06/12 13:24:21 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/18 12:52:13 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,7 +18,8 @@ using namespace cmd;
|
||||||
|
|
||||||
e_code List::checkArgs() {
|
e_code List::checkArgs() {
|
||||||
if (_args.size() < 3) {
|
if (_args.size() < 3) {
|
||||||
WARNING_MSG("Not enough arguments for LIST command");
|
std::string msg461 = ":localhost 461 " + this->_sender->getNickname() + " " + this->_command + " :Not enough parameters\r\n";
|
||||||
|
this->_sender->appendToWriteBuffer(msg461);
|
||||||
return ERR_NEEDMOREPARAMS;
|
return ERR_NEEDMOREPARAMS;
|
||||||
}
|
}
|
||||||
if (this->_sender->isRegistered() == false) {
|
if (this->_sender->isRegistered() == false) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
/* 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
|
* @return return the e_code if there is an error else return _PARSING_OK
|
||||||
*/
|
*/
|
||||||
e_code Mode::checkArgs() {
|
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;
|
return ERR_NEEDMOREPARAMS;
|
||||||
|
}
|
||||||
if (this->_args.at(1).at(0) != '#') {
|
if (this->_args.at(1).at(0) != '#') {
|
||||||
WARNING_MSG("Invalid channel name for INVITE command");
|
WARNING_MSG("Invalid channel name for INVITE command");
|
||||||
INFO_MSG("Channel names must start with a '#' character");
|
INFO_MSG("Channel names must start with a '#' character");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/06/12 13:24:35 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/18 12:56:37 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,7 +18,8 @@ using namespace cmd;
|
||||||
|
|
||||||
e_code Notice::checkArgs() {
|
e_code Notice::checkArgs() {
|
||||||
if (_args.size() < 3) {
|
if (_args.size() < 3) {
|
||||||
WARNING_MSG("Not enough arguments for NOTICE command");
|
std::string msg461 = ":localhost 461 " + this->_sender->getNickname() + " " + this->_command + " :Not enough parameters\r\n";
|
||||||
|
this->_sender->appendToWriteBuffer(msg461);
|
||||||
return ERR_NEEDMOREPARAMS;
|
return ERR_NEEDMOREPARAMS;
|
||||||
}
|
}
|
||||||
if (_args.at(1).at(0) != '#') {
|
if (_args.at(1).at(0) != '#') {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/06/12 13:24:39 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/18 12:55:38 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,7 +19,8 @@ using namespace cmd;
|
||||||
|
|
||||||
e_code Part::checkArgs() {
|
e_code Part::checkArgs() {
|
||||||
if (_args.size() < 2) {
|
if (_args.size() < 2) {
|
||||||
WARNING_MSG("Not enough arguments for PART command");
|
std::string msg461 = ":localhost 461 " + this->_sender->getNickname() + " " + this->_command + " :Not enough parameters\r\n";
|
||||||
|
this->_sender->appendToWriteBuffer(msg461);
|
||||||
return ERR_NEEDMOREPARAMS;
|
return ERR_NEEDMOREPARAMS;
|
||||||
}
|
}
|
||||||
if (_args.at(1).at(0) != '#') {
|
if (_args.at(1).at(0) != '#') {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/06/16 17:33:20 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/18 12:55:50 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,7 +18,8 @@ using namespace cmd;
|
||||||
|
|
||||||
e_code Pass::checkArgs() {
|
e_code Pass::checkArgs() {
|
||||||
if (_args.size() != 2) {
|
if (_args.size() != 2) {
|
||||||
WARNING_MSG("Not correct for Pass command");
|
std::string msg461 = ":localhost 461 " + this->_sender->getNickname() + " " + this->_command + " :Not enough parameters\r\n";
|
||||||
|
this->_sender->appendToWriteBuffer(msg461);
|
||||||
return ERR_NEEDMOREPARAMS;
|
return ERR_NEEDMOREPARAMS;
|
||||||
}
|
}
|
||||||
return _PARSING_OK;
|
return _PARSING_OK;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/06/17 16:58:06 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/18 12:53:01 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,7 +20,8 @@ using namespace cmd;
|
||||||
|
|
||||||
e_code Ping::checkArgs() {
|
e_code Ping::checkArgs() {
|
||||||
if (_args.size() < 2) {
|
if (_args.size() < 2) {
|
||||||
WARNING_MSG("Not enough arguments for PING command");
|
std::string msg461 = ":localhost 461 " + this->_sender->getNickname() + " " + this->_command + " :Not enough parameters\r\n";
|
||||||
|
this->_sender->appendToWriteBuffer(msg461);
|
||||||
return ERR_NEEDMOREPARAMS;
|
return ERR_NEEDMOREPARAMS;
|
||||||
}
|
}
|
||||||
return _PARSING_OK;
|
return _PARSING_OK;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/06/18 00:56:49 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/18 12:51:56 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -21,7 +21,8 @@ using namespace cmd;
|
||||||
|
|
||||||
e_code PrivMsg::checkArgs() {
|
e_code PrivMsg::checkArgs() {
|
||||||
if (_args.size() < 3) {
|
if (_args.size() < 3) {
|
||||||
WARNING_MSG("Not enough arguments for PRIVMSG command");
|
std::string msg461 = ":localhost 461 " + this->_sender->getNickname() + " " + this->_command + " :Not enough parameters\r\n";
|
||||||
|
this->_sender->appendToWriteBuffer(msg461);
|
||||||
return ERR_NEEDMOREPARAMS;
|
return ERR_NEEDMOREPARAMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/06/08 19:16:10 by sben-tay #+# #+# */
|
/* Created: 2025/06/08 19:16:10 by sben-tay #+# #+# */
|
||||||
/* Updated: 2025/06/17 23:17:54 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/18 12:56:17 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,7 +17,8 @@ using namespace cmd;
|
||||||
|
|
||||||
e_code cmd::userCmd::checkArgs() {
|
e_code cmd::userCmd::checkArgs() {
|
||||||
if (_args.size() < 5) {
|
if (_args.size() < 5) {
|
||||||
WARNING_MSG("USER: Not enough parameters");
|
std::string msg461 = ":localhost 461 " + this->_sender->getNickname() + " " + this->_command + " :Not enough parameters\r\n";
|
||||||
|
this->_sender->appendToWriteBuffer(msg461);
|
||||||
return ERR_NEEDMOREPARAMS;
|
return ERR_NEEDMOREPARAMS;
|
||||||
}
|
}
|
||||||
return _PARSING_OK;
|
return _PARSING_OK;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue