[REBOL] Re: Advanced port stuff
From: ptretter:primary at: 5-Jan-2001 8:53
Ok, so far the answers relating to objects I have all ready known but
appreciate your input. I think the complexity is that these objects are
port objects that have been added to a block. The block is referenced by the
word 'waitports. waitports contains the port objects which are appended to
it dynamically as the script runs. For example if waitports contained three
port objects - then the following:
>> print waitports
?port? ?port? ?port?
ok print now this:
>> print first waitports
irc-open-port
now I try moving the index to get the literal of the second port since the
first port responded correctly:
waitports: next waitports
>> print first waitports
?port?
I notice that it shows only one ?port? instead of two and it didnt give me
the literal word referencing that port object. Is this a bug or is there
new information we need to document regarding objects appended to blocks
when they are port datatypes.
As you can see this script deals with IRC. The first port in the block is
the port object for the irc server itself. The next port and subsequent
ports are for dcc ports that are dynamically added to the block while the
script is online and active on irc. These dcc ports objects are assigned to
the nickname of the user on irc (since each user must have a unique nickname
on the irc network). This assignment was done with this function in my
script:
dcc-parser: does [
if secured [
if dcc-chat-flag [
dcc-client: message/nick
dcc-client-port: message/dataparse/5
dcc-connect: [
scheme: 'tcp
host: dcc-ip
port-id: to-integer dcc-client-port
]
either error? error-dcc-open-client: try [dcc-open-client:
open/lines/direct/no-wait dcc-connect][
error-dcc-open-client: disarm error-dcc-open-client
error-proc error-dcc-open-client
][
insert dcc-open-client read %help.txt
dcctemp: :dcc-client
dcctemp: make set-word! :dcctemp
mold dcctemp :dcc-open-client
append waitports get make word! copy :dcc-client
dcc-chat-flag: off
dcc-client-port: dcc-connect: none
]
]
]
]
message/nick above is the object containing the nickname of the user from
the ircparser function (not listed). As you can see from the third line
from the bottom of the function the port is appended to waitports. The
script does everything I want it to do. However, I am getting ready to add
more code to this function to perform some logic based on the literals
within waitports block. Thats is what Im having trouble determining since
its dynamically assigned during execution. Hope this helps.
Paul Tretter