home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / RADOOR30.ZIP / ALONE.PAS next >
Encoding:
Pascal/Delphi Source File  |  1994-04-10  |  7.6 KB  |  307 lines

  1. {╔═════════════════════════════════════════════════════════════════════════╗
  2.  ║                                                                         ║
  3.  ║                   (c) CopyRight LiveSystems 1990, 1994                  ║
  4.  ║                                                                         ║
  5.  ║ Author    : Gerhard Hoogterp                                            ║
  6.  ║ FidoNet   : 2:282/100.5   2:283/7.33                                    ║
  7.  ║ BitNet    : GERHARD@LOIPON.WLINK.NL                                     ║
  8.  ║                                                                         ║
  9.  ║ SnailMail : Kremersmaten 108                                            ║
  10.  ║             7511 LC Enschede                                            ║
  11.  ║             The Netherlands                                             ║
  12.  ║                                                                         ║
  13.  ║        This module is part of the RADoor BBS doorwriters toolbox.       ║
  14.  ║                                                                         ║
  15.  ╚═════════════════════════════════════════════════════════════════════════╝}
  16.  
  17. Unit Alone;
  18. Interface
  19. Uses Dos,
  20.      CRT,
  21.      FileObj,
  22.      GlobInfo;    { The globale info. Thisone needs to be filled      }
  23.  
  24. Const  NoBBS = 3; { This is a unike BBS tag to indentify the current  }
  25.                   { BBS in the global info. Make tags for other BBSes }
  26.                   { Also unike, at least for your own programs!       }
  27.  
  28.  
  29. Procedure InitNoBBS;
  30. Function NoBBSUpdateExitInfo:Boolean;
  31.  
  32. Implementation
  33. Uses LowLevel; { To avoid a circular reference error }
  34.  
  35. Const UseLog : Boolean = False; { Is set to TRUE as soon as a LogProcedure }
  36.                                 { is installed                             }
  37.  
  38.  
  39. Var   NoPath : ComStr;
  40.  
  41. {$F+}
  42. Procedure FroDoLogIt(LogLine  : MaxlogStr);
  43. {$F-}
  44.  
  45. Var Log    : Text;
  46.     temp   : Integer;
  47.     Hour   : Word;
  48.     Minute : Word;
  49.     Second : Word;
  50.     Dum    : Word;
  51.  
  52. Begin
  53. If Not UseLog
  54.    Then Exit;
  55. GetTime(Hour,Minute,Second,Dum);
  56. LogLine:= '> '+
  57.           S(Hour,2)+':'+
  58.           S(Minute,2)+':'+
  59.           S(Second,2)+'  '+
  60.           LogLine;
  61. For Dum:=3 To 10 Do
  62.  If LogLine[Dum]=' '
  63.     Then LogLine[Dum]:='0';
  64.  
  65. FileMode:=ReadWrite+ShareDenyNone;
  66. Assign(Log,GlobalInfo.LogFileName);
  67. Append(Log);
  68. If IoResult<>0
  69.    Then Rewrite(Log);
  70. WriteLn(Log,LogLine);
  71. Close(Log);
  72. If IoResult<>0
  73.    Then Begin
  74.         WriteLn(#254' Can''t LOG anymore !!!');
  75.         UseLog:=False;
  76.         End;
  77. End;
  78.  
  79. {---- Read CONFIG record -------------------------------------------------}
  80.  
  81. Function ReadConfig:Boolean;
  82. Var Conf : FileObject;
  83.     Size : Word;
  84. Begin
  85. ReadConfig:=False;
  86.  
  87. With GlobalInfo Do
  88.  Begin
  89.  BBStag  := NoBBS;
  90.  BBSName := 'StandAlone';
  91.  
  92.  OnlineStatus:=Normal;
  93.  SystemStatus:=S_OK;
  94.  
  95.  LogfileName   := 'NoBBS.LOG';
  96.  LogType       := 1;
  97.  LogIt := FrodoLogIt;
  98.  
  99.  UseLog        := True;
  100.  TimeOutTime   := 24*60;
  101.  Warnings      := 2; { My constate! }
  102.  
  103.  UserFilePath  := '';
  104.  
  105.  CommonDir     := '';
  106.  
  107.  LeftBracket   := '(';
  108.  RightBracket  := ')';
  109.  
  110.  SysopName     := 'Stand Alone';
  111.  SystemName    := 'NoBBS';
  112.  SystemLocation:= 'Here';
  113.  
  114.  LocalMono     := False;
  115.  
  116.  ComPort       := 0;
  117.  
  118.  MultiLine     := True;
  119.  End; {With}
  120.  
  121. ReadConfig  := True;
  122. End;
  123.  
  124. {---- ExitInfo.bbs procedures -----------------------------------------}
  125.  
  126.  
  127. Function AskName:NameString;
  128. Var Temp : NameString;
  129.     Stop : Boolean;
  130.     Key  : Char;
  131.     Ext  : Boolean;
  132. Begin
  133. Temp:='';
  134. Repeat
  135.  Stop:=False;
  136.  Repeat
  137.   If KeyPressed
  138.      Then Begin
  139.           Key:=Readkey;
  140.           If Key=#00
  141.              Then Key:=ReadKey
  142.              Else Ext:=False;
  143.           If Not Ext
  144.              Then Stop:=Key in ['A'..'Z','a'..'z',#8,#13,'''',' ',#27];
  145.           End;
  146.  Until Stop;
  147.  
  148.  Case UpCase(Key) Of
  149.   'A'..'Z',
  150.   '-',
  151.   '''' : Begin
  152.          If (Length(Temp)=0) Or
  153.             (Temp[Length(Temp)]=' ')
  154.             Then Key:=UpCase(Key)
  155.             Else Key:=Chr(Ord(Upcase(Key))+32);
  156.          Temp:=Temp+Key;
  157.          End;
  158.   ' '  : Temp:=Temp+' ';
  159.   #08  : Begin
  160.          Dec(Temp[0]);
  161.          Write(#8' ');
  162.          End;
  163.   #13  : Begin
  164.          AskName:=Temp;
  165.          Exit;
  166.          End;
  167.   #27  : Begin
  168.          Temp:='';
  169.          AskName:='';
  170.          Exit;
  171.          End;
  172. End; {Case}
  173. Write(Key);
  174. Until False;
  175. End;
  176.  
  177. Function ReadExitInfo:Boolean;
  178. Var C: Byte;
  179. Begin
  180. ReadExitInfo:=False;
  181.  
  182. With GlobalInfo Do
  183.  Begin
  184.  
  185.  ScreenWidth  := 80;
  186.  
  187.  If Not ExistParameter('NAME:')
  188.     Then Begin
  189.          TextAttr:=$0F;
  190.          ClrScr;
  191.          TextAttr:=$1F;
  192.          Write(Center('-=( Standalone operation )=-'));
  193.          ClrEol;
  194.          TextAttr:=$0B;
  195.          WriteLn;
  196.          WriteLn;
  197.          Write('Please enter your name: ');
  198.          TextAttr:=$0F;
  199.          UserName:=AskName;
  200.          End
  201.     Else Begin
  202.          UserName:=GrabParameter('NAME:');
  203.          For C:=1 To Length(UserName) Do
  204.           If UserName[C]='_'
  205.              Then UserName[C]:=' ';
  206.          UserName:=FormatLine(UserName);
  207.          End;
  208.  
  209.  If UserName=''
  210.     Then Halt;
  211.  
  212.  LogIt(UserName+' on-line at '+TimeStamp);
  213.  
  214.  SysOpName    := UserName;
  215.  UserHandle   := UserName;
  216.  UserLocation := 'Somewhere here';
  217.  UserSecurity := $FFFF;
  218.  
  219.  UserBirthDay := '00/00/00';
  220.  UserAge      := 00;
  221.  UserGroup    := 00;
  222.  
  223.  
  224.  ScreenLength := 24;
  225.  UseGraphics  := True;
  226.  UseAVATAR    := True;
  227.  UseMoreYN    := True;
  228.  UseClrScr    := True;
  229.  UseQuietMode := False;
  230.  BaudRate     := 0;
  231.  MinRemaining := $600;
  232.  TimeLimit    := $600;
  233.  End; {With}
  234.  
  235. ReadExitInfo:= True;
  236. End;
  237.  
  238.  
  239.  
  240. {--------------------------------------------------------------------------|
  241.   -T:<Time>     Maximal time in this door, overrules the EXITINFO.BBS setting
  242.                 The time has to be given in minutes. Mostly here for
  243.                 compatability with RAdoor 2.3
  244.   -N:<Node>     Node number, there's no other way under RA. Defaults to node 1
  245.   -P:<CommPort> Overrules the CONFIG.RA Comport setting. Usefull for multiline
  246.                 Systems.
  247.   -NOS          Turns off local noise for default.
  248.  
  249.   Further the GlobalInfo variables SystemPath and HomeDir are filled:
  250.  
  251.   HomeDir       The directory from where the door was fired up. I usual
  252.                 use this directory to look for auxilary files. The homedir
  253.                 is found by stripping the filename of ParamStr(0). The user
  254.                 can ALWAYS overrule this value by setting an environment
  255.                 variable <PROGNAME> with an other path. PROGNAME is the REAL
  256.                 name of the program (the EXE file) minus the path and the
  257.                 extention!
  258.  
  259. |--------------------------------------------------------------------------}
  260.  
  261.  
  262.  
  263. Procedure InitNoBBS;
  264.  
  265. Var ProgName : String[8];
  266.     Dum      : String[4];
  267.     TTime    : Word;
  268.  
  269. Begin
  270. FillChar(GlobalInfo,SizeOf(GlobalInfo),#00);
  271. NoPath:=GetEnv('NoBBS');
  272. CompletePath(NoPath);
  273. GlobalInfo.SystemPath:=NoPath;
  274.  
  275. FSplit(ParamStr(0),GlobalInfo.HomeDir,ProgName,Dum);
  276. If GetEnv(ProgName)<>''
  277.    Then GlobalInfo.HomeDir:=GetEnv(ProgName);
  278. If GlobalInfo.HomeDir<>''
  279.    Then CompletePath(GlobalInfo.HomeDir);
  280.  
  281. GlobalInfo.Node:=Str2Nr(GrabParameter('N:'));
  282. If GlobalInfo.Node=0
  283.    Then GlobalInfo.Node:=1;
  284.  
  285. If Not ReadConfig
  286.    Then ;
  287.  
  288. If Not ReadExitInfo
  289.    Then ;
  290.  
  291. If ExistParameter('L:')
  292.    Then GlobalInfo.Language:=GrabParameter('L:')
  293.    Else GlobalInfo.Language:='ENG';
  294. End;
  295.  
  296.  
  297. Function NoBBSUpdateExitInfo:Boolean;
  298. Begin
  299.  
  300. LogIt('User finished program.'#10#13);
  301. NoBBSUpdateExitInfo:=True;
  302. End;
  303.  
  304.  
  305. Begin
  306. End.
  307.