Fix processing of multi-token CAP ACK

I broke it in 5943bc9ed9 while fixing #1950
This commit is contained in:
Alexey Sokolov
2025-05-11 18:35:05 +01:00
parent cc1333fd5e
commit aaeab22ea3
3 changed files with 14 additions and 11 deletions
+9 -7
View File
@@ -450,17 +450,19 @@ bool CIRCSock::OnCapabilityMessage(CMessage& Message) {
}
}
} else if (sSubCmd == "ACK") {
sArgs.Trim();
IRCSOCKMODULECALL(OnServerCapResult(sArgs, true), NOTHING);
auto it = mSupportedCaps.find(sArgs);
if (it != mSupportedCaps.end()) {
it->second(true);
VCString vsCaps;
sArgs.Split(" ", vsCaps, false);
for (CString& sCap : vsCaps) {
IRCSOCKMODULECALL(OnServerCapResult(sCap, true), NOTHING);
auto it = mSupportedCaps.find(sCap);
if (it != mSupportedCaps.end()) {
it->second(true);
}
m_ssAcceptedCaps.insert(std::move(sCap));
}
m_ssAcceptedCaps.insert(sArgs);
} else if (sSubCmd == "NAK") {
// This should work because there's no [known]
// capability with length of name more than 100 characters.
sArgs.Trim();
VCString vsCaps;
sArgs.Split(" ", vsCaps, false);
if (vsCaps.size() == 1) {