i want that my tcl work on a scpecified channel, how do i do?
set chan "" is not working
thanks
Code: Select all
if { [string equal $chan "#channelname"] } {
code here
}
Code: Select all
setudef flag flagname
Code: Select all
if { [channel get $chan flagname] } {
code here
}
Code: Select all
#### noidle #### bantype code based on Moretools.tcl by MC_8
proc next.pub:noidle {nick uhost handle chan arg} {
global botnick botname next
if {[string tolower $chan] != $next(chan)} { return 0 }
if {![next.check:authed $nick $uhost $handle]} { return 0 }
if {[next.getlevel $handle] >= 2} {
if {[lindex [split $arg] 0] == ""} {putserv "NOTICE $nick :Usage: .noidle <nick>"
return}
if {[next.getlevel [nick2hand [lindex [split $arg] 0] $next(chan)]] >= 1} {
putnotc $nick "[lindex [split $arg] 0] is allowed to idle on $next(chan)!"; return}
if {[onchan [lindex [split $arg] 0] $next(chan)]} {set index [lsearch -exact $next(list) [lindex [split $arg] 0]]
if {$index >= 0} {
set next(list) [lreplace $next(list) $index $index ]
}
switch $next(bantype) {
0 {set ban "*![string range [getchanhost [lindex [split $arg] 0] $next(chan)] [string first ! [getchanhost [lindex [split $arg] 0] $next(chan)]] e]"}
1 {set ban "*!*[string trimleft [string range [getchanhost [lindex [split $arg] 0] $next(chan)] [expr [string first ! [getchanhost [lindex [split $arg] 0] $next(chan)]]+1] e] "~"]"}
2 {set ban "*!*[string range [getchanhost [lindex [split $arg] 0] $next(chan)] [string first @ [getchanhost [lindex [split $arg] 0] $next(chan)]] e]"}
3 {set ident [string range [getchanhost [lindex [split $arg] 0] $next(chan)] [expr [string first ! [getchanhost [lindex [split $arg] 0] $next(chan)]]+1] [expr [string last @ [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ban "*!*[string trimleft $ident "~"][string range [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]] [string first @ [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]]] e]"}
4 {set ban "*!*[string range [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]] [string last "@" [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]]] e]"}
5 {set ban "[lindex [split $arg] 0]![string range [getchanhost [lindex [split $arg] 0] $next(chan)] [string first ! [getchanhost [lindex [split $arg] 0] $next(chan)]] e]"}
6 {set nick [string range [getchanhost [lindex [split $arg] 0] $next(chan)] 0 [expr [string first "!" [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ident [string range [getchanhost [lindex [split $arg] 0] $next(chan)] [expr [string first "!" [getchanhost [lindex [split $arg] 0] $next(chan)]]+1] [expr [string last "@" [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ban "[lindex [split $arg] 0]!*[string trimleft $ident "~"][string range [getchanhost [lindex [split $arg] 0] $next(chan)] [string last "@" [getchanhost [lindex [split $arg] 0] $next(chan)]] e]"}
7 {set nick [string range [getchanhost [lindex [split $arg] 0] $next(chan)] 0 [expr [string first "!" [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ban "[lindex [split $arg] 0]!*[string range [getchanhost [lindex [split $arg] 0] $next(chan)] [string last "@" [getchanhost [lindex [split $arg] 0] $next(chan)]] e]"}
8 {set nick [string range [getchanhost [lindex [split $arg] 0] $next(chan)] 0 [expr [string first "!" [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ident [string range [getchanhost [lindex [split $arg] 0] $next(chan)] [expr [string first "!" [getchanhost [lindex [split $arg] 0] $next(chan)]]+1] [expr [string last "@" [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ban "[lindex [split $arg] 0]!*[string trimleft $ident "~"][string range [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]] [string last "@" [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]]] e]"}
9 {set nick [string range [getchanhost [lindex [split $arg] 0] $next(chan)] 0 [expr [string first "!" [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ban "[lindex [split $arg] 0]!*[string range [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]] [string last "@" [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]]] e]"}
default {set ban "*!*[string range [getchanhost [lindex [split $arg] 0] $next(chan)] [string first "@" [getchanhost [lindex [split $arg] 0] $next(chan)]] e]"}
}
set nnick [lindex [split $ban !] 0]
set iident [string range $ban [expr [string first ! $ban]+1] [expr [string last @ $ban]-1]]
set hhost [string range $ban [expr [string last @ $ban]+1] e]
if {$iident != [set temp [string range $iident [expr [string length $iident]-9] e]]} {set iident *[string trimleft $temp *]}
if {$hhost != [set temp [string range $hhost [expr [string length $hhost]-63] e]]} {set hhost *[string trimleft $temp *]}
set next(ban) "$nnick!$iident@$hhost"
if {[string match "$next(ban)" "$botname"]} {putserv "NOTICE $nick :The ban ( $next(ban) ) matches me ..."
return }
newchanban $next(chan) $next(ban) $nick "$next(noidle)" $next(bantime)
pushmode $chan -o [lindex [split $arg] 0]
#pushmode $chan +b $next(ban)
putkick $chan [lindex [split $arg] 0] "$next(noidle)"
return }
putserv "NOTICE $nick :[lindex [split $arg] 0] isn't on $next(chan)"
return }
}
Code: Select all
# | |
# | next v2.0 by mortician |
# | |
# | IRC: irc.undernet.org - #mortician |
# | email: mortician@linux.be |
# | www: www.mortician.tk |
# |______________________________________|