Implements checks for SQLite recipient queue push return

This commit is contained in:
Simone Mainardi 2020-09-01 11:15:07 +02:00
parent ddf2970843
commit 7b7f2f193b
3 changed files with 26 additions and 15 deletions

View file

@ -13,6 +13,7 @@ local sqlite_recipients = {}
function sqlite_recipients:create()
-- Instance of the base class
local _sqlite_recipients = recipients:create()
self.enabled = true -- Toggle this to skip dispatch and processing of notifications
-- Subclass using the base class instance
self.key = "sqlite"
@ -27,22 +28,28 @@ end
-- ##############################################
function sqlite_recipients:dispatch_store_notification(notification)
ntop.pushSqliteAlert(notification)
return true
if self.enabled then
return ntop.pushSqliteAlert(notification)
end
return false
end
-- ##############################################
function sqlite_recipients:dispatch_release_notification(notification)
ntop.pushSqliteAlert(notification)
return true
if self.enabled then
return ntop.pushSqliteAlert(notification)
end
return false
end
-- ##############################################
function sqlite_recipients:process_notifications()
if(not areAlertsEnabled()) then
return(false)
if not self.enabled or not areAlertsEnabled() then
return false
end
-- SQLite Alerts