Make CMessage::ToString() use GetParams()

Avoids having the same loop in two places.

GetParams() was under consideration to be removed after the CMessage
porting work is done, but it's starting to look like it's here to stay.
There are cases, such as mode messages, where "get all params starting
from position N" is handy.
This commit is contained in:
J-P Nurmi
2015-09-20 01:52:10 +02:00
parent ecb9b21055
commit 658db6bbe6

View File

@@ -151,14 +151,11 @@ CString CMessage::ToString(unsigned int uFlags) const
}
// <params>
unsigned uParams = m_vsParams.size();
for (unsigned int uIdx = 0; uIdx < uParams; ++uIdx) {
const CString& sParam = m_vsParams[uIdx];
sMessage += " ";
if (uIdx == uParams - 1 && (m_bColon || sParam.empty() || sParam.StartsWith(":") || sParam.Contains(" "))) {
sMessage += ":";
if (!m_vsParams.empty()) {
if (!sMessage.empty()) {
sMessage += " ";
}
sMessage += sParam;
sMessage += GetParams(0);
}
return sMessage;