From 22bc2a6fa1481dfbf6fdeb397ac81d3bc1798dd9 Mon Sep 17 00:00:00 2001 From: psychon Date: Sat, 1 Aug 2009 08:59:06 +0000 Subject: [PATCH] Send a "remove all user mode" MODE to clients when we lose the irc connections Without this we could cause a client desync (ZNC still got the correct information). Bug reported by tomaw and patch provided by flakes, thanks. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1583 726aef4b-f618-498e-8847-2d620e286838 --- IRCSock.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/IRCSock.cpp b/IRCSock.cpp index eb210328..69f456b8 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -830,6 +830,19 @@ void CIRCSock::Disconnected() { m_pUser->ClearMotdBuffer(); ResetChans(); + + // send a "reset user modes" cmd to the client. + // otherwise, on reconnect, it might think it still + // had user modes that it actually doesn't have. + CString sUserMode; + for (set::const_iterator it = m_scUserModes.begin(); it != m_scUserModes.end(); it++) { + sUserMode += *it; + } + if (!sUserMode.empty()) { + m_pUser->PutUser(":" + m_pUser->GetIRCNick().GetNickMask() + " MODE " + m_pUser->GetIRCNick().GetNick() + " :-" + sUserMode); + } + + // also clear the user modes in our space: m_scUserModes.clear(); }