I'm trying to make two major procs to get the irc raw output, whois info and whowas info so i can access these proc from another proc and get the data, i need help as i m new in handling irc raw output thanks.
proc raw:rev:311 {f k t} {
set nick [lindex [split $t] 1]
set ident [lindex [split $t] 2]
set hostmask [lindex [split $t] 3]
set ::raw:whois:data($nick) $nick
set ::raw:whois:data($ident) $ident
set ::raw:whois:data($hostmask) $hostmask
unbind raw - 311 raw:rev311
}
proc raw:nonick401 {f k t} {
global myidx
set set target $::whoistarget
putidx $myidx "$::whoistarget whois info is not avaible, checking whowas"
# now we will try /WHOWAS so see if the nick quit, server keep those info for few time.
putserv "WHOWAS $::whoistarget"
bind raw 314 raw:rev:314
unbind raw 401 raw:nonick
}
proc raw:rev:314 {f k t} {
set nick [lindex [split $t] 1]
set ident [lindex [split $t] 2]
set hostmask [lindex [split $t] 3]
set ::raw:whowas:data($nick) $nick
set ::raw:whowas:data($ident) $ident
set ::raw:whowas:data($hostmask) $hostmask
bind raw - 406 raw:nonick406
unbind raw - 314 raw:rev314
}
proc raw:nonick406 {f k t} {
global myidx
set target $::whoistarget
#whois was not found tryin whowas
putidx $myidx "can't see $::whoistarget on network"
putserv "WHOWAS $::whoistarget"
bind raw 314 raw:rev:314
unbind raw 401 raw:nonick
}
bind dcc o infonick dcc:infonick
proc dcc:infonick {hand idx arg} {
global myidx
set myidx $idx
set target [lindex [split $arg] 1]
set ::whoistarget $target
if {$arg == ""} {
putidx $idx "Usage: .infonick <Nick>"
}
if {$arg != ""} {
putserv "WHOIS $target"
bind raw - 311 raw:rev311
bind raw - 401 raw:nonick401
}
if {[info exist ::raw:whois:data($nick)]} {
putidx $myidx "$arg is: $::raw:whois:data($nick)!$::raw:whois:data($ident)@$::raw:whois:data($ident)"
}
if {[info exist ::raw:whowas:data($nick)]} {
putidx $myidx "$arg is: $::raw:whowas:data($nick)!$::raw:whowas:data($ident)@$::raw:whowas:data($hostmask)"
}
}
Ok thats my another try though its working but it has few logical issues as far as i think first one is, i set target as set target [lindex [split $arg] 0]] and then set ::blah(target) $target, i did to check if info exsist for target [info exist ::blah(target)], but thats wrong casue when .infonick honeybee is done it will exist so it will always be positive right? anyway here is the code:
bind dcc o infonick dcc:infonick
proc dcc:infonick {hand idx arg} {
if {[isbotnick [set target [lindex [split $arg] 0]]]} {
putidx $idx "boo! you want to whois me?"
return
}
set ::blah(target) $target
set ::blah([string tolower $target]) $idx
bind raw - 311 raw:rev
putserv "WHOIS $target"
}
proc raw:rev {from key arg} {
set nick [lindex [split $arg] 1]
set ident [lindex [split $arg] 2]
set hostmask [lindex [split $arg] 3]
if {[info exist ::blah(target)]} {
if {[valididx $::blah([string tolower $nick])]} {
putidx $::blah([string tolower $nick]) "here you go: $nick!$ident@$hostmask target: $nick"
}
}
}
and another idea i got was its better to use something like keywords or something instead of having all that as seperate proc we can use keyword for check but i cant implment it thats what i mean. All help from you guys are appreciated thanks.
proc raw:rev {from key arg} {
switch -- $key {
"001" {
blah
}
"005" {
blah
}
}
"311" {
set nick [lindex [split $arg] 1]
set ident [lindex [split $arg] 2]
set hostmask [lindex [split $arg] 3]
}
"401" }
idx $idx "no such nick"
now whowas nick
putserv "whowas $target"
}
"318" {
end of the whois
}
"314" {
infos from whowas
}
"369" {
end of whowas
}
"406" {
no such nick
}
1.The $arg is already list splited by space
2. $nick should be the first argument(arg 0) [lindex $arg 0]
Your second argument should be the user [lindex $arg 1]
and the third the full host(ident@some.host.tld im not sure but I think so ) of the user [lindex $arg 2] and so on
In this case, if you want to have only the host or the ip you should split the third arg
set host [lindex [split [lindex $arg 2] @] 1]