Stop ZNC from prepending '#' if missing in join command.

Fixes #1794
This commit is contained in:
RealKindOne committed 2026-09-13 14:20:36 -04:00
1 parent 18f304e6a4
commit d6c2c32de8
2 files changed
+25 -2

No files matched your search

+2 -2
View File
@@ -375,7 +375,7 @@ void CClient::AuthUser() {
}
}
/** Username+password auth, which reports success/failure to client via SASL. */
/** Username+password auth, which reports success/failure to client via SASL. */
class CClientSASLAuth : public CClientAuth {
public:
using CClientAuth::CClientAuth;
@@ -1463,7 +1463,7 @@ bool CClient::OnJoinMessage(CJoinMessage& Message) {
else
pChan->JoinUser(sKey);
continue;
} else if (!sChannel.empty()) {
} else if (!sChannel.empty() && m_pNetwork->IsChan(sChannel)) {
pChan = new CChan(sChannel, m_pNetwork, false);
if (m_pNetwork->AddChan(pChan)) {
pChan->SetKey(sKey);
+23
View File
@@ -1463,5 +1463,28 @@ TEST_F(ZNCTest, MotdBufferDoesNotAccumulate376) {
Not(HasSubstr("End of /MOTD command")));
}
// https://github.com/znc/znc/issues/1794
TEST_F(ZNCTest, PrependJoinBug) {
auto znc = Run();
auto ircd = ConnectIRCd();
auto client = LoginClient();
ircd.Write(":server 001 nick :Hello");
ircd.Write(":server 005 nick CHANTYPES=# :supports");
client.ReadUntil("005");
client.Write("JOIN 0");
ircd.ReadUntil("JOIN 0");
client.Write("znc listchans");
ASSERT_THAT(client.ReadRemainder().toStdString(), Not(HasSubstr("#0")));
client.Write("JOIN test");
ircd.ReadUntil("JOIN test");
client.Write("znc listchans");
ASSERT_THAT(client.ReadRemainder().toStdString(), Not(HasSubstr("#test")));
}
} // namespace
} // namespace znc_inttest