fix(cmd/join): patching the parsing of join
This commit is contained in:
parent
32d405f150
commit
fad8d867a5
1 changed files with 4 additions and 4 deletions
|
|
@ -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:23:58 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/17 18:48:08 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,16 +17,16 @@
|
||||||
using namespace cmd;
|
using namespace cmd;
|
||||||
|
|
||||||
e_code Join::checkArgs() {
|
e_code Join::checkArgs() {
|
||||||
if (_args.size() < 2) {
|
if (_args.size() < 2 || _args[1].empty()) {
|
||||||
WARNING_MSG("Not enough arguments for Join command");
|
WARNING_MSG("Not enough arguments for Join command");
|
||||||
return ERR_NEEDMOREPARAMS;
|
return ERR_NEEDMOREPARAMS;
|
||||||
}
|
}
|
||||||
if (_args.at(1).at(0) != '#') {
|
if (_args[1][0] != '#') {
|
||||||
WARNING_MSG("Invalid channel name for Join command");
|
WARNING_MSG("Invalid channel name for Join command");
|
||||||
INFO_MSG("Channel names must start with a '#' character");
|
INFO_MSG("Channel names must start with a '#' character");
|
||||||
return ERR_NOSUCHCHANNEL;
|
return ERR_NOSUCHCHANNEL;
|
||||||
} else
|
} else
|
||||||
_args.at(1).erase(0, 1);
|
_args[1].erase(0, 1);
|
||||||
_cTarget = searchList(_channels, _args.at(1));
|
_cTarget = searchList(_channels, _args.at(1));
|
||||||
if (_cTarget == NULL) {
|
if (_cTarget == NULL) {
|
||||||
WARNING_MSG("Channel not found for Join command");
|
WARNING_MSG("Channel not found for Join command");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue