Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc get:unnuke:format {{unnuke "input,unnuke"}} {
- global site
- if { $site($unnuke) == "" } { return 0 }
- set site($unnuke,length) [llength $site($unnuke)]
- set site($unnuke,reason) [lsearch -exact $site($unnuke) "\$reason"]
- set site($unnuke,release) [lsearch -exact $site($unnuke) "\$release"]
- set site($unnuke,source) [lsearch -exact $site($unnuke) "\$source"]
- # and finally prepare the triggerstring that we're gonna use in the bind
- regsub -all {(\ +|\ *\$reason\ *|\ *\$release\ *|\ *\$source\ *)} $site($unnuke) * site($unnuke,trigger)
- regsub -all {\*\*+} $site($unnuke,trigger) * site($unnuke,trigger)
- pbbind pubm -|- $site($unnuke,trigger) prebot:pub:unnuke
- putlog "pbbind pubm -|- $site($unnuke,trigger) prebot:pub:unnuke"
- return 0
- }
- set unnukenames [array names site input*unnuke]
- foreach item $unnukenames {
- set parts [split $item ","]
- if {[llength $parts] == 3} {
- get:unnuke:format [join $parts ","]
- } elseif {[llength $parts] == 2} {
- get:unnuke:format
- }
- }
- unset unnukenames
- proc prebot:pub:unnuke { nick uhost hand chan arg } {
- global armour module network mysql site
- if {[channel get $chan unnukefrom]} {
- foreach trigger [array names site input*,unnuke] {
- if {[lindex $arg 0] == [lindex $site($trigger) 0]} { set unnuke $trigger }
- }
- if { $site($unnuke,release) != -1 } {
- set release [string trim [lindex $arg $site($unnuke,release)]]
- } else { set release "" }
- if { $site($unnuke,reason) != -1 } {
- set reason [string trim [lindex $arg $site($unnuke,reason)]]
- } else { set reason "" }
- if { $site($unnuke,source) != -1 } {
- set source [string trim [lindex $arg $site($unnuke,source)]]
- } else { set source $network }
- set isrls [::mysql::sel $mysql(handle) "SELECT rel_section FROM allpres WHERE rel_name = '$release'"]
- if { $isrls == 0 } { return 0 }
- set section [::mysql::sel $mysql(handle) "SELECT rel_section FROM allpres WHERE rel_name = '$release'" -flatlist]
- set curtime [unixtime]
- if { [lsearch -exact -inline $armour(unnuke) $release] == $release } { return 0 }
- set armour(unnuke) [linsert $armour(unnuke) 0 [string map {"." "_" "u" "oo" "c" "k"} $release]]
- set armour(unnuke) [lrange [linsert $armour(unnuke) 0 $release] 0 $armour(keepold)]
- putallbots "DBUNNUKE $release $section $reason $curtime $nick $chan $network $source"
- putallchans "spam" "UNNUKE $release $section $reason $curtime $nick $chan $network $source"
- if { $module(db) == 1 } { prebot:db:add "DBUNNUKE $release $section $reason $curtime $nick $chan $network $source" }
- }
- }
- proc get:unnuke:format {{unnuke "input,unnuke"}} {
- global site
- if { $site($unnuke) == "" } { return 0 }
- set site($unnuke,length) [llength $site($unnuke)]
- set site($unnuke,reason) [lsearch -exact $site($unnuke) "\$reason"]
- set site($unnuke,release) [lsearch -exact $site($unnuke) "\$release"]
- set site($unnuke,source) [lsearch -exact $site($unnuke) "\$source"]
- # and finally prepare the triggerstring that we're gonna use in the bind
- regsub -all {(\ +|\ *\$reason\ *|\ *\$release\ *|\ *\$source\ *)} $site($unnuke) * site($unnuke,trigger)
- regsub -all {\*\*+} $site($unnuke,trigger) * site($unnuke,trigger)
- pbbind pubm -|- $site($unnuke,trigger) prebot:pub:unnuke
- putlog "pbbind pubm -|- $site($unnuke,trigger) prebot:pub:unnuke"
- return 0
- }
- set unnukenames [array names site input*unnuke]
- foreach item $unnukenames {
- set parts [split $item ","]
- if {[llength $parts] == 3} {
- get:unnuke:format [join $parts ","]
- } elseif {[llength $parts] == 2} {
- get:unnuke:format
- }
- }
- unset unnukenames
- proc prebot:pub:unnuke { nick uhost hand chan arg } {
- global armour module network mysql site
- if {[channel get $chan unnukefrom]} {
- foreach trigger [array names site input*,unnuke] {
- if {[lindex $arg 0] == [lindex $site($trigger) 0]} { set unnuke $trigger }
- }
- if { $site($unnuke,release) != -1 } {
- set release [string trim [lindex $arg $site($unnuke,release)]]
- } else { set release "" }
- if { $site($unnuke,reason) != -1 } {
- set reason [string trim [lindex $arg $site($unnuke,reason)]]
- } else { set reason "" }
- if { $site($unnuke,source) != -1 } {
- set source [string trim [lindex $arg $site($unnuke,source)]]
- } else { set source $network }
- set isrls [::mysql::sel $mysql(handle) "SELECT rel_section FROM allpres WHERE rel_name = '$release'"]
- if { $isrls == 0 } { return 0 }
- set section [::mysql::sel $mysql(handle) "SELECT rel_section FROM allpres WHERE rel_name = '$release'" -flatlist]
- set curtime [unixtime]
- if { [lsearch -exact -inline $armour(unnuke) $release] == $release } { return 0 }
- set armour(unnuke) [linsert $armour(unnuke) 0 [string map {"." "_" "u" "oo" "c" "k"} $release]]
- set armour(unnuke) [lrange [linsert $armour(unnuke) 0 $release] 0 $armour(keepold)]
- putallbots "DBUNNUKE $release $section $reason $curtime $nick $chan $network $source"
- putallchans "spam" "UNNUKE $release $section $reason $curtime $nick $chan $network $source"
- if { $module(db) == 1 } { prebot:db:add "DBUNNUKE $release $section $reason $curtime $nick $chan $network $source" }
- }
- }
- bind bot -|- DBUNNUKE prebot:bot:unnuke
- proc prebot:bot:unnuke { bot cmd arg } {
- global armour module mysql site put
- set release [lindex $arg 0]
- set reason [lindex $arg 2]
- set section [::mysql::sel $mysql(handle) "SELECT rel_section FROM allpres WHERE rel_name = '$release'" -flatlist]
- set curtime [lindex $arg 3]
- set nick [lindex $arg 4]
- set chan [lindex $arg 5]
- set network [lindex $arg 6]
- set source [lindex $arg 7]
- if { [lsearch -exact -inline $armour(unnuke) $release] == $release } { return 0 }
- set armour(unnuke) [linsert $armour(unnuke) 0 [string map {"." "_" "u" "oo" "c" "k"} $release]]
- set armour(unnuke) [lrange [linsert $armour(unnuke) 0 $release] 0 $armour(keepold)]
- set chflag "unnuke"
- foreach chan [string tolower [channels]] {
- if {[channel get $chan unnuketo]} {
- if {[info exists site(output,[string tolower $chan],$chflag)]} {
- set output $site(output,[string tolower $chan],$chflag)
- } else { set output $site(output,default,$chflag) }
- if { [llength $site(output,nuke,allowedsource)] <= 0 } { set SendToNetwork "1"
- } elseif { [lsearch -exact $site(output,nuke,allowedsource) $source] != -1 } { set SendToNetwork "1"
- } else { set SendToNetwork "0" }
- if { $SendToNetwork == "1" } {
- if {[info exists site(fish,[string tolower $chan],key)]} {
- if {[info exists site(fish,[string tolower $chan],prefix)]} {
- $put(fast) "PRIVMSG $chan :$site(fish,[string tolower $chan],prefix) [encrypt $site(fish,[string tolower $chan],key) [subst $output]]"
- } else {
- $put(fast) "PRIVMSG $chan :$site(fish,default,prefix) [encrypt $site(fish,[string tolower $chan],key) [subst $output]]"
- }
- } else { $put(fast) "PRIVMSG $chan :[subst $output]" }
- }
- }
- }
- if { $module(db) == 1 } { prebot:db:add "DBUNNUKE $release $section $reason $curtime $nick $chan $network $source" }
- }
- bind bot -|- DBUNNUKEOK prebot:bot:unnukespam
- proc prebot:bot:unnukespam { bot cmd arg } {
- global armour module mysql site put
- set release [lindex $arg 0]
- set section [lindex $arg 1]
- set reason [lindex $arg 2]
- set curtime [lindex $arg 3]
- set nick [lindex $arg 4]
- set chan [lindex $arg 5]
- set network [lindex $arg 6]
- set source [lindex $arg 7]
- putallchans "spam" "UNNUKE $release $section $reason $curtime $nick $chan $network $source"
- }
Add Comment
Please, Sign In to add comment