| 0 comments ]

Re-Share This Post: Technorati Digg This Stumble Stumble Facebook Twitter
Oh no, mIRC doesn't give you a nice "on 1:WHOIS:" event! Looks like you'll be forced to do some real scripting instead :)
The information returned by a /whois has to be intercepted with raws, so turn to your copy of rfc1459 (you do have one, dont you?) and look for the relevant RPL numerics. You will see that replies 311-313 and 317-319 are generated by a whois query. First, deal with 311 (RPL_WHOISUSER) which provides their nick, host and real name. Enter in your remotes file:
raw 311:*:{
  echo -s Nick: $2
  echo -s Ident: $3
  echo -s Host: $4
  echo -s Real name: $6-
}
Try it out, and you should get the idea straight away. Before long you will realize that it looks a lot better if you do something like this. Note that I've used halt, otherwise mIRC displays it too, and you end up having it displayed twice. Also note I haven't used / anywhere - you don't need to. Here goes:

raw 311:*:{
  echo -s $2 is $3 $+ @ $+ $4 ( $+ $6- $+ )
  halt
}
Then you just have to undergo a similar process with the other replies and you're all done. There is, however, one further point. It's not always a good idea to echo the information as soon as you recieve it. You don't know what order the server will return the different replies in, you don't know how long a gap there will be between each one, you don't even know how many you will get. Instead, use the raw replies to save the information into variables, and on reciept of the RPL_ENDOFWHOIS (318), echo the whole lot in one go:
raw 311:*:{
  %whois.nick = $2
  %whois.addy = $3 $+ @ $+ $4
  %whois.name = $6-
  halt
}

raw 318:*:{
  echo -s %whois.nick is %whois.addy ( $+ %whois.name $+ )
  unset %whois.*
  halt
}
This technique also serves as a practical introduction to raw scripting in general. There are maybe a few you can forget, but a full featured script will generally intercept every raw reply. (and do interesting things with it!)

0 comments

Post a Comment

 
http://www.tsfaenterprise.com TSFA ENTERPRISE TSFA GAS OVEN AND HOME APPLIANCE IN PAKISTAN GAS OVEN GAS OVEN in pakistan Pakistan Home Appliance http://gasovenandhomeappliancesinpakistan.com/ TSFA ENTERPRISE TSFA GAS OVEN AND HOME APPLIANCE IN PAKISTAN GAS OVEN GAS OVEN in pakistan Pakistan Home Appliance