fix: Local notifications may appear twice
authorDennis Collaris <redacted>
Tue, 18 Sep 2018 11:37:41 +0000 (13:37 +0200)
committerKyle Fuller <redacted>
Tue, 18 Sep 2018 18:41:29 +0000 (19:41 +0100)
CHANGELOG.md
palaver.cpp

index 1b101b6c3ea0d423e6976d2602aad44444a02624..7a714017d380bfe726d4d5eaee79e781c38d65e6 100644 (file)
@@ -1,5 +1,11 @@
 # Changelog for Palaver ZNC Module
 
+## Master
+
+### Bug Fixes
+
+- Fix issue where local notifications may appear twice.
+
 ## 1.1.1
 
 ### Bug Fixes
index 8bd5a0394ae0f7ba9f4030b68bdef83dc51a85f1..9f689f855b76e2e2e40868986a0095c4dfe28274 100644 (file)
@@ -319,6 +319,19 @@ public:
                return bHasNetwork;
        }
 
+       bool IsNetworkConnected(const CIRCNetwork& network) const {
+               bool bIsConnected = false;
+
+               for (CClient* pClient : network.GetClients()) {
+                       if (pClient && this->HasClient(*pClient)){
+                               bIsConnected = true;
+                               break;
+                       }
+               }
+
+               return bIsConnected;
+       }
+
        bool AddNetworkNamed(const CString& sUsername, const CString& sNetwork, const CString& sNetworkID) {
                bool bDidAddNetwork = false;
 
@@ -1063,7 +1076,7 @@ public:
                        {
                                CDevice& device = **it;
 
-                               if (m_pClient && device.HasClient(*m_pClient)) {
+                               if (device.IsNetworkConnected(*m_pNetwork)) {
                                        continue;
                                }
 
git clone https://git.99rst.org/PROJECT