Add IsParting() flag to track PART commands waiting IRCd response.

Fixes potential desync where ZNC marks channel as parted before server
confirms the PART, which could cause issues if the server never replies.

Add unittests and integration tests.
This commit is contained in:
RealKindOne
2026-07-21 03:24:38 -04:00
parent 3ceae3ad26
commit a0d58c8fed
6 changed files with 154 additions and 5 deletions
+3 -1
View File
@@ -30,6 +30,7 @@ CChan::CChan(const CString& sName, CIRCNetwork* pNetwork, bool bInConfig,
CConfig* pConfig)
: m_bDetached(false),
m_bIsOn(false),
m_bParting(false),
m_bAutoClearChanBuffer(pNetwork->GetUser()->AutoClearChanBuffer()),
m_bInConfig(bInConfig),
m_bDisabled(false),
@@ -84,6 +85,7 @@ CChan::~CChan() { ClearNicks(); }
void CChan::Reset() {
m_bIsOn = false;
m_bParting = false;
m_bModeKnown = false;
m_mcsModes.clear();
m_sTopic = "";
@@ -143,7 +145,7 @@ void CChan::JoinUser(const CString& sKey) {
if (!IsOn() && !sKey.empty()) {
SetKey(sKey);
}
if (m_pNetwork->IsIRCConnected() && !IsOn()) {
if (m_pNetwork->IsIRCConnected() && (!IsOn() || IsParting())) {
m_pNetwork->PutIRC("JOIN " + GetName() + " " + GetKey());
}
}