home *** CD-ROM | disk | FTP | other *** search
/ Treasure Hunt 2001 PRESSKIT / TH2001_PRESSKIT.iso / demo / scol_install / Partition / comm / comclient.pkg < prev    next >
Encoding:
Text File  |  2000-09-18  |  1.6 KB  |  69 lines

  1. /* comclient.pkg */
  2.  
  3. defcom ComAPIok = ComAPIok;; 
  4. defcom ChatNAck = ChatNACK S S;; 
  5.  
  6. fun __APIstart ()= 
  7.   let _channelIP _channel -> a in 
  8.   if (strcmp a _hostIP) && (strcmp a "127.0.0.1") then 
  9.   { 
  10.     _on _channel status ["This client is not authorised to connect to this server.\nOnly local connections are allowed."]; 
  11.     _delline _channel; 
  12.     _on _channel ChatNAck ["" "Line already created"]; 
  13.     _closechannel; 
  14.     0 
  15.   } 
  16.   else 
  17.   { 
  18.     _setenv _channel serverenv; 
  19.     _load "comm/comAPI.pkg"; 
  20.     _script "APIMain"; 
  21.     _on _channel ComAPIok []; 
  22.     0 
  23.   } 
  24. };;
  25.  
  26. defcom InitChat = InitChat S I;;
  27.  
  28. fun ChatStart (o,nick,i)=
  29.   let (findline Lines (_channelIP _channel))-> line in
  30.   if ((i==1) && line!=nil) then 
  31.   {          
  32.     _fooS "LINES NIL";
  33.     set Lines=_channel::Lines; 
  34.     _setenv _channel serverenv; 
  35.     _load "comm/comphone.pkg"; 
  36.     _load "comm/comchat.pkg"; 
  37.     _script mkscript InitChat [nick ChatRoom];
  38.   }
  39.   else 
  40.   {
  41.     _fooS "LINES PAS NIL";
  42.     _on _channel ChatNAck ["" "Chat refused by pair."]; 
  43.     _closechannel; 
  44.     nil
  45.   }
  46. ;;
  47.  
  48. fun __ChatStart (nick)= 
  49.   if findline Lines (_channelIP _channel) then 
  50.   { 
  51.     _fooS "Line Allready connected"; 
  52.     _delline _channel; 
  53.     _on _channel ChatNAck ["" "Line already created"]; 
  54.     _closechannel; nil 
  55.   } 
  56.   else 
  57.     _DLGrflmessage (_DLGMessageBox _channel nil loc "INCOMING" strloc loc "INCOM2" nick::(_channelIP _channel)::nil 1) @ChatStart nick
  58. ;;
  59.  
  60. fun _connected ()= 
  61.   _status "Client connected.\n"; 
  62. };; 
  63.  
  64. fun _closed ()= 
  65. _delline _channel /*  _closemachine*/
  66. ;;
  67.