diff --git a/src/Client.cpp b/src/Client.cpp index a5020dd8..a2f65fa0 100644 --- a/src/Client.cpp +++ b/src/Client.cpp @@ -1469,7 +1469,7 @@ bool CClient::OnJoinMessage(CJoinMessage& Message) { if (pChan) { if (pChan->IsDetached()) pChan->AttachUser(this); - else if (!pChan->IsOn() || pChan->IsParting()) + else pChan->JoinUser(sKey); continue; } else if (!sChannel.empty()) { diff --git a/test/integration/tests/core.cpp b/test/integration/tests/core.cpp index aab1cc8d..a99730c7 100644 --- a/test/integration/tests/core.cpp +++ b/test/integration/tests/core.cpp @@ -1316,6 +1316,22 @@ TEST_F(ZNCTest, JoinDetachedChannelMultiClient) { client2.ReadUntil(":other!user@host QUIT :quit message"); } +// Goguma does this +TEST_F(ZNCTest, ClientRejoiningJoinedChannel) { + auto znc = Run(); + auto ircd = ConnectIRCd(); + auto client = LoginClient(); + + ircd.Write(":server 001 nick :Hello"); + client.Write("JOIN #test"); + ircd.ReadUntil(":nick JOIN #test"); + + client.Write("JOIN #test"); + client.Write("JOIN #test"); + client.Write("JOIN #test"); + ASSERT_THAT(ircd.ReadRemainder().toStdString(), Not(HasSubstr("JOIN"))); +} + // Commit ad7bd6d7eed84648638e1b6fd69546b9fe496576 // prevented rejoining when a client cycles a channel. TEST_F(ZNCTest, ClientCycleChannel) { @@ -1337,9 +1353,7 @@ TEST_F(ZNCTest, ClientCycleChannel) { client.Write(":nick PART #test"); // Verify PART is forwarded to server - QByteArray partMsg; - ircd.ReadUntilAndGet("PART", partMsg); - EXPECT_THAT(partMsg.toStdString(), HasSubstr("PART #test")); + ircd.ReadUntil("PART #test"); ircd.Write(":nick PART #test"); client.ReadUntil(":nick PART #test"); @@ -1405,9 +1419,7 @@ TEST_F(ZNCTest, PartWithError442) { client.ReadUntil(":nick JOIN :#test"); client.Write("PART #test :leaving"); - QByteArray partMsg; - ircd.ReadUntilAndGet("PART", partMsg); - EXPECT_THAT(partMsg.toStdString(), HasSubstr("PART #test")); + ircd.ReadUntil("PART #test"); // Server returns 442 error (ERR_NOTONCHANNEL) instead of confirming ircd.Write(":server 442 nick #test :You're not on that channel");