From 721d6033833cb960ff3b62f66ef6bc7d82cde878 Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Sat, 28 Jul 2012 00:07:46 +0700 Subject: [PATCH 1/2] Support messages directed to specific user prefixes Closes #195 --- include/znc/IRCNetwork.h | 2 +- src/IRCNetwork.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/znc/IRCNetwork.h b/include/znc/IRCNetwork.h index bcedb9af..20127580 100644 --- a/include/znc/IRCNetwork.h +++ b/include/znc/IRCNetwork.h @@ -67,7 +67,7 @@ public: bool PutModule(const CString& sModule, const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL); const std::vector& GetChans() const; - CChan* FindChan(const CString& sName) const; + CChan* FindChan(CString sName) const; bool AddChan(CChan* pChan); bool AddChan(const CString& sName, bool bInConfig); bool DelChan(const CString& sName); diff --git a/src/IRCNetwork.cpp b/src/IRCNetwork.cpp index 0124daf5..78eb9f23 100644 --- a/src/IRCNetwork.cpp +++ b/src/IRCNetwork.cpp @@ -606,7 +606,11 @@ bool CIRCNetwork::PutModule(const CString& sModule, const CString& sLine, CClien const vector& CIRCNetwork::GetChans() const { return m_vChans; } -CChan* CIRCNetwork::FindChan(const CString& sName) const { +CChan* CIRCNetwork::FindChan(CString sName) const { + if (GetIRCSock()) { + sName.TrimLeft(GetIRCSock()->GetPerms()); + } + for (unsigned int a = 0; a < m_vChans.size(); a++) { CChan* pChan = m_vChans[a]; if (sName.Equals(pChan->GetName())) { From 8a44c872725f468a593aa892dab5282ead38798d Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Thu, 24 Nov 2011 16:45:04 +0000 Subject: [PATCH 2/2] Don't require CTimer's label to be unique if its empty (Fixes #92) --- src/Modules.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Modules.cpp b/src/Modules.cpp index 668ac6b3..a21c936e 100644 --- a/src/Modules.cpp +++ b/src/Modules.cpp @@ -233,7 +233,7 @@ bool CModule::ClearNV(bool bWriteToDisk) { } bool CModule::AddTimer(CTimer* pTimer) { - if ((!pTimer) || (FindTimer(pTimer->GetName()))) { + if ((!pTimer) || (!pTimer->GetName().empty() && FindTimer(pTimer->GetName()))) { delete pTimer; return false; } @@ -280,6 +280,10 @@ bool CModule::UnlinkTimer(CTimer* pTimer) { } CTimer* CModule::FindTimer(const CString& sLabel) { + if (sLabel.empty()) { + return NULL; + } + set::iterator it; for (it = m_sTimers.begin(); it != m_sTimers.end(); ++it) { CTimer* pTimer = *it;