Code: Select all
#### ++++ Author: MadaliN <madalinmen28@yahoo.com>
### +++ Website: www.Ascenture.ro
## +++ TCL Name: GLine
# +++ Version: 1.0
## ++++
# Commands:
# !gline 45.432.12.1
#
# For the command to work you need to have VOICE or OP in the main channel
#
bind PUBM - * gline:main
set temp(trigger) {! . `}
proc gline:main {nick uhost hand chan arg} {
global temp
if {[string index $arg 0] in $temp(trigger)} {
set temp(cmd) [string range $arg 1 end]
set temp(cmd) [lindex [split $temp(cmd)] 0]
set arg [join [lrange [split $arg] 1 end]]
} elseif {[isbotnick [lindex [split $arg] 0]]} {
set temp(cmd) [lindex [split $arg] 1]
set arg [join [lrange [split $arg] 2 end]]
} else { return 0 }
if {[info commands command:$temp(cmd)] != ""} { command:$temp(cmd) $nick $uhost $hand $chan $arg }
}
proc command:gline {nick uhost hand chan arg} {
global top temp
if {[isvoice $nick $chan] || [isop $nick $chan]} {
set ip [lindex [split $arg] 0]
if {![regexp {^(?:(?:[01]?\d?\d|2[0-4]\d|25[0-5])(\.|$)){4}$} $ip]} { putserv "PRIVMSG $chan :\002$nick\002 - NO/Invalid IP pattern. USAGE: !gline 193.193.193.193"; return }
set temp(gchan) $chan
set temp(gnick) $nick
putquick "GLINE $ip"
bind raw - 280 gline:valid
bind raw - 512 gline:invalid
}
}
proc gline:valid {from cmd arg} {
global temp
set glineI [lindex [split $arg] 1]
set glineT [lindex [split $arg] 4]
set glineE [lindex [split $arg] 3]
set glineR [join [lrange [split $arg] 7 end]]
putserv "PRIVMSG $temp(gchan) :\002$temp(gnick)\002 - GLine for \00304$glineI\003 was created on \00312[clock format $glineE]\003 meaning \00303[duration [expr $glineT - $glineE]]\003 and it will expire on \00312[clock format $glineT]\003 meaning \00303[duration [expr $glineT - [clock seconds]]]\003. Reason: \00306$glineR"
catch {unbind RAW - 280 gline:valid}
catch {unbind RAW - 512 gline:invalid}
}
proc gline:invalid {from cmd arg} {
global temp
putserv "PRIVMSG $temp(gchan) :\002$temp(gnick)\002 - There is not GLine for that IP"
catch {unbind RAW - 280 gline:valid}
catch {unbind RAW - 512 gline:invalid}
}
putlog "++ Succesfully loaded: \00312GLine"