From 3ceae3ad26d9406f8e905b602e090de8631db3e9 Mon Sep 17 00:00:00 2001 From: RealKindOne Date: Mon, 20 Jul 2026 04:33:04 -0400 Subject: [PATCH] Fix part/join not working when a client sends '/cycle' or '/hop' command. --- src/Client.cpp | 1 + test/integration/tests/core.cpp | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/Client.cpp b/src/Client.cpp index de5311a1..f51e8371 100644 --- a/src/Client.cpp +++ b/src/Client.cpp @@ -1592,6 +1592,7 @@ bool CClient::OnPartMessage(CPartMessage& Message) { PutStatusNotice(t_f("Removing channel {1}")(sChan)); m_pNetwork->DelChan(sChan); } else { + if (pChan) pChan->SetIsOn(false); sChans += (sChans.empty()) ? sChan : CString("," + sChan); } } diff --git a/test/integration/tests/core.cpp b/test/integration/tests/core.cpp index 6038126a..4169b687 100644 --- a/test/integration/tests/core.cpp +++ b/test/integration/tests/core.cpp @@ -1316,5 +1316,28 @@ TEST_F(ZNCTest, JoinDetachedChannelMultiClient) { client2.ReadUntil(":other!user@host QUIT :quit message"); } +// Commit ad7bd6d7eed84648638e1b6fd69546b9fe496576 +// prevented rejoining when a client cycles a channel. +TEST_F(ZNCTest, ClientCycleChannels) { + auto znc = Run(); + auto ircd = ConnectIRCd(); + auto client = LoginClient(); + + ircd.Write(":server 001 nick :Hello"); + client.Write("JOIN #test"); + ircd.ReadUntil("JOIN #test"); + + ircd.Write(":nick JOIN :#test"); + ircd.Write(":server 353 nick #test :nick"); + ircd.Write(":server 366 nick #test :End of /NAMES list"); + client.ReadUntil("End of /NAMES"); + + // Clients have '/hop' or '/cycle' command that sends + // 'PART #channel' and 'JOIN #channel'. Verify ZNC rejoins.. + client.Write(":nick PART #test"); + client.Write(":nick JOIN #test"); + ircd.ReadUntil("JOIN #test"); +} + } // namespace } // namespace znc_inttest