mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Filter out server-dependent caps in CAP NEW using blacklist too
This commit is contained in:
@@ -1070,7 +1070,7 @@ void CClient::SetTagSupport(const CString& sTag, bool bState) {
|
||||
}
|
||||
|
||||
void CClient::NotifyServerDependentCap(const CString& sCap, bool bValue, const CString& sValue) {
|
||||
if (bValue) {
|
||||
if (bValue && !CZNC::Get().GetClientCapBlacklist().count(sCap)) {
|
||||
if (HasCapNotify()) {
|
||||
if (HasCap302() && !sValue.empty()) {
|
||||
PutClient(":irc.znc.in CAP " + GetNick() + " NEW :" + sCap + "=" + sValue);
|
||||
|
||||
@@ -1111,6 +1111,7 @@ TEST_F(ZNCTest, DisableCap) {
|
||||
QTextStream out(&conf);
|
||||
out << R"(
|
||||
DisableClientCap = sasl
|
||||
DisableClientCap = away-notify
|
||||
DisableServerCap = chghost
|
||||
)";
|
||||
}
|
||||
@@ -1126,6 +1127,19 @@ TEST_F(ZNCTest, DisableCap) {
|
||||
ASSERT_THAT(client.ReadRemainder().toStdString(), Not(HasSubstr("sasl")));
|
||||
client.Write("CAP REQ sasl");
|
||||
client.ReadUntil("CAP foo NAK :sasl");
|
||||
|
||||
client.Write("PASS :hunter2");
|
||||
client.Write("USER user/test x x :x");
|
||||
client.Write("CAP END");
|
||||
client.ReadUntil("001");
|
||||
|
||||
// Server-dependent
|
||||
ircd.Write("001 nick Welcome");
|
||||
ircd.Write("CAP nick NEW away-notify");
|
||||
ircd.ReadUntil("CAP REQ :away-notify");
|
||||
ircd.Write("CAP nick ACK away-notify");
|
||||
ASSERT_THAT(client.ReadRemainder().toStdString(),
|
||||
Not(AllOf(HasSubstr("NEW"), HasSubstr("away-notify"))));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user