Skip to content

Commit

Permalink
Fix support for /msg @#chan :hi
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DarthGandalf committed Aug 29, 2013
1 parent 7454331 commit d5e03cb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/znc/IRCSock.h
Expand Up @@ -102,6 +102,7 @@ class CIRCSock : public CZNCSock {
bool IsAuthed() const { return m_bAuthed; } bool IsAuthed() const { return m_bAuthed; }
bool IsCapAccepted(const CString& sCap) { return 1 == m_ssAcceptedCaps.count(sCap); } bool IsCapAccepted(const CString& sCap) { return 1 == m_ssAcceptedCaps.count(sCap); }
const MCString& GetISupport() const { return m_mISupport; } const MCString& GetISupport() const { return m_mISupport; }
CString GetISupport(const CString& sKey, const CString& sDefault = "") const;
// !Getters // !Getters


// This handles NAMESX and UHNAMES in a raw 353 reply // This handles NAMESX and UHNAMES in a raw 353 reply
Expand Down
3 changes: 2 additions & 1 deletion src/IRCNetwork.cpp
Expand Up @@ -624,7 +624,8 @@ const vector<CChan*>& CIRCNetwork::GetChans() const { return m_vChans; }


CChan* CIRCNetwork::FindChan(CString sName) const { CChan* CIRCNetwork::FindChan(CString sName) const {
if (GetIRCSock()) { 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++) { for (unsigned int a = 0; a < m_vChans.size(); a++) {
Expand Down
9 changes: 9 additions & 0 deletions src/IRCSock.cpp
Expand Up @@ -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 { void CIRCSock::ForwardRaw353(const CString& sLine) const {
vector<CClient*>& vClients = m_pNetwork->GetClients(); vector<CClient*>& vClients = m_pNetwork->GetClients();
vector<CClient*>::iterator it; vector<CClient*>::iterator it;
Expand Down

0 comments on commit d5e03cb

Please sign in to comment.