Rework MODE/RPL_CHANMODEIS handling for trailing args (#1661)

Some servers may send a colon even if the last parameter doesn't need it, currently this leads to issues with permission/mode tracking, as the core doesn't handle the colon properly.

This fix replaces reconstructing the parameter string with just passing a vector of the relevant parameters to CChan::SetModes() and adds overrides for CChan::SetModes() and CChan::ModeChange() that accept the vector instead.

Clean up uses of old CModeMessage::GetModes()
This commit is contained in:
Aspen (linudaemon) authored and Alexey Sokolov committed 2019-08-08 21:54:49 +01:00
1 parent 51e82fc7e8
commit 95369455fc
8 files changed
+165 -19

No files matched your search

+20
View File
@@ -267,3 +267,23 @@ void CMessage::InitType() {
}
}
}
VCString CMessage::GetParamsSplit(unsigned int uIdx, unsigned int uLen) const {
VCString splitParams;
const VCString &params = GetParams();
if (params.empty() || uLen == 0 || uIdx >= params.size()) {
return splitParams;
}
if (uLen > params.size() - uIdx - 1) {
uLen = params.size() - uIdx;
}
VCString::const_iterator startIt = params.begin() + uIdx;
VCString::const_iterator endIt = startIt + uLen;
splitParams.assign(startIt, endIt);
return splitParams;
}