|
@@ -5,12 +5,11 @@
|
|
|
############################# IDLE TCL ##############################
|
|
############################# IDLE TCL ##############################
|
|
|
#########################################################################
|
|
#########################################################################
|
|
|
## ##
|
|
## ##
|
|
|
-## BlackTools : http://blacktools.tclscripts.net ##
|
|
|
|
|
-## Bugs report : http://www.tclscripts.net/ ##
|
|
|
|
|
-## GitHub page : https://github.com/tclscripts/BlackToolS-TCL-script ##
|
|
|
|
|
-## Online Help : irc://irc.undernet.org/tcl-help ##
|
|
|
|
|
-## #TCL-HELP / UnderNet ##
|
|
|
|
|
-## You can ask in english or romanian ##
|
|
|
|
|
|
|
+## BlackTools : http://blacktools.tclscripts.net ##
|
|
|
|
|
+## Bugs report : http://www.tclscripts.net/ ##
|
|
|
|
|
+## Online Help : irc://irc.undernet.org/tcl-help ##
|
|
|
|
|
+## #TCL-HELP / UnderNet ##
|
|
|
|
|
+## You can ask in english or romanian ##
|
|
|
## ##
|
|
## ##
|
|
|
#########################################################################
|
|
#########################################################################
|
|
|
|
|
|
|
@@ -52,34 +51,49 @@ if {![onchan $botnick $chan]} {
|
|
|
switch $why {
|
|
switch $why {
|
|
|
|
|
|
|
|
+o {
|
|
+o {
|
|
|
- antidle:set $chan
|
|
|
|
|
setting:set $chan +idleop ""
|
|
setting:set $chan +idleop ""
|
|
|
blacktools:tell $nick $host $hand $chan $chan1 idle.11 none
|
|
blacktools:tell $nick $host $hand $chan $chan1 idle.11 none
|
|
|
|
|
+foreach tmr [timers] {
|
|
|
|
|
+if {[string match "*antidle:module*" [join [lindex $tmr 1]]]} {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+ set idle_time [time_return_minute $black(idleinterval)]
|
|
|
|
|
+ timer $idle_time antidle:module
|
|
|
}
|
|
}
|
|
|
-o {
|
|
-o {
|
|
|
setting:set $chan -idleop ""
|
|
setting:set $chan -idleop ""
|
|
|
blacktools:tell $nick $host $hand $chan $chan1 idle.12 none
|
|
blacktools:tell $nick $host $hand $chan $chan1 idle.12 none
|
|
|
- antidle:unset $chan
|
|
|
|
|
}
|
|
}
|
|
|
-ho {
|
|
-ho {
|
|
|
setting:set $chan -idlehalfop ""
|
|
setting:set $chan -idlehalfop ""
|
|
|
blacktools:tell $nick $host $hand $chan $chan1 idle.26 none
|
|
blacktools:tell $nick $host $hand $chan $chan1 idle.26 none
|
|
|
- antidle:unset $chan
|
|
|
|
|
}
|
|
}
|
|
|
+v {
|
|
+v {
|
|
|
- antidle:set $chan
|
|
|
|
|
setting:set $chan +idlevoice ""
|
|
setting:set $chan +idlevoice ""
|
|
|
blacktools:tell $nick $host $hand $chan $chan1 idle.14 none
|
|
blacktools:tell $nick $host $hand $chan $chan1 idle.14 none
|
|
|
|
|
+foreach tmr [timers] {
|
|
|
|
|
+if {[string match "*antidle:module*" [join [lindex $tmr 1]]]} {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+ set idle_time [time_return_minute $black(idleinterval)]
|
|
|
|
|
+ timer $idle_time antidle:module
|
|
|
}
|
|
}
|
|
|
+ho {
|
|
+ho {
|
|
|
- antidle:set $chan
|
|
|
|
|
setting:set $chan +idlehalfop ""
|
|
setting:set $chan +idlehalfop ""
|
|
|
blacktools:tell $nick $host $hand $chan $chan1 idle.25 none
|
|
blacktools:tell $nick $host $hand $chan $chan1 idle.25 none
|
|
|
|
|
+foreach tmr [timers] {
|
|
|
|
|
+if {[string match "*antidle:module*" [join [lindex $tmr 1]]]} {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+ set idle_time [time_return_minute $black(idleinterval)]
|
|
|
|
|
+ timer $idle_time antidle:module
|
|
|
}
|
|
}
|
|
|
-v {
|
|
-v {
|
|
|
setting:set $chan -idlevoice ""
|
|
setting:set $chan -idlevoice ""
|
|
|
blacktools:tell $nick $host $hand $chan $chan1 idle.15 none
|
|
blacktools:tell $nick $host $hand $chan $chan1 idle.15 none
|
|
|
- antidle:unset $chan
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
add {
|
|
add {
|
|
@@ -168,56 +182,20 @@ if {$type == "1"} {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-proc antidle:unset {chan} {
|
|
|
|
|
- global black
|
|
|
|
|
- set idle_activ 0
|
|
|
|
|
- set options {idleop idlevoice idlehalfop}
|
|
|
|
|
-foreach option $options {
|
|
|
|
|
- if {[setting:get $chan $option]} {
|
|
|
|
|
- set idle_activ 1
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-if {$idle_activ == "0"} {
|
|
|
|
|
-if {[info exists black(idle:$chan:timer_start)]} {
|
|
|
|
|
- unset black(idle:$chan:timer_start)
|
|
|
|
|
- }
|
|
|
|
|
-if {[info exists black(idle:counter:$chan)]} {
|
|
|
|
|
- unset black(idle:counter:$chan)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-proc antidle:set {chan} {
|
|
|
|
|
- global black
|
|
|
|
|
- set idle_activ 0
|
|
|
|
|
- set options {idleop idlevoice idlehalfop}
|
|
|
|
|
-foreach option $options {
|
|
|
|
|
- if {[setting:get $chan $option]} {
|
|
|
|
|
- set idle_activ 1
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-if {$idle_activ == "0"} {
|
|
|
|
|
-if {[setting:get $chan idle-scantime] != ""} {
|
|
|
|
|
- set time [setting:get $chan idle-scantime]
|
|
|
|
|
- } else {
|
|
|
|
|
- set time $black(idleinterval)
|
|
|
|
|
- }
|
|
|
|
|
- set scan_time [time_return_minute $time]
|
|
|
|
|
- set black(idle:$chan:timer_start) $scan_time
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-proc antidle:module {chans} {
|
|
|
|
|
|
|
+proc antidle:module {} {
|
|
|
global black
|
|
global black
|
|
|
set channels ""
|
|
set channels ""
|
|
|
-foreach chan $chans {
|
|
|
|
|
-if {[validchan $chan]} {
|
|
|
|
|
|
|
+foreach chan [channels] {
|
|
|
|
|
+if {[setting:get $chan idleop] || [setting:get $chan idlevoice]} {
|
|
|
lappend channels $chan
|
|
lappend channels $chan
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if {$channels != ""} {
|
|
if {$channels != ""} {
|
|
|
idlewhois $channels 0
|
|
idlewhois $channels 0
|
|
|
|
|
+ set idle_time [time_return_minute $black(idleinterval)]
|
|
|
|
|
+ timer $idle_time antidle:module
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -235,8 +213,9 @@ if {$chan != ""} {
|
|
|
|
|
|
|
|
proc black:check:idle {chan} {
|
|
proc black:check:idle {chan} {
|
|
|
global black
|
|
global black
|
|
|
|
|
+ putlog "\[BT\] Scanning for idle on $chan"
|
|
|
set ::idle_chan $chan
|
|
set ::idle_chan $chan
|
|
|
-foreach user [chanlist $chan] {
|
|
|
|
|
|
|
+foreach user [chanlist $chan] {
|
|
|
set handle [nick2hand $user]
|
|
set handle [nick2hand $user]
|
|
|
if {[isop $user $chan] || [isvoice $user $chan] || [ishalfop $user $chan]} {
|
|
if {[isop $user $chan] || [isvoice $user $chan] || [ishalfop $user $chan]} {
|
|
|
if {![isbotnick $user]} {
|
|
if {![isbotnick $user]} {
|
|
@@ -261,14 +240,11 @@ if {$idlevoicetime == ""} { set idlevoicetime "$black(idlevoicemax)" }
|
|
|
if {$idleoptime == ""} { set idleoptime "$black(idleopmax)" }
|
|
if {$idleoptime == ""} { set idleoptime "$black(idleopmax)" }
|
|
|
set idlehalfoptime [setting:get $chan idlehalfopmax]
|
|
set idlehalfoptime [setting:get $chan idlehalfopmax]
|
|
|
if {$idlehalfoptime == ""} { set idlehalfoptime "$black(idlehalfopmax)" }
|
|
if {$idlehalfoptime == ""} { set idlehalfoptime "$black(idlehalfopmax)" }
|
|
|
- set idlevoicetime [time_return_minute $idlevoicetime]
|
|
|
|
|
- set idleoptime [time_return_minute $idleoptime]
|
|
|
|
|
- set idlehalfoptime [time_return_minute $idlehalfoptime]
|
|
|
|
|
if {![info exists black(voiceonmsg:$nick:$chan)]} {
|
|
if {![info exists black(voiceonmsg:$nick:$chan)]} {
|
|
|
if {[setting:get $chan idlevoice]} {
|
|
if {[setting:get $chan idlevoice]} {
|
|
|
if {![matchattr $handle "-|gf" $chan]} {
|
|
if {![matchattr $handle "-|gf" $chan]} {
|
|
|
if {$minutesidle > $idlevoicetime} {
|
|
if {$minutesidle > $idlevoicetime} {
|
|
|
-if {[setting:get $chan xonly] && [onchan $black(chanserv) $chan]} {
|
|
|
|
|
|
|
+if {[setting:get $chan xonly]} {
|
|
|
putserv "PRIVMSG $black(chanserv) :devoice $chan $nick"
|
|
putserv "PRIVMSG $black(chanserv) :devoice $chan $nick"
|
|
|
} else {
|
|
} else {
|
|
|
pushmode $chan -v $nick
|
|
pushmode $chan -v $nick
|
|
@@ -280,7 +256,7 @@ if {[setting:get $chan xonly] && [onchan $black(chanserv) $chan]} {
|
|
|
if {[setting:get $chan idleop]} {
|
|
if {[setting:get $chan idleop]} {
|
|
|
if {![matchattr $handle "-|af" $chan]} {
|
|
if {![matchattr $handle "-|af" $chan]} {
|
|
|
if {$minutesidle > $idleoptime} {
|
|
if {$minutesidle > $idleoptime} {
|
|
|
-if {[setting:get $chan xonly] && [onchan $black(chanserv) $chan]} {
|
|
|
|
|
|
|
+if {[setting:get $chan xonly]} {
|
|
|
putserv "PRIVMSG $black(chanserv) :deop $chan $nick"
|
|
putserv "PRIVMSG $black(chanserv) :deop $chan $nick"
|
|
|
} else {
|
|
} else {
|
|
|
pushmode $chan -o $nick
|
|
pushmode $chan -o $nick
|
|
@@ -291,7 +267,7 @@ if {[setting:get $chan xonly] && [onchan $black(chanserv) $chan]} {
|
|
|
if {[setting:get $chan idlehalfop]} {
|
|
if {[setting:get $chan idlehalfop]} {
|
|
|
if {![matchattr $handle "-|f" $chan]} {
|
|
if {![matchattr $handle "-|f" $chan]} {
|
|
|
if {$minutesidle > $idlehalfoptime} {
|
|
if {$minutesidle > $idlehalfoptime} {
|
|
|
-if {[setting:get $chan xonly] && [onchan $black(chanserv) $chan]} {
|
|
|
|
|
|
|
+if {[setting:get $chan xonly]} {
|
|
|
return
|
|
return
|
|
|
} else {
|
|
} else {
|
|
|
pushmode $chan -h $nick
|
|
pushmode $chan -h $nick
|