refactor: Get hold of the network and user from the client
authorKyle Fuller <redacted>
Sun, 10 Dec 2017 17:52:04 +0000 (09:52 -0800)
committerKyle Fuller <redacted>
Sun, 10 Dec 2017 17:52:04 +0000 (09:52 -0800)
palaver.cpp

index 8a592432ab92b159ff8c0cb0e6e0b7d0b1bae9bc..0eb001bfbd800bd50fbbc1a87505f66f5b2116ea 100644 (file)
@@ -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<CDevice*>::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);
                                }
                        }
git clone https://git.99rst.org/PROJECT