Login  
 

Klient.com > Forums > Plugins and Scripts > Scripting > whois that girl?
 
Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
technicka
Member

Registered: Jun 2003
Location: federal way, soon hawaii
Posts: 30

whois that girl?

I need to find the name and ip address and all that jazz for a script to process.

Is there a cleaner way to do it than using a Window.Command "xwhois " and then parsing that from the channel buffer?


klient rocks!

__________________
"24 hours in a day, 24 beers in a case. Coincidence? I think not."
> Stephen Wright

Old Post 10 Jun 2003 12:46 PM
Click Here to See the Profile for technicka Find more posts by technicka Edit/Delete Message Reply w/Quote
jazper
Code Monkey

Registered: Sep 2002
Location: Warrensburg
Posts: 167

You could always use the Whois object. This will give you Whois.Address, which will return the address of the Nick. Rather than worrying about parsing.


Example:

code:
' Params: Server, Window, Params ' in an alias Dim objWhois Set objWhois = Whois.NewObject objWhois.Nickname = Params objWhois.Server = Server objWhois.OnFinish = "OnFinish" ' call back here objWhois.DataObject = Window objWhois.Lookup Set objWhois = Nothing 'In globals for OnFinish callback Sub OnFinish(objWhois) WindowMgr.ActiveWindow.Display.Echo objWhois.Address End Sub


Again this is just an example.

jaz

Old Post 10 Jun 2003 02:32 PM
Click Here to See the Profile for jazper Find more posts by jazper Edit/Delete Message Reply w/Quote
technicka
Member

Registered: Jun 2003
Location: federal way, soon hawaii
Posts: 30

duh

gee,.. I feel like a bone head! Didn't see that in the object browser, and now that you told me,.. zowee!@ there it is. duh!!!

Maybe I should wait another day before posting at 4am,... I think my brain was running at 10% cpu. hehe

__________________
"24 hours in a day, 24 beers in a case. Coincidence? I think not."
> Stephen Wright

Old Post 11 Jun 2003 02:38 AM
Click Here to See the Profile for technicka Find more posts by technicka Edit/Delete Message Reply w/Quote
technicka
Member

Registered: Jun 2003
Location: federal way, soon hawaii
Posts: 30

this is crazy

ok.. I finally got it to work,.. but this is wack!

What is this nonsense about the callback. If it's calling a function on completion then why is it in qoutes?

Why does the onfinish need to be in teh globals????? I just want to simply get the address of a whois, I really don't want to make jumps to global.

Say I use that, I'm stuck with the output only in the globals section, I tried and tried to get it to bypass this oncall nonsense but it simply outputs nothing if I don't use it.

This must be part of the learning curve, because right now I'm totally confused.

__________________
"24 hours in a day, 24 beers in a case. Coincidence? I think not."
> Stephen Wright

Old Post 11 Jun 2003 03:27 AM
Click Here to See the Profile for technicka Find more posts by technicka Edit/Delete Message Reply w/Quote
brainy
Member

Registered: Sep 2002
Location:
Posts: 41

Well, you can't avoid the callback. Because the whois request gets sent to the server, and doesn't return immediatley from the server, the object has to call the callback when the request returns... Now, I'm not sure what you mean about outputting in the Globals section, but note that with the Whois object you can pass a DataObject which you can refer to in the callback. In jazper's example he passed the Window object, although not using it in the callback. A renewed version of the callback that outputs to the calling window would be:

code:
Sub OnFinish(objWhois) objWhois.DataObject.Display.Echo objWhois.Address End Sub

Old Post 28 Jun 2003 07:38 AM
Click Here to See the Profile for brainy Find more posts by brainy Edit/Delete Message Reply w/Quote
tom
Klient Author

Registered: Sep 2002
Location: Blacksburg, Virginia, USA
Posts: 1543

It is a function but yes, its in quotes. Thats because VBScript doesn't have a notion of function pointers like that. So, you give it the string name of the function; Klient knows how to call that.

It has to go elsewhere (e.g. into the globals) and cannot return right away because of the asychronous nature of the /whois request. Klient sends the request to the server; the server will (hopefully) reply, but it is not synchronous. It may take a second or two or more, or the server may have 20 other things to send you before it sends you the /whois reply (for example, channel messages that it needs to send to you).

Things that require going to the server for info are not synchronous in nature and therefore you cannot think of them in a synchronous sequential way (the way most of your code executes).

Anyway... hopefully by this time you've figured what all the callback stuff is about. It really is pretty easy You can also do it mIRC-style using various raw events that trigger when the /whois replies are received, but the Whois object or AddressFinder object tidy it up a bit more for you. You don't have to worry about what numeric replies are actually received. Either way its not sequential, but at least this way its still object-based.

__________________
Tom McAlee

Old Post 30 Jun 2003 09:02 AM
Click Here to See the Profile for tom Find more posts by tom Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 12:23 PM. Post New Thread    Post A Reply
 
Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread


   
Forums Engine: vBulletin 2.2.7, Copyright ©2000 - 2002, Jelsoft Enterprises Limited.
Copyright © 1997-2004, by Thomas J. McAlee, Jr. All rights reserved. Terms of Use.