# nickserv event driven identify script
set nickserv "NickServ"
set chanserv "ChanServ"
set mynick "Bartender"
set mypass "christie"
set recovery 0
set mydebug 1
bind evnt - init-server my-initserver
bind notc - "*nickname is registered*" ident_nick
bind notc - "*password accepted*" authsuccess
bind raw - 436 { set recovery 1 }
bind need - "% op" needop
proc my-initserver {type} {
nickservices
}
proc nickservices {} {
global mydebug passauth channels recovery
if {$mydebug} { putlog "Nickservices started" }
# turn channels off until ident complete
chanoff
if {$recovery} { recovernick }
# ok we are done
if {$mydebug} { putlog "Nickservices finished" }
}
proc authsuccess {} {
global mydebug
if {$mydebug} { putlog "Authenticaion Success" }
# turn channels back on
chanon
unbind notc - "password accepted" authsuccess
unbind notc - "please choose a different nick" identnick
unbind raw - 436 { set recovery 1 }
}
# turn all channels on
proc chanon {} {
global mydebug channels
if {$mydebug} { putlog "Channels set active" }
foreach ch [channels] {
channel set $ch -inactive
}
}
# turn all channels off
proc chanoff {} {
global mydebug channels
if {$mydebug} { putlog "Channels set inactive" }
foreach ch [channels] {
channel set $ch +inactive
}
}
proc recovernick {} {
global mydebug mynick mypass nick nickserv
if {$mydebug} { putlog "Recovering nick" }
bind notc - "RELEASE $mynick" releasenick
putserv "PRIVMSG $nickserv RECOVER $mynick $mypass"
}
proc releasenick {} {
global mydebug mynick mypass nick nickserv
if {$mydebug} { putlog "Releasing nick" }
unbind notc - "RELEASE $mynick" releasenick
bind notc - "your nick has been released" revertnick
putserv "PRIVMSG $nickserv RELEASE $mynick $mypass"
}
proc revertnick {} {
global mydebug nick mynick
if {$mydebug} { putlog "Reverting nick" }
unbind notc - "your nick has been released" revertnick
set nick mynick
}
proc ident_nick {} {
global mydebug nickserv mypass
if {$mydebug} { putlog "Identify myself" }
putserv "PRIVMSG $nickserv IDENTIFY $mypass"
}
proc needop {channel type} {
global mydebug chanserv nick
if {$mydebug} { putlog "I need ops" }
putserv "PRIVMSG $chanserv OP $channel $nick"
}