From 99392eaabbf70f9749fc99fc888ffca4abc2f5cd Mon Sep 17 00:00:00 2001 From: jdomingu98 Date: Tue, 23 Apr 2024 18:58:05 +0200 Subject: [PATCH] fix(privmsg): parser --- src/parser/PrivateMessageParser.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/parser/PrivateMessageParser.cpp b/src/parser/PrivateMessageParser.cpp index 5130fec..622b49e 100644 --- a/src/parser/PrivateMessageParser.cpp +++ b/src/parser/PrivateMessageParser.cpp @@ -16,16 +16,12 @@ */ ACommand* PrivateMessageParser::parse(const std::vector& tokens) { std::vector receivers; - std::string message; - if (tokens.size() < 2 || tokens[1][0] == ':') + if (tokens.size() < 2) throw NoRecipientGivenException("PRIVMSG"); receivers = split(tokens[1], ','); - if (tokens.size() < 3 || tokens[2][0] != ':') + if (tokens.size() < 3) throw NoTextToSendException(); - message = tokens[2].substr(1); - for (size_t i = 2; i < tokens.size(); i++) - message += " " + tokens[i]; - return new PrivateMessageCommand(receivers, message); + return new PrivateMessageCommand(receivers, tokens[2]); }