Skip to content

Commit

Permalink
fix(privmsg): parser
Browse files Browse the repository at this point in the history
  • Loading branch information
jdomingu98 committed Apr 23, 2024
1 parent b463144 commit 99392ea
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/parser/PrivateMessageParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@
*/
ACommand* PrivateMessageParser::parse(const std::vector<std::string>& tokens) {
std::vector<std::string> 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]);
}

0 comments on commit 99392ea

Please sign in to comment.