]> git.ipfire.org Git - people/stevee/guardian.git/commitdiff
Update event handler settings on reload.
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 13 Jul 2016 12:21:46 +0000 (14:21 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Wed, 13 Jul 2016 12:21:46 +0000 (14:21 +0200)
The values for BlockCount and BlockTime now will be
updated when performing a reload.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
guardian.in
modules/Events.pm

index bbf4eb5d5036243b1ef71027910f8ce4b6a2b3b4..c52b832a23a96fe9f4db6737c79795b17af03ffe 100644 (file)
@@ -395,6 +395,9 @@ sub Reload () {
        # Update logger object in mainsettings hash.
        $mainsettings{Logger} = $logger;
 
        # Update logger object in mainsettings hash.
        $mainsettings{Logger} = $logger;
 
+       # Update Event handler.
+       $events->Update(\%mainsettings);
+
        # Update ignore list.
        &ReloadIgnoreList();
 
        # Update ignore list.
        &ReloadIgnoreList();
 
index f8437deedbf594d13dd1a34d4367b2dd23e33d61..ec253c05d33526db1b9b13302f6dfcccde87b574 100644 (file)
@@ -80,6 +80,34 @@ sub Init (%) {
        return $self;
 }
 
        return $self;
 }
 
+#
+## The "Update" Block settings function.
+#
+## This object based function is called to update various class settings.
+#
+sub Update (\%) {
+        my $self = shift;
+
+       # Dereference the given hash-ref and store
+       # the values into a new temporary hash.
+       my %settings = %{ $_[0] };
+
+       # Skip settings update if some essential settings are missing.
+       unless ((exists($settings{BlockCount})) && (exists($settings{BlockTime}))) {
+               $logger->Log("err", "Values for BlockCount or BlockTime are missing, keeping previously configured settings.");
+
+               # Return unmodified class object.
+               return $self;
+       }
+
+       # Change settings.
+        $self->{BlockCount} = $settings{BlockCount};
+       $self->{BlockTime} = $settings{BlockTime};
+
+       # Return modified class object.
+        return $self;
+}
+
 #
 ## The main "CheckAction" function.
 #
 #
 ## The main "CheckAction" function.
 #