summaryrefslogtreecommitdiff
path: root/protocols/IRCG
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-09 19:32:32 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-09 19:32:39 +0300
commitdf6b0c988eb26339d4c7e4a1d0fe3b9717703c28 (patch)
tree5b4960edd6c9186e1fbc14f83f7f08a6a842f0a7 /protocols/IRCG
parent303dd9297732fc943ed3e20ab37587f0c009dfe5 (diff)
more loop-related code cleaning
Diffstat (limited to 'protocols/IRCG')
-rw-r--r--protocols/IRCG/src/output.cpp38
1 files changed, 12 insertions, 26 deletions
diff --git a/protocols/IRCG/src/output.cpp b/protocols/IRCG/src/output.cpp
index fe0c8b97f4..0e8bc3ff0b 100644
--- a/protocols/IRCG/src/output.cpp
+++ b/protocols/IRCG/src/output.cpp
@@ -21,39 +21,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-static CMStringW FormatOutput(const CIrcMessage* pmsg)
+static CMStringW FormatOutput(const CIrcMessage *pmsg)
{
CMStringW sMessage;
if (pmsg->m_bIncoming) { // Is it an incoming message?
if (pmsg->sCommand == L"WALLOPS" && pmsg->parameters.getCount() > 0) {
sMessage.Format(TranslateT("WallOps from %s: "), pmsg->prefix.sNick.c_str());
- for (int i = 0; i < pmsg->parameters.getCount(); i++) {
- sMessage += pmsg->parameters[i];
- if (i != pmsg->parameters.getCount() - 1)
- sMessage += L" ";
- }
+ for (auto &it : pmsg->parameters)
+ sMessage += *it + L" ";
goto THE_END;
}
if (pmsg->sCommand == L"INVITE" && pmsg->parameters.getCount() > 1) {
sMessage.Format(TranslateT("%s invites you to %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
- for (int i = 2; i < pmsg->parameters.getCount(); i++) {
- sMessage += L": " + pmsg->parameters[i];
- if (i != pmsg->parameters.getCount() - 1)
- sMessage += L" ";
- }
+ for (int i = 2; i < pmsg->parameters.getCount(); i++)
+ sMessage += L": " + pmsg->parameters[i] + L" ";
goto THE_END;
}
int index = _wtoi(pmsg->sCommand.c_str());
if (index == 301 && pmsg->parameters.getCount() > 0) {
sMessage.Format(TranslateT("%s is away"), pmsg->parameters[1].c_str());
- for (int i = 2; i < pmsg->parameters.getCount(); i++) {
- sMessage += L": " + pmsg->parameters[i];
- if (i != pmsg->parameters.getCount() - 1)
- sMessage += L" ";
- }
+ for (int i = 2; i < pmsg->parameters.getCount(); i++)
+ sMessage += L": " + pmsg->parameters[i] + L" ";
goto THE_END;
}
@@ -62,11 +53,8 @@ static CMStringW FormatOutput(const CIrcMessage* pmsg)
if (index == 303) { // ISON command
sMessage = TranslateT("These are online: ");
- for (int i = 1; i < pmsg->parameters.getCount(); i++) {
- sMessage += pmsg->parameters[i];
- if (i != pmsg->parameters.getCount() - 1)
- sMessage += L", ";
- }
+ for (int i = 1; i < pmsg->parameters.getCount(); i++)
+ sMessage += pmsg->parameters[i] + L", ";
goto THE_END;
}
@@ -88,11 +76,8 @@ static CMStringW FormatOutput(const CIrcMessage* pmsg)
}
else {
sMessage.Format(TranslateT("Notice to %s: "), pmsg->parameters[0].c_str());
- for (int i = 1; i < pmsg->parameters.getCount(); i++) {
- sMessage += pmsg->parameters[i];
- if (i != pmsg->parameters.getCount() - 1)
- sMessage += L" ";
- }
+ for (int i = 1; i < pmsg->parameters.getCount(); i++)
+ sMessage += pmsg->parameters[i] + L" ";
}
goto THE_END;
}
@@ -116,6 +101,7 @@ static CMStringW FormatOutput(const CIrcMessage* pmsg)
}
THE_END:
+ sMessage.TrimRight();
return sMessage;
}