Permalink
Browse files

Added default ban time if ripecheck.bantime is not set

  • Loading branch information...
1 parent d1d773c commit 71367d81512124b88d981da6c4f81238d72bd1c1 @Ratler committed Mar 2, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 ripecheck.tcl
View
@@ -283,7 +283,8 @@ namespace eval ::ripecheck {
%domain% $htopdom \
%tld% $htopdom \
%country% $country]
- set bantime [channel get $channel ripecheck.bantime]
+ set bantime [::ripecheck::getBanTime $channel]
+
if {[info exists ::ripecheck::config(bantopreason!$htopdom)]} {
set banreason [::ripecheck::templateReplace $::ripecheck::config(bantopreason!$htopdom) $template]
} elseif {[info exists ::ripecheck::config(bantopreason)]} {
@@ -359,7 +360,7 @@ namespace eval ::ripecheck {
proc ripecheck { ip host nick channel orghost ripe } {
::ripecheck::debug "Entering ripecheck()"
- set bantime [channel get $channel ripecheck.bantime]
+ set bantime [::ripecheck::getBanTime $channel]
if {(![channel get $channel ripecheck.whitelist] && [lsearch -exact $::ripecheck::chanarr($channel) $ripe] != -1) || \
([channel get $channel ripecheck.whitelist] && [lsearch -exact $::ripecheck::chanarr($channel) $ripe] == -1)} {
::ripecheck::debug "ripecheck() matched '$ripe'"
@@ -394,6 +395,15 @@ namespace eval ::ripecheck {
::ripecheck::writeSettings
}
+ # Function that return bantime, if not set a default value of 120 minutes is returned
+ proc getBanTime { channel } {
+ set bantime [channel get $channel ripecheck.bantime]
+ if {$bantime == 0} {
+ set bantime 120
+ }
+ return $bantime
+ }
+
proc getBanCount { channel } {
if {![info exists ::ripecheck::bancount($channel)]} {
return 0

0 comments on commit 71367d8

Please sign in to comment.