diff --git a/srcs/channel.cpp b/srcs/channel.cpp index ce3b4de..30aae2c 100644 --- a/srcs/channel.cpp +++ b/srcs/channel.cpp @@ -6,7 +6,7 @@ /* By: vvaas +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/21 10:36:21 by maldavid #+# #+# */ -/* Updated: 2024/02/05 14:52:42 by vvaas ### ########.fr */ +/* Updated: 2024/02/05 16:26:14 by maldavid ### ########.fr */ /* */ /******************************************************************************/ @@ -16,7 +16,6 @@ #include #include #include -#include namespace irc { diff --git a/srcs/message.cpp b/srcs/message.cpp index c5a0615..6166a01 100644 --- a/srcs/message.cpp +++ b/srcs/message.cpp @@ -6,7 +6,7 @@ /* By: vvaas +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/21 11:38:34 by maldavid #+# #+# */ -/* Updated: 2024/02/05 16:09:12 by maldavid ### ########.fr */ +/* Updated: 2024/02/05 16:23:31 by maldavid ### ########.fr */ /* */ /******************************************************************************/ @@ -37,17 +37,23 @@ namespace irc it++; } } - bool isempty = true; - for(std::string::const_iterator it = token.begin(); it != token.end(); ++it) + elems.push_back(token); + for(std::vector::iterator vit = elems.begin(); vit != elems.end();) { - if(!std::isspace(*it)) + bool isempty = true; + for(std::string::const_iterator it = vit->begin(); it != vit->end(); ++it) { - isempty = false; - break; + if(!std::isspace(*it)) + { + isempty = false; + break; + } } + if(isempty) + vit = elems.erase(vit); + else + vit++; } - if(!isempty) - elems.push_back(token); } std::vector split(const std::string& s) @@ -77,11 +83,10 @@ namespace irc if((*it)[0] == ':') it->erase(it->begin()); _reason.append(*it); - _reason.push_back(' '); + if(it != tokens.end() - 1) + _reason.push_back(' '); } } - if (!_reason.empty()) - _reason.erase(_reason.end() - 1); } Message::~Message() {}