From c23d09f65084e6088111dc974f0e290b042de89d Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 12 Jun 2013 19:30:15 +0200 Subject: Simplify stringjoiner: take 1 parameter, join from begin() to end() and use space as the sep char --- src/modules/m_cap.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/modules/m_cap.cpp') diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 1d165f935..e5d16a6da 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -74,13 +74,13 @@ class CommandCAP : public Command if (Data.ack.size() > 0) { - std::string AckResult = irc::stringjoiner(" ", Data.ack, 0, Data.ack.size() - 1).GetJoined(); + std::string AckResult = irc::stringjoiner(Data.ack).GetJoined(); user->WriteServ("CAP %s ACK :%s", user->nick.c_str(), AckResult.c_str()); } if (Data.wanted.size() > 0) { - std::string NakResult = irc::stringjoiner(" ", Data.wanted, 0, Data.wanted.size() - 1).GetJoined(); + std::string NakResult = irc::stringjoiner(Data.wanted).GetJoined(); user->WriteServ("CAP %s NAK :%s", user->nick.c_str(), NakResult.c_str()); } } @@ -95,10 +95,7 @@ class CommandCAP : public Command reghold.set(user, 1); Data.Send(); - std::string Result; - if (Data.wanted.size() > 0) - Result = irc::stringjoiner(" ", Data.wanted, 0, Data.wanted.size() - 1).GetJoined(); - + std::string Result = irc::stringjoiner(Data.wanted).GetJoined(); user->WriteServ("CAP %s %s :%s", user->nick.c_str(), subcommand.c_str(), Result.c_str()); } else if (subcommand == "CLEAR") @@ -108,9 +105,7 @@ class CommandCAP : public Command reghold.set(user, 1); Data.Send(); - std::string Result; - if (!Data.ack.empty()) - Result = irc::stringjoiner(" ", Data.ack, 0, Data.ack.size() - 1).GetJoined(); + std::string Result = irc::stringjoiner(Data.ack).GetJoined(); user->WriteServ("CAP %s ACK :%s", user->nick.c_str(), Result.c_str()); } else -- cgit v1.3.1-10-gc9f91