Fix a wrong cached /mode reply

ZNC replies to /mode #chan with the cached channel modes without querying the
IRCd. This was added to avoid traffic spikes to the ircd when a client
logged in.

The logic in this code had a bug that made it also reply with stale cached
values if we once were but aren't anymore in that channel (e.g. after
you've been kicked).

Thanks to tomaw for reporting this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1507 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-05-11 16:16:10 +00:00
parent 1a859f3806
commit bc77d8b261

View File

@@ -284,7 +284,10 @@ void CClient::ReadLine(const CString& sData) {
if (m_pUser->IsChan(sTarget)) {
CChan *pChan = m_pUser->FindChan(sTarget);
if (pChan && sModes.empty() && !pChan->GetModeString().empty()) {
// If we are on that channel and already received a
// /mode reply from the server, we can answer this
// request ourself.
if (pChan && pChan->IsOn() && sModes.empty() && !pChan->GetModeString().empty()) {
PutClient(":" + m_pUser->GetIRCServer() + " 324 " + GetNick() + " " + sTarget + " " + pChan->GetModeString());
if (pChan->GetCreationDate() > 0) {
PutClient(":" + m_pUser->GetIRCServer() + " 329 " + GetNick() + " " + sTarget + " " + CString(pChan->GetCreationDate()));