Clutz,
I have been thinking about what you are trying to do. I clowned around a little this weekend with some ideas to simplify it. If you have a chance, email me at
skepcat@skepcat.com or just jump on Dayton.oh.us.winchat.net and I will show you what I have been doing.
I spent some time working on your idea of using several variables and basic files for maintinance. This is ok, but I found it easier to use an INI style file that includes peices like
[CHANNELS]
#Channel1=no
#Channel2=yes
#Channel3=yes
#Channel4=yes
#Channel5=no
#Channel6=no
[OPCHANS]
NICK1=channel:level,channel2:level,channel3:level
NICK2=channel:level,channel2:level,channel3:level
NICK3=channel:level,channel2:level,channel3:level
[OPADDS]
NICK1=channel:level,channel2:level,channel3:level
NICK2=channel:level,channel2:level,channel3:level
NICK3=channel:level,channel2:level,channel3:level
By tokenizing the reply from the OPERATOR sections ([OPCHANS][OPADDS], you can grab the level and the channel for a nick. Your script used level 5. I have issues with this setting, because anyone who has a dynamic address can change from 1 to 8 tokens daily. For this reason, I use 8 to maintain the NICKNAME as well as a type 3 address. if you dont want to worry about NICKNAME, you can do the same thing using level 3 addressing and just the [email]user@host.[/email]
Just briefly, this is how I was using these files to get your operator status. Using gettoks and the $readini function, I scanned the ini file for a nickname. Before you start this, set a variable %OWNER to your nick. This is just to fix a message that is sent.
ON 1:OP:* {
set %operator $readini(botchans.ini,OPCHAN,$opnick)
set %OPADD $readini(botchans.ini,OPADDS,$opnick)
;
; SET THE ADDRESS KEY BASED ON NICKNAME
; The owner and the addresses are now stored
;
; Verify that the channel where the OP action has occured is being
; Actively scanned by the bot and make sure that user is an operator
; for the channel where the op action has occurred.
;
if (ON isin $readini(botchans.ini,CHANNELS, $chan) && $chan isin %operator) {
;
; If the nick is known as an operator, ensure that his address is
; known to the bot for verification. If it is, then leave oped and
; send greeting
;
echo 3 -a $address($opnick,8)
if ($address($opnick,8) isin %OPADD) {
notice $opnick Welcome Back $opnick!!!
}
else {
;
; If there is no verification, then deop the user and send
; notice to chanops and to user stating that the channel has
; a restricted op list.
;
mode $chan -o $opnick
notice $opnick This channel has a restricted operator list.
notice @ $+ $chan $opnick is not a recognized operator, please verify this with %OWNER
}
}
}
It should work as a good starting point, and you should be able to work from there.