I've got a process that performs verification through WHOIS to return zero (0) if the nick is not registered and one (1) if the nick is registered on the network.
I would call this second process, taking the zero (0) value or a value of one (1) to another process and the truth gives me errors, not knowing invoke the process well.
My stuff :
Code: Select all
bind pub o|o !fieladd add_fan
bind pub o|o !fieldel del_fan
bind pub o|o !djadd add_dj
bind pub o|o !djdel del_dj
bind pub o|o !adminadd add_admin
bind pub o|o !admindel del_admin
bind pub n|n !rootadd add_root
bind pub n|n !rootdel del_root
set chan_radio #radioX
set chanl_djs #radioX-Dj
set chan_admin #radioX-admin
proc add_fan {nick uhost hand chan text} {
global chan_radio
if {$text == ""} {putmsg $chan "You must enter the nick of the fan to add!";return 0}
set fan [join [lindex [split $text] 0]]
####HERE SHOULD BoT CHECK "FAN" IF A REGISTERED NICK, isnot return if yes continue####
putserv "PRIVMSG chan :access $chan_radio add $fan 100"
if {![validuser $fan]} {
adduser $fan
chattr $fan +c
putmsg $chan "You have added a $fan as fan radio"
} else {
if {![matchattr $fan +c]} {
chattr $fan +c
putmsg $chan "You have added a $fan as fan radio";return}
putmsg $chan "$fan was already a fan of the radio!"
}}}
proc add_dj {nick uhost hand chan text} {
global chan_radio chan_Dj
if {$text == ""} {putmsg $chan "You must enter the nick of the dj to add!";return 0}
set dj [join [lindex [split $text] 0]]
####HERE SHOULD BoT CHECK "DJ" IF A REGISTERED NICK, isnot return if yes continue####
putserv "PRIVMSG chan :access $chan_Dj add $dj 300"
if {![validuser $dj]}
.................etc ....................
................................
Code: Select all
bind join - * foo
proc foo {n u h c} {
puthelp "whois $n"
}
bind raw - 311 gotraw ;# first WHOIS reply
bind raw - 307 gotraw ;# nick has identified (registered)
bind raw - 318 gotraw ;# End of /WHOIS list
proc gotraw {f k t} {
global whoised
set n [lindex [split $t] 1]
if {$k == "311"} {
set whoised($n) "0"
} elseif {$k == "307"} {
incr whoised($n)
} elseif {$k == "318"} {
if {$whoised($n) == "0"} {
puthelp "privmsg $n :please identify or register your nick U can register your nick with this (/msg NickServ REGISTER yourpassword youremail) without the ()."
puthelp "privmsg $n :Also you can use this to identify yourself if you already registered (/msg NickServ IDENTIFY yourpass) without the ()."
}
}
}
putlog "nickreg loaded"
Code: Select all
proc add_fan {nick uhost hand chan text} {
global chan_radio whoisnick
if {$text == ""} {putmsg $chan "You must enter the nick of the fan to add!";return 0}
set fan [join [lindex [split $text] 0]]
set nickreg $fan
puthelp "whois $nickreg"
gotraw $nickreg
if {$whoisnick == 0 } { putmsg $chan "Can not add to staff a nick NO Signup!";return 0}
if {$whoisnick == 1 } {
putserv "PRIVMSG chan :access $chan_radio add $fan 100"
if {![validuser $fan]} {
adduser $fan
chattr $fan +c
putmsg $chan "You have added a $fan as fan radio"
} else {
if {![matchattr $fan +c]} {
chattr $fan +c
putmsg $chan "You have added a $fan as fan radio";return}
putmsg $chan "$fan was already a fan of the radio!"
}}}
proc add_dj {nick uhost hand chan text} {
global chan_radio chan_Dj
if {$text == ""} {putmsg $chan "You must enter the nick of the dj to add!";return 0}
set dj [join [lindex [split $text] 0]]
set nickreg $dj
puthelp "whois $nickreg"
gotraw $nickreg
if {$whoisnick == 0 } { putmsg $chan "Can not add to staff a nick NO Signup!";return 0}
if {$whoisnick == 1 } {
putserv "PRIVMSG chan :access $chan_Dj add $dj 300"
if {![validuser $dj]}
.................etc ....................
................................
}
bind raw - 311 gotraw ;# first WHOIS reply
bind raw - 307 gotraw ;# nick has identified (registered)
bind raw - 318 gotraw ;# End of /WHOIS list
proc gotraw {f k t} {
global whoised whoisnick
set nickreg [lindex [split $t] 1]
if {$k == "311"} {
set whoised($nickreg) "0"
} elseif {$k == "307"} {
incr whoised($nickreg)
} elseif {$k == "318"} {
if {$whoised($nickreg) == "0"} {
set whoisnick 0
} else {
set whoisnick 1
}
}
putlog "nickreg loaded"
I recognize that the line 'gotraw $nickreg' is wrong because no calls procedure gotraw properly, missing parameters.
I further acknowledge that the variable 'whoisnick' does not exist because the procedure gotraw isnot call properly.
Someone can help me properly invoke the procedure 'gotraw' for purposes of the variable 'whoisnick' take appropriate values?
If you think of any other ideas will be welcome