AAAAAAAAAAAAAAAAAAAAAAAAAAAh

This commit is contained in:
Kbz-8
2024-02-05 16:26:22 +01:00
parent 3638fb92eb
commit 56a6d23581
2 changed files with 17 additions and 13 deletions

View File

@@ -6,7 +6,7 @@
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/21 10:36:21 by maldavid #+# #+# */ /* 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 <errorscode.hpp> #include <errorscode.hpp>
#include <cstdlib> #include <cstdlib>
#include <unstd/string.hpp> #include <unstd/string.hpp>
#include <iostream>
namespace irc namespace irc
{ {

View File

@@ -6,7 +6,7 @@
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/21 11:38:34 by maldavid #+# #+# */ /* 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++; it++;
} }
} }
bool isempty = true; elems.push_back(token);
for(std::string::const_iterator it = token.begin(); it != token.end(); ++it) for(std::vector<std::string>::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; if(!std::isspace(*it))
break; {
isempty = false;
break;
}
} }
if(isempty)
vit = elems.erase(vit);
else
vit++;
} }
if(!isempty)
elems.push_back(token);
} }
std::vector<std::string> split(const std::string& s) std::vector<std::string> split(const std::string& s)
@@ -77,11 +83,10 @@ namespace irc
if((*it)[0] == ':') if((*it)[0] == ':')
it->erase(it->begin()); it->erase(it->begin());
_reason.append(*it); _reason.append(*it);
_reason.push_back(' '); if(it != tokens.end() - 1)
_reason.push_back(' ');
} }
} }
if (!_reason.empty())
_reason.erase(_reason.end() - 1);
} }
Message::~Message() {} Message::~Message() {}