This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

handling raw irc output data..

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
h
honeybee
Halfop
Posts: 80
Joined: Sun Jan 01, 2006 12:42 pm

handling raw irc output data..

Post by honeybee »

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.

Code: Select all

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)"
 }
}
h
honeybee
Halfop
Posts: 80
Joined: Sun Jan 01, 2006 12:42 pm

Post by honeybee »

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:

Code: Select all

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.

Code: Select all

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
    }
I
IRCNick
Halfop
Posts: 64
Joined: Wed Oct 12, 2005 9:43 pm
Location: Germany
Contact:

Post by IRCNick »

honeybee wrote:

Code: Select all

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"
     }
   }
 }
311 RPL_WHOISUSER RFC1459 <nick> <user> <host> * :<real name>
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]

I hope I helped you a liittle :)
h
honeybee
Halfop
Posts: 80
Joined: Sun Jan 01, 2006 12:42 pm

Post by honeybee »

anyone can help me please?
h
honeybee
Halfop
Posts: 80
Joined: Sun Jan 01, 2006 12:42 pm

Post by honeybee »

still no replies?
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

IRCNick supplied you with an answer?
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Post Reply