From: Kyle Fuller Date: Sun, 10 Dec 2017 17:52:04 +0000 (-0800) Subject: refactor: Get hold of the network and user from the client X-Git-Tag: 1.1.1~3 X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=85ec435f12d3590ca7c772e74b710d8fba65bcf9;p=znc-palaver.git refactor: Get hold of the network and user from the client --- diff --git a/palaver.cpp b/palaver.cpp index 8a59243..0eb001b 100644 --- a/palaver.cpp +++ b/palaver.cpp @@ -876,23 +876,25 @@ public: #pragma mark - virtual void OnClientLogin() { + CIRCNetwork *pNetwork = GetClient()->GetNetwork(); + // Associate client with the user/network CDevice *pDevice = DeviceForClient(*m_pClient); - if (pDevice && m_pNetwork) { + if (pDevice && pNetwork) { const CString sNetworkID = pDevice->GetNetworkID(*m_pClient); - if (pDevice->AddNetwork(*m_pNetwork, sNetworkID)) { + if (pDevice->AddNetwork(*pNetwork, sNetworkID)) { Save(); } } - if (m_pNetwork) { + if (pNetwork) { // Let's reset any other devices for this client for (std::vector::const_iterator it = m_vDevices.begin(); it != m_vDevices.end(); ++it) { CDevice& device = **it; - if (device.HasClient(*m_pClient) == false && device.HasNetwork(*m_pNetwork)) { + if (device.HasClient(*m_pClient) == false && device.HasNetwork(*pNetwork)) { device.ClearBadges(*this); } }