##################
## CONFIG ##
##################
if {[file exists "./gline.db"]} {
source "./gline.db"
}
bind raw - NOTICE rawgline
proc rawgline {from keyword arg} {
global gline
if {[string match "*Client exiting at*User has been banned from nomserv.org*" $arg]} {
set linegl [lindex $arg 8]
regsub -all {^([^<]+)!.*} $linegl "\\1" nickexit
regsub -all {.*@([^<]+)$} $linegl "\\1" hostexit
set gline($nickexit) $hostexit
set datagl [open "./gline.db" "w"]
puts $datagl [list array set gline [array get gline]]
close $datagl
}
if {[string match "*Expiring G:Line*" $arg]} {
set linedegl [lindex $arg 4]
regsub -all {.*@([^<]+)\)$} $linedegl "\\1" hostdeexit
foreach le [array names gline] {
if {[string equal -nocase $hostdeexit $gline($le)]} {
unset gline($le)
}
}
set datagl [open "./gline.db" "w"]
puts $datagl [list array set gline [array get gline]]
close $datagl
}
if {[string match "*removed G:Line*" $arg]} {
set lineremgl [lindex $arg 4]
regsub -all {^\*@([^<]+)$} $lineremgl "\\1" hostremexit
foreach le [array names gline] {
if {[string equal -nocase $hostremexit $gline($le)]} {
unset gline($le)
}
}
set datagl [open "./gline.db" "w"]
puts $datagl [list array set gline [array get gline]]
close $datagl
}
}
bind msg - degline msgdegline
proc msgdegline {nick host hand arg} {
global vhostniv3 gline
foreach vhost $vhostniv3 {
if {[string match -nocase $vhost $host]} {
set nickdegl [lindex $arg 0]
if {$nickdegl==""} {
putquick "NOTICE $nick : \002\00304Syntax !!\002\00306 DEGLINE \00301<\00312Pseudo\00301>"
return 0
} else {
set listgline " [array names gline] "
if {![string match -nocase "* $nickdegl *" $listgline]} {
putquick "NOTICE $nick : \00304**\00303\002 $nickdegl \002Non présent dans la liste de glines !"
return 0
}
}
putquick "gline -*@$gline($nickdegl)"
unset gline($nickdegl)
set datagl [open "./gline.db" "w"]
puts $datagl [list array set gline [array get gline]]
close $datagl
putquick "NOTICE $nick :\00304**\002\00303 $nickdegl \002a été degline !"
return 1
}
}
}
bind msg - listgline msglistgline
proc msglistgline {nick host hand arg} {
global vhostniv3 gline
set countgline 0
foreach vhost $vhostniv3 {
if {[string match -nocase $vhost $host]} {
if {[info exists gline]} {
foreach gl [lsort -dictionary [array names gline]] {
putquick "NOTICE $nick :4* $gl 12>> $gline($gl)"
incr countgline
}
putquick "NOTICE $nick :\002\00301 $countgline \00304glines"
}
}
}
}