[REBOL] Re: Advanced port stuff
From: ptretter:primary at: 8-Jan-2001 8:52
Actually what I am currently doing is assigning any dcc ports to a word that
matches the users nick and then inserting that port scheme into waitports.
This is done after the script is initially executed as dcc ports are opened
and closed. My waitports block contains all ports to be opened. First port
in the block is actually the irc port itself for connecting the irc bot to
the server. which I can find by doing the following:
find waitports 'irc-open-port
But if I want to find one of the dynamic dcc ports its a bit more
complicated. I would have to know the nick of the user that opened the port
since this name is used as the word to assign that port scheme to. For
exampe if user "Somenick" requests a dcc session with the bot then the bot
will create a port and insert "Somenick" within the waitports block. Now if
I try to find this "Somenick" dcc port here is the strange part:
find waitports 'somenick
I will get an error that somenick as no value. But if I do:
find waitports somenick
I will get the object spec that is the value of "somenick". Probing
waitports never reveals this "somenick" set-word datatype anywhere. Find is
the only way I have come to reveal it and you must know the set-word
datatype that your looking for. Actually, I found solutions to make the
whole thing work with opening and properly closing the ports, etc.. It works
very nicely. I just wish probe would reveal everything within the block.
As you may assume troubleshooting was a real pain.
Paul Tretter
P.S. the reason I do this assignment to the users nick is because I wont to
ensure no unnecessary ports are opened and that dcc flooding is minimized.
Since IRC only allows unique nicks this ensures that each user has one dcc
session open at a time. They can open another under a different nick but if
they open another under their same nick it closes the previous one.