From d5e03cb73612e43322652c4ab64283667613f838 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Thu, 29 Aug 2013 22:31:25 +0400 Subject: [PATCH] Fix support for /msg @#chan :hi 005 STATUSMSG defines list of characters prependable to channel name, but we used simple modes instead. See https://tools.ietf.org/html/draft-brocklesby-irc-isupport-03#section-3.16 Fix #272 Thanks to grawity for the link to 005 docs draft, and to carrot for testing the patch. --- include/znc/IRCSock.h | 1 + src/IRCNetwork.cpp | 3 ++- src/IRCSock.cpp | 9 +++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/znc/IRCSock.h b/include/znc/IRCSock.h index 12382229..9faac95a 100644 --- a/include/znc/IRCSock.h +++ b/include/znc/IRCSock.h @@ -102,6 +102,7 @@ public: bool IsAuthed() const { return m_bAuthed; } bool IsCapAccepted(const CString& sCap) { return 1 == m_ssAcceptedCaps.count(sCap); } const MCString& GetISupport() const { return m_mISupport; } + CString GetISupport(const CString& sKey, const CString& sDefault = "") const; // !Getters // This handles NAMESX and UHNAMES in a raw 353 reply diff --git a/src/IRCNetwork.cpp b/src/IRCNetwork.cpp index 63fe059f..94208c3f 100644 --- a/src/IRCNetwork.cpp +++ b/src/IRCNetwork.cpp @@ -624,7 +624,8 @@ const vector& CIRCNetwork::GetChans() const { return m_vChans; } CChan* CIRCNetwork::FindChan(CString sName) const { if (GetIRCSock()) { - sName.TrimLeft(GetIRCSock()->GetPerms()); + // See https://tools.ietf.org/html/draft-brocklesby-irc-isupport-03#section-3.16 + sName.TrimLeft(GetIRCSock()->GetISupport("STATUSMSG", "")); } for (unsigned int a = 0; a < m_vChans.size(); a++) { diff --git a/src/IRCSock.cpp b/src/IRCSock.cpp index 198c0bb3..f9a394a1 100644 --- a/src/IRCSock.cpp +++ b/src/IRCSock.cpp @@ -1211,6 +1211,15 @@ void CIRCSock::ParseISupport(const CString& sLine) { } } +CString CIRCSock::GetISupport(const CString& sKey, const CString& sDefault) const { + MCString::const_iterator i = m_mISupport.find(sKey.AsUpper()); + if (i == m_mISupport.end()) { + return sDefault; + } else { + return i->second; + } +} + void CIRCSock::ForwardRaw353(const CString& sLine) const { vector& vClients = m_pNetwork->GetClients(); vector::iterator it;