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.

/who and clones

Old posts that have not been replied to for several years.
Locked
s
simonbell
Halfop
Posts: 68
Joined: Mon Aug 05, 2002 8:07 pm
Location: Washington, England
Contact:

/who and clones

Post by simonbell »

Hi

I am writing a script to detect the number of clones there are from a certain host on an irc network (not in a channel).

To do this i am getting the bot to do a /who +h host on the host of the user i wish to check for clones.

Then using a raw bind i want to catch the information and count the number of lines which have been returned from the server, as each line represents a clone.

So, if there are 2 users from a specific host the script catches some items from the who reply as follows:
proc rawwho {from keyw arg} {
putlog "$keyw"
}
the $keyw returns:
<E> [15:35] Devel.BeforeNET.org
<E> [15:35] Devel.BeforeNET.org
which is fine, but i am having trouble getting it to count how many times it is being repeated. I thought that each line would be classed as one item in a list, but it appears that each responce is actually an individual item and not part of a list so i am a little stuck as to how to go forward, i just need to count the number of items displayed.

any ideas?

thanks
Simon
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

IRC servers do not talk in Tcl. On top, eggdrop does not know how you want data returning.

This applies to allmost any language, and any interface.

As such, documentation usualy specifies the rules on how information is returned. In most cases, a scripting interface will return the data, exactly how it is received.

It is then up to the scripting language/scripter and scripter to sort out these details.

Thus, you script is basicaly returning data, exactly as it receives it.

It is up to you as the script, to setup, and start couting the incoming lines, and if need be, generate a list from the data.

To start you off.

You initialise a empty variables(s), to store a list/cout of hosts.

When a line of data comes in, you add this data to your lists yourself.

When complete, you may process this data further.
s
simonbell
Halfop
Posts: 68
Joined: Mon Aug 05, 2002 8:07 pm
Location: Washington, England
Contact:

Post by simonbell »

hm, i think i need to expand on this a little as im not sure if it will be possible at all

the /who request comes from a separate command to give basic information on a nickname on a server. The nickname does not have to be in any specific channels.

On receiving various raw binds the information is added to a global array "userinfoarray-nick" which contains all the relevant information, including the nick of the person the /who and /whois is done on.

Everything is working, except for particular /who section. The problem is, even if i could work out how many lines are being passed to the bot by the /who command, i need to work out which nickname the initial request was about. If the /who returned these 2 values:
<E> [00:15] from: Devel.BeforeNET.org keyw: 352 arg: E * aooi58 usercf098.dsl.pipex.com Cubix.FL.US.BeforeNET.org bob H* :2 Simon David Bell
<E> [00:15] from: Devel.BeforeNET.org keyw: 352 arg: E * aooi58 usercf098.dsl.pipex.com Cubix.FL.US.BeforeNET.org notbad H* :2 Simon David Bell
In this situation, the information was requested about the user with nickname "notbad", however i cant see a way of adding information to the global array for that specific nickname when 2 nicknames have been returned.

Is this going to make the script impossible?

Simon
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

It's actualy more simple than you think.

One of the worst parts of IRC, is the fact it returns information from one command, before it moves to the next (with the exception of the /list command, which has been changes to prevent MaxQ errors) set of information.

Thus, if you request information, any /who data retured will be about one request. At the end of this request, a "END OF WHO" RAW is sent (see the RFC).

At this point, you can move any data to a global array for the current nickname being dealt with.
Locked