diff --git a/include/znc/Client.h b/include/znc/Client.h index f7e8568e..37828c1a 100644 --- a/include/znc/Client.h +++ b/include/znc/Client.h @@ -107,6 +107,7 @@ class CClient : public CIRCSocket { m_bCapNotify(false), m_bAwayNotify(false), m_bAccountNotify(false), + m_bAccountTag(false), m_bExtendedJoin(false), m_bNamesx(false), m_bUHNames(false), @@ -148,6 +149,11 @@ class CClient : public CIRCSocket { {true, [this](bool bVal) { m_bAwayNotify = bVal; }}}, {"account-notify", {true, [this](bool bVal) { m_bAccountNotify = bVal; }}}, + {"account-tag", + {true, [this](bool bVal) { + m_bAccountTag = bVal; + SetTagSupport("account", bVal); + }}}, {"extended-join", {true, [this](bool bVal) { m_bExtendedJoin = bVal; }}}, }) { @@ -178,6 +184,7 @@ class CClient : public CIRCSocket { bool HasCapNotify() const { return m_bCapNotify; } bool HasAwayNotify() const { return m_bAwayNotify; } bool HasAccountNotify() const { return m_bAccountNotify; } + bool HasAccountTag() const { return m_bAccountTag; } bool HasExtendedJoin() const { return m_bExtendedJoin; } bool HasNamesx() const { return m_bNamesx; } bool HasUHNames() const { return m_bUHNames; } @@ -346,6 +353,7 @@ class CClient : public CIRCSocket { bool m_bCapNotify; bool m_bAwayNotify; bool m_bAccountNotify; + bool m_bAccountTag; bool m_bExtendedJoin; bool m_bNamesx; bool m_bUHNames; diff --git a/include/znc/IRCSock.h b/include/znc/IRCSock.h index 93ef506c..89e230a5 100644 --- a/include/znc/IRCSock.h +++ b/include/znc/IRCSock.h @@ -150,6 +150,7 @@ class CIRCSock : public CIRCSocket { bool HasUHNames() const { return m_bUHNames; } bool HasAwayNotify() const { return m_bAwayNotify; } bool HasAccountNotify() const { return m_bAccountNotify; } + bool HasAccountTag() const { return m_bAccountTag; } bool HasExtendedJoin() const { return m_bExtendedJoin; } bool HasServerTime() const { return m_bServerTime; } const std::set& GetUserModes() const { @@ -207,6 +208,7 @@ class CIRCSock : public CIRCSocket { bool m_bUHNames; bool m_bAwayNotify; bool m_bAccountNotify; + bool m_bAccountTag; bool m_bExtendedJoin; bool m_bServerTime; CString m_sPerms; diff --git a/src/Client.cpp b/src/Client.cpp index 13048775..94e3dfc1 100644 --- a/src/Client.cpp +++ b/src/Client.cpp @@ -854,6 +854,7 @@ void CClient::ClearServerDependentCaps() { const auto& handler = std::get<1>(it->second); handler(false); } + m_ssAcceptedCaps.erase(sCap); } } diff --git a/src/IRCSock.cpp b/src/IRCSock.cpp index e5868074..aaaab441 100644 --- a/src/IRCSock.cpp +++ b/src/IRCSock.cpp @@ -67,6 +67,7 @@ CIRCSock::CIRCSock(CIRCNetwork* pNetwork) m_bUHNames(false), m_bAwayNotify(false), m_bAccountNotify(false), + m_bAccountTag(false), m_bExtendedJoin(false), m_bServerTime(false), m_sPerms("*!@%+"), @@ -376,6 +377,7 @@ bool CIRCSock::OnCapabilityMessage(CMessage& Message) { {"userhost-in-names", [this](bool bVal) { m_bUHNames = bVal; }}, {"away-notify", [this](bool bVal) { m_bAwayNotify = bVal; }}, {"account-notify", [this](bool bVal) { m_bAccountNotify = bVal; }}, + {"account-tag", [this](bool bVal) { m_bAccountTag = bVal; }}, {"extended-join", [this](bool bVal) { m_bExtendedJoin = bVal; }}, {"server-time", [this](bool bVal) { m_bServerTime = bVal; }}, {"znc.in/server-time-iso", diff --git a/test/ClientTest.cpp b/test/ClientTest.cpp index 87e4446a..08781ffe 100644 --- a/test/ClientTest.cpp +++ b/test/ClientTest.cpp @@ -82,6 +82,23 @@ TEST_F(ClientTest, AccountNotify) { EXPECT_THAT(m_pTestClient->vsLines, ElementsAre(msg.ToString())); } +TEST_F(ClientTest, AccountTag) { + m_pTestSock->ReadLine(":server CAP * ACK :account-tag"); + m_pTestClient->Reset(); + + CMessage msg(":nick!user@host PRIVMSG #channel :text"); + CMessage extmsg("@account=account-name :nick!user@host PRIVMSG #channel :text"); + EXPECT_FALSE(m_pTestClient->HasAccountTag()); + m_pTestClient->PutClient(extmsg); + EXPECT_THAT(m_pTestClient->vsLines, ElementsAre(msg.ToString())); + m_pTestClient->SetAccountTag(true); + m_pTestClient->SetTagSupport("account", true); + EXPECT_TRUE(m_pTestClient->HasAccountTag()); + m_pTestClient->PutClient(extmsg); + EXPECT_THAT(m_pTestClient->vsLines, + ElementsAre(msg.ToString(), extmsg.ToString())); +} + TEST_F(ClientTest, AwayNotify) { CMessage msg(":nick!user@host AWAY :message"); EXPECT_FALSE(m_pTestClient->HasAwayNotify()); diff --git a/test/IRCTest.h b/test/IRCTest.h index 851b589c..3ede27cb 100644 --- a/test/IRCTest.h +++ b/test/IRCTest.h @@ -36,6 +36,7 @@ class TestClient : public CClient { } void Reset() { vsLines.clear(); } void SetAccountNotify(bool bEnabled) { m_bAccountNotify = bEnabled; } + void SetAccountTag(bool bEnabled) { m_bAccountTag = bEnabled; } void SetAwayNotify(bool bEnabled) { m_bAwayNotify = bEnabled; } void SetExtendedJoin(bool bEnabled) { m_bExtendedJoin = bEnabled; } void SetNamesx(bool bEnabled) { m_bNamesx = bEnabled; }