[REBOL] Re: SOAP
From: m:koopmans2:chello:nl at: 12-Jun-2001 12:53
I typed the chat client and server in Outlook without testing, and
immediately got a response that it didn't work. here are versions that are
tested ;-)
--Maarten
-- Attached file included as plaintext by Listar --
-- File: chat_serv.r
REBOL [ Title: {Rugby chat server}]
do %rugby_server.r
messages: make block! 600
msg-id: 0
add-message: func [ msg [string!]]
[
msg-id: msg-id + 1
append messages msg-id
append messages msg
return true
]
get-messages: func [ id [integer!] /local my-msg]
[
probe r-msg: copy find messages id
return r-msg
]
serve [add-message get-messages]
-- Attached file included as plaintext by Listar --
-- File: chat_client.r
REBOL [ Title: {Rugby chat client}]
do %rugby_client.r
last-msg-id: 1
send-message: func [msg [string!]]
[
rexec/oneway compose [add-message (msg)]
]
get-messages: func [ id [integer!] /local r-msg msg]
[
msg: make block! 600
r-msg: rexec compose [get-messages (id) ]
probe r-msg
foreach entry r-msg
[
if string? entry [append msg entry]
]
last-msg-id: first skip tail r-msg -1 ;Gets the last retrieved msg-id
return copy msg
]