/* Comapi3.pkg */ defcom ComClosed = ComClosed;; defcom ComConnected = ComConnected S;; defcom AddLink = AddLink S S;; fun InitChat (nick,room)= { _setenv APIchn _envchannel _channel; set serverisroom=room; set servernick=nick; set serverIP=_channelIP _channel; set MyNick=_GETtext nickname; _status strcat strcat "On server: " nick ".\n"; set thischn=_channel; set thisenv=_envchannel _channel; _status "Module OK\n"; PHONEInit; _on _channel ChatACK [MyNick]; InitChatWindow; _on _channel NewUser [MyNick 0 _hostIP]; _on APIchn ComConnected [nick]; 0 };; fun APIengage ()= { set APIchn=_channel; _on APIchn ComConnected [servernick]; };; fun __ComAddLink (name,ln)= { __AddLink name ln; _on thischn AddLink [name ln] };; fun __ComClose ()= { _on APIchn ComClosed []; _killchannel thischn; };; fun _closed ()= { _status strcat strcat strcat strcat "Disconnected from " servernick " (" serverIP ").\n"; _on APIchn ComClosed []; _killchannel thischn; _killchannel APIchn; };; fun _connected ()= { _status "Connected.\n" };; fun __ComRedirectText (i)= { if (_channel==APIchn) then { set RedirectText=i; } else 0; };; fun __ComRedirectAudio (i)= { if (_channel==APIchn) then { set RedirectAudio=i; } else 0; };; fun __ComRedirectEvents (i)= { if (_channel==APIchn) then { set RedirectEvents=i; } else 0; };; fun __ComMinimizeClient ()= { if (_channel==APIchn) then { _SHOWwindow Chatw WINDOW_MINIMIZED; 0 } else 0; };; fun __ComRestoreClient ()= { if (_channel==APIchn) then { _SHOWwindow Chatw WINDOW_RESTORED; 0 } else 0; };; fun __ComMaximizeClient ()= { if (_channel==APIchn) then { _SHOWwindow Chatw WINDOW_MAXIMIZED; 0 } else 0; };; fun __ComHideClient ()= { if (_channel==APIchn) then { _SHOWwindow Chatw WINDOW_HIDDEN; 0 } else 0; };; fun __ComUnHideClient ()= { if (_channel==APIchn) then { _SHOWwindow Chatw WINDOW_UNHIDDEN; 0 } else 0; };; fun __ComSetFocusClient ()= { if (_channel==APIchn) then { _SETfocus Chatw; 0 } else 0; };; fun __ComSendText (s)= { if (_channel==APIchn) then { _on thischn Hear [s]; } else 0; };; fun __ComRecordOn ()= { if (_channel==APIchn) then { Record; } else 0; };; fun __ComRecordOff ()= { if (_channel==APIchn) then { PauseRecord; } else 0; };; fun __ComLoadPack (pack,sc)= { if (_channel==APIchn) then { _load pack; if (sc!=nil) then { _script sc; 0 } else 0; } else 0; };; fun __ComMove (x,y)= { if (_channel==APIchn) then { _MVwindow Chatw x y; 0 } else 0; };;