egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

handling raw irc output data..

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
honeybee
Halfop


Joined: 01 Jan 2006
Posts: 80

PostPosted: Sun Jul 09, 2006 12:12 pm    Post subject: handling raw irc output data.. Reply with quote

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:

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)"
 }
}
Back to top
View user's profile Send private message
honeybee
Halfop


Joined: 01 Jan 2006
Posts: 80

PostPosted: Wed Jul 12, 2006 1:04 am    Post subject: Reply with quote

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:
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:
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
    }
Back to top
View user's profile Send private message
IRCNick
Halfop


Joined: 12 Oct 2005
Posts: 64
Location: Germany

PostPosted: Wed Jul 12, 2006 8:34 am    Post subject: Reply with quote

honeybee wrote:

Code:

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"
     }
   }
 }



Quote:
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 Smile ) 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 Smile
Back to top
View user's profile Send private message Visit poster's website
honeybee
Halfop


Joined: 01 Jan 2006
Posts: 80

PostPosted: Fri Jul 14, 2006 5:51 pm    Post subject: Reply with quote

anyone can help me please?
Back to top
View user's profile Send private message
honeybee
Halfop


Joined: 01 Jan 2006
Posts: 80

PostPosted: Tue Jul 25, 2006 7:31 pm    Post subject: Reply with quote

still no replies?
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Tue Jul 25, 2006 7:58 pm    Post subject: Reply with quote

IRCNick supplied you with an answer?
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber