diff --git a/sources/channel/channel.cpp b/sources/channel/channel.cpp index fc0ae6f..0480080 100644 --- a/sources/channel/channel.cpp +++ b/sources/channel/channel.cpp @@ -6,7 +6,7 @@ /* By: sben-tay +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/05/20 22:43:24 by rparodi #+# #+# */ -/* Updated: 2025/06/19 13:46:05 by sben-tay ### ########.fr */ +/* Updated: 2025/06/19 13:58:39 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,7 +17,7 @@ Channel::Channel(const std::string &name, User *owner, size_t maxUsers, bool needInvite) : _name(name), _owner(owner), _maxUsers(maxUsers), _needInvite(needInvite) { this->_protectTopic = false; this->_maxUsers = ~0; - this->_topic = "No topic is set"; + this->_topic = ""; } /** diff --git a/sources/commands/commands.cpp b/sources/commands/commands.cpp index b4be57d..99c4c3c 100644 --- a/sources/commands/commands.cpp +++ b/sources/commands/commands.cpp @@ -6,7 +6,7 @@ /* By: sben-tay +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/05/24 16:11:56 by rparodi #+# #+# */ -/* Updated: 2025/06/19 11:25:46 by rparodi ### ########.fr */ +/* Updated: 2025/06/19 13:02:11 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -38,7 +38,7 @@ * @param line line send by the user */ -std::vector cmd::split(std::string &line) { +std::vector cmd::split(std::string &line, char sep) { std::vector args; size_t start = 0; size_t end; @@ -49,7 +49,7 @@ std::vector cmd::split(std::string &line) { args.push_back(arg); break; } - end = line.find(' ', start); + end = line.find(sep, start); if (end == std::string::npos) end = line.length(); std::string arg = line.substr(start, end - start); @@ -72,7 +72,7 @@ std::vector cmd::split(std::string &line) { * @param line input line from the user */ void cmd::dispatch(::User *user, Channel *channel, Server *server, std::string &line) { - std::vector args = cmd::split(line); + std::vector args = cmd::split(line, ' '); if (args.empty()) { DEBUG_MSG("Empty line"); return; @@ -163,7 +163,7 @@ void cmd::dispatch(::User *user, Channel *channel, Server *server, std::string & cmd::ACommand::ACommand(::User *user, ::Channel *channel, ::Server *server, std::string &line) : _sender(user), _channel(channel), _server(server) { DEBUG_MSG("ACommand constructor called"); - _args = split(line); + _args = split(line, ' '); _command = _args.at(0); _channels = server->getChannelsList(); _users = server->getUsersList();