From ceeebf746b31e973695fd78a129fe49310b520cd Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sun, 25 Sep 2011 02:35:37 +0700 Subject: [PATCH] Fix CUser::IsUserAttached(). It honored only clients connected without any network. Thanks to Cronus` for reporting this. --- User.cpp | 14 ++++++++++++++ User.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/User.cpp b/User.cpp index ec39937ff8..17a91706b6 100644 --- a/User.cpp +++ b/User.cpp @@ -991,6 +991,20 @@ CString CUser::MakeCleanUserName(const CString& sUserName) { return sUserName.Token(0, false, "@").Replace_n(".", ""); } +bool CUser::IsUserAttached() const { + if (!m_vClients.empty()) { + return true; + } + + for (vector::const_iterator i = m_vIRCNetworks.begin(); i != m_vIRCNetworks.end(); ++i) { + if ((*i)->IsUserAttached()) { + return true; + } + } + + return false; +} + // Setters void CUser::SetNick(const CString& s) { m_sNick = s; } void CUser::SetAltNick(const CString& s) { m_sAltNick = s; } diff --git a/User.h b/User.h index 02773e3a8d..8cc15f7de0 100644 --- a/User.h +++ b/User.h @@ -81,7 +81,7 @@ class CUser { bool PutModule(const CString& sModule, const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL); bool PutModNotice(const CString& sModule, const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL); - bool IsUserAttached() const { return !m_vClients.empty(); } + bool IsUserAttached() const; void UserConnected(CClient* pClient); void UserDisconnected(CClient* pClient);