/usr/share/mozart/doc/apptut/chat-client.oz is in mozart-doc 1.4.0-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | functor
import
Application(getCmdArgs) Pickle(load) Connection(take)
Viewer(chatWindow) at 'chat-gui.ozf'
define
Args = {Application.getCmdArgs
record(url(single type:string optional:false)
name(single type:string optional:false)
)}
NewsPort={Connection.take {Pickle.load Args.url}}
SelfPort
thread
{ForAll {Port.send NewsPort connect($)}
proc {$ Msg} {Port.send SelfPort Msg} end}
end
Chat = {New Viewer.chatWindow init(SelfPort)}
NAME = Args.name
{ForAll {Port.new $ SelfPort}
proc {$ Msg}
case Msg of msg(FROM TEXT) then
{Chat show(FROM#':\t'#TEXT)}
elseof say(TEXT) then
{Port.send NewsPort msg(NAME {ByteString.make TEXT})}
else skip end
end}
end
|