Code: Select all
if {![channel get $chan cswhy]} return
if {[lsearch $text "Identification"] == -1} return
Code: Select all
set csWhyList [channel get $chan csWhyList]
Code: Select all
if {![channel get $chan cswhy]} return
if {[lsearch $text "Identification"] == -1} return
Code: Select all
set csWhyList [channel get $chan csWhyList]
Code: Select all
namespace eval csWhy {
setudef str csWhyList
setudef flag cswhy
bind mode * "% +o" [namespace current]::checkWhy
bind notc * * [namespace current]::checkReply
bind part * * [namespace current]::remove
bind sign * * [namespace current]::remove
bind nick * * [namespace current]::nick
bind kick * * [namespace current]::kick
bind join * * [namespace current]::botJoin
# purge
proc purge {chan user {newNick ""}} {
set csWhyList [channel get $chan csWhyList]
set pos [lsearch $csWhyList $user]
if {$pos != -1} {
if {![llength $newNick]} {
set csWhyList [lreplace $csWhyList $pos $pos]
} else {
set csWhyList [lreplace $csWhyList $pos $pos $newNick]
}
channel set $chan csWhyList $csWhyList
}
return $pos
}
# cleanup
proc cleanup {chan user} {
if {[isbotnick $user]} {
channel set $chan csWhyList {}
} else {
purge $chan $user
}
}
# join
proc botJoin {nick uhost hand chan} {
if {[isbotnick $nick]} {
channel set $chan csWhyList {}
}
}
# kick
proc kick {nick uhost handle chan vict reason} {
if {![channel get $chan cswhy]} return
if {![wasop $chan $nick]} return
cleanup $chan $nick
}
# part & sign
proc remove {nick uhost handle chan {text ""}} {
if {![channel get $chan cswhy]} return
cleanup $chan $nick
}
# nick
proc nick {nick uhost handle chan newNick} {
if {[isbotnick $nick] || ![channel get $chan cswhy]} return
if {![isop $chan $nick]} return
puthelp "ChanServ WHY $chan $newNick"
purge $chan $nick $newNick
}
# someone got OP'ed on the channel
proc checkWhy {nick uhost hand chan mode target} {
if {[isbotnick $target]} return
if {![channel get $chan cswhy]} return
set csWhyList [channel get $chan csWhyList]
lappend csWhyList $target
channel set $chan csWhyList $csWhyList
puthelp "ChanServ WHY $chan $target"
}
# reply of WHY command from ChanServ
proc checkReply {nick uhost hand text {dest ""}} {
if {[string equal -length 1 # $dest]} return
if {![string equal $nick "ChanServ"]} return
set text [split $text]
if {[lsearch $text "Identification"] == -1} return
set chan [string trim [lindex $text 5] {.}]
if {![channel get $chan cswhy]} return
set user [lindex $text 0]
if {[purge $chan $user] != -1} {
puthelp "NOTICE @$chan :$text"
}
}
}
putlog "cswhy.tcl loaded.."
* bot sets mode: +o caesar
<@bot> ChanServ WHY #chan caesar
-bot:@#chan- @ caesar has FOUNDER access to #chan. Reason: Identification to services with the channel password. Channel Frozen: NO
* caesar is now known as user
<@bot> ChanServ WHY #chan user