home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / RADOOR30.ZIP / RA.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-04-10  |  28.8 KB  |  840 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.  Description:
  18.  
  19.   This unit contains all the RA specific stuff. It's main purpose is to
  20.   fill the GlobalInfo record. Doing things this way it's easier to make a
  21.   door less system dependable. As long as you only use the information
  22.   in GlobalInfo in your doors, it's easy to make versions for other BBSses
  23.   or to add support for more than one BBS. (Detect in your mainprogram and
  24.   call the right initprocedure!)
  25.  
  26.   If an other BBS doesn't support some information which is contained in the
  27.   GlobalInfo record, it's up to YOU to provide usable values!
  28.  
  29. |--------------------------------------------------------------------------}
  30. {$Define UseMultilanguage} { Turn multilang in logfunction on/off }
  31.  
  32. Unit RA;
  33. Interface
  34. Uses Dos,
  35.      CRT,
  36. {$IfDef UseMultiLanguage}
  37.      Language, { MultiLanguage support, needed for Logging    }
  38. {$EndIf}
  39.      FileObj,  { Typed file handling object                   }
  40.      Fossil,   { Fossil object, needed for online msgs.       }
  41.      GlobInfo; { The globale info. Thisone needs to be filled }
  42.  
  43. Const  RABBS = 1; { This is a unike BBS tag to indentify the current  }
  44.                   { BBS in the global info. Make tags for other BBSes }
  45.                   { Also unike, at least for your own programs!       }
  46.  
  47.  
  48.  
  49. {--------------------------------------------------------------------------|
  50.   All the RA Structures for RA 1.00
  51. |--------------------------------------------------------------------------}
  52.  
  53. Type RAFlagType     = Array[1..4] of Byte;
  54.      RATime         = String[5];
  55.      RADate         = String[8];
  56.      RALongDate     = String[9];
  57.      RAVideoType    = (Auto, Short, Long);
  58.      RAOrphanType   = (Ignore, Create, Kill);
  59.  
  60.  
  61. Type  RACOMBINEDrecord = Array[1..25] of Byte;
  62.       RANameString     = String[35];
  63.  
  64. Var RAPath : ComStr;
  65.  
  66.  
  67. Type RANetAddress   = Record
  68.                        Zone,
  69.                        Net,
  70.                        Node,
  71.                        Point  : Word;
  72.                       End;
  73.  
  74.      RAAskType      = (Yes, No, Ask);
  75.  
  76.      RALANGUAGErecord = Record
  77.                           Name           : String[20];
  78.                           Attribute      : Byte;
  79.                           DefName,
  80.                           MenuPath,
  81.                           TextPath,
  82.                           QuesPath       : String[60];
  83.                           FreeSpace      : Array[1..200] of Byte;
  84.                         End;
  85.  
  86.       RACONFIGrecord = Record
  87.                          VersionID           : Word;
  88.                          CommPort            : Byte;
  89.                          Baud                : LongInt;
  90.                          InitTries           : Byte;
  91.                          InitStr,
  92.                          BusyStr             : String[70];
  93.                          InitResp,
  94.                          BusyResp,
  95.                          Connect300,
  96.                          Connect1200,
  97.                          Connect2400,
  98.                          Connect4800,
  99.                          Connect9600,
  100.                          Connect19k,
  101.                          Connect38k          : String[40];
  102.                          AnswerPhone         : Boolean;
  103.                          Ring,
  104.                          AnswerStr           : String[20];
  105.                          FlushBuffer         : Boolean;
  106.                          ModemDelay          : Integer;
  107.  
  108.                          MinimumBaud,
  109.                          GraphicsBaud,
  110.                          TransferBaud        : Integer;
  111.                          SlowBaudTimeStart,
  112.                          SlowBaudTimeEnd,
  113.                          DownloadTimeStart,
  114.                          DownloadTimeEnd     : RATime;
  115.  
  116.                          PageStart           : Array[0..6] of RATime;
  117.                          PageEnd             : Array[0..6] of RATime;
  118.  
  119.  
  120.  
  121.                      {}  FreeSpace1          : Array[1..70] of Byte;
  122.                          PwdExpiry           : Word;
  123.  
  124.                          MenuPath,
  125.                          TextPath,
  126.                          AttachPath,
  127.                          NodelistPath,
  128.                          MsgBasePath,
  129.                          SysPath,
  130.                          ExternalEdCmd       : String[60];
  131.  
  132.                          Address             : Array[0..9] of RANetAddress;
  133.                          SystemName          : String[30];
  134.  
  135.                          NewSecurity         : Word;
  136.                          NewCredit           : Word;
  137.                          NewFlags            : RAFlagType;
  138.  
  139.                          OriginLine          : String[60];
  140.                          QuoteString         : String[15];
  141.                          Sysop               : String[35];
  142.                          LogFileName         : String[60];
  143.                          FastLogon,
  144.                          AllowSysRem,
  145.                          MonoMode,
  146.                          StrictPwdChecking,
  147.                          DirectWrite,
  148.                          SnowCheck           : Boolean;
  149.                          CreditFactor        : Integer;
  150.  
  151.                          UserTimeOut,
  152.                          LogonTime,
  153.                          PasswordTries,
  154.                          MaxPage,
  155.                          PageLength          : Word;
  156.                          CheckForMultiLogon,
  157.                          ExcludeSysopFromList,
  158.                          OneWordNames        : Boolean;
  159.                          CheckMail           : RAAskType;
  160.                          AskVoicePhone,
  161.                          AskDataPhone,
  162.                          DoFullMailCheck,
  163.                          AllowFileShells,
  164.                          FixUploadDates,
  165.                          FreezeChat          : Boolean;
  166.                          ANSI,                             { ANSI: Yes, no, or ask new users     }
  167.                          ClearScreen,                      { Clear:        "                     }
  168.                          MorePrompt          : RAAskType;    { More:         "                     }
  169.                          UploadMsgs          : Boolean;
  170.                          KillSent            : RAAskType;    { Kill/Sent     "                     }
  171.  
  172.                          CrashAskSec         : Word;       { Min sec# to ask 'Crash Mail ?'      }
  173.                          CrashAskFlags       : RAFlagType;
  174.                          CrashSec            : Word;       { Min sec# to always send crash mail. }
  175.                          CrashFlags          : RAFlagType;
  176.                          FAttachSec          : Word;       {        "    ask 'File Attach ?'     }
  177.                          FAttachFlags        : RAFlagType;
  178.  
  179.                          NormFore,
  180.                          NormBack,
  181.                          StatFore,
  182.                          StatBack,
  183.                          HiBack,
  184.                          HiFore,
  185.                          WindFore,
  186.                          WindBack,
  187.                          ExitLocal,
  188.                          Exit300,
  189.                          Exit1200,
  190.                          Exit2400,
  191.                          Exit4800,
  192.                          Exit9600,
  193.                          Exit19k,
  194.                          Exit38k             : Byte;
  195.  
  196.                          MultiLine           : Boolean;
  197.                          MinPwdLen           : Byte;
  198.                          MinUpSpace          : Word;
  199.                          HotKeys             : RAAskType;
  200.                          BorderFore,
  201.                          BorderBack,
  202.                          BarFore,
  203.                          BarBack,
  204.                          LogStyle,
  205.                          MultiTasker,
  206.                          PwdBoard            : Byte;
  207.                          BufferSize          : Word;
  208.                          FKeys               : Array[1..10] of String[60];
  209.  
  210.                          WhyPage             : Boolean;
  211.                          LeaveMsg            : Byte;
  212.                          ShowMissingFiles    : Boolean;
  213.                      {}  FreeSpace2          : Array[1..11] of Byte;
  214.                          AllowNetmailReplies : Boolean;
  215.                          LogonPrompt         : String[40];
  216.                          CheckNewFiles       : RAAskType;
  217.                          ReplyHeader         : String[60];
  218.                          BlankSecs           : byte;
  219.                          ProtocolAttrib      : Array[1..6] of Byte;
  220.                          ErrorFreeString     : String[15];
  221.                          DefaultCombined     : RACOMBINEDrecord;
  222.                          RenumThreshold      : Word;
  223.                          LeftBracket,
  224.                          RightBracket        : Char;
  225.                          AskForHandle        : Boolean;
  226.                          AskForBirthDate     : Boolean;
  227.  
  228.                          GroupMailSec        : Word;
  229.  
  230.                          ConfirmMsgDeletes   : Boolean;
  231.                          FreeSpace3          : Array[1..163] of Byte;
  232.                          NewUserGroup        : Byte;
  233.                          AVATAR              : RAAskType;
  234.                          BadPwdArea          : Byte;
  235.                          Location            : String[40];
  236.                          DoAfterAction       : Byte; {0 = wait for CR, > 0 = wait for x seconds}
  237.                          FileLine            : String[40];
  238.                          CRfore,
  239.                          CRback              : Byte;
  240.                          LangHdr             : String[40];
  241.                          SendBreak           : Boolean;
  242.                          ListPath            : String[60];
  243.                          FullMsgView         : RAAskType;
  244.                          EMSI_Enable         : RAAskType;
  245.                          EMSI_NewUser        : Boolean;
  246.  
  247.                          EchoChar            : String[1];
  248.                          Connect7200,
  249.                          Connect12000,
  250.                          Connect14400        : String[40];
  251.                          Exit7200,
  252.                          Exit12000,
  253.                          Exit14400           : Byte;
  254.                          ChatCommand         : String[60];
  255.                          ExtEd               : RAAskType;
  256.                          NewuserLanguage     : Byte;
  257.                          LanguagePrompt      : String[40];
  258.                          VideoMode           : RAVideoType;
  259.                          AutoDetectANSI      : Boolean;
  260.                          OffHook             : Boolean;
  261.                          NewUserDateFormat   : Byte;
  262.                          KeyboardPwd         : String[15];
  263.                          CapLocation         : Boolean;
  264.                          NewuserSub          : Byte;
  265.                          PrinterName         : String[4];
  266.                          HilitePromptFore,
  267.                          HiLitePromptBack    : Byte;
  268.                          InitStr2            : String[70];
  269.                          AltJSwap            : Boolean;
  270.                          SemPath             : String[60];
  271.                          AutoChatCapture     : Boolean;
  272.  
  273.                          FutureExpansion : Array[1..97] of Byte;
  274.                        End;
  275.  
  276.   RAUSERSXIrecord  = record
  277.                        Handle         : String[35];
  278.                        Comment        : String[80];
  279.                        FirstDate      : RADate;
  280.                        CombinedInfo   : RACOMBINEDrecord;
  281.                        BirthDate,
  282.                        SubDate        : RADate;
  283.                        ScreenWidth,
  284. {1.10}                 MsgArea,
  285.                        FileArea,
  286.                        Language,
  287.                        DateFormat     : Byte;
  288.                        ForwardTo      : String[35];
  289.                        ExtraSpace     : Array[1..43] of Byte;
  290.                      end;
  291.  
  292.  
  293.        RAUsersRecord   = Record
  294.                           Name          : RANameString;
  295.                           Location      : String[25];
  296.                           Password      : String[15];
  297.                           DataPhone,
  298.                           VoicePhone    : String[12];
  299.                           LastTime      : RATime;
  300.                           LastDate      : RADate;
  301.                           Attribute     : Byte;
  302.                           Flags         : RAFlagType;
  303.                           Credit,
  304.                           Pending       : Word;
  305.                           MsgsPosted,
  306.                           LastRead,
  307.                           Security,
  308.                           NoCalls,
  309.                           Uploads,
  310.                           Downloads,
  311.                           UploadsK,
  312.                           DownloadsK    : Word;
  313.                           TodayK        : Word;
  314.                           Elapsed       : Integer;
  315.                           ScreenLength  : Word;
  316.                           LastPwdChange,
  317.                           Attribute2    : Byte;
  318.                           Group         : Byte;
  319.     { New 1.0 }           XIRecord      : Word;
  320.                           ExtraSpace    : Array[1..3] of Byte;
  321.                          End;
  322.  
  323.      RASysInfoRecord = Record
  324.                         TotalCalls  : LongInt;
  325.                         LastCaller  : RANameString;
  326.                         ExtraSpace  : Array[1..128] of Byte;
  327.                        End;
  328.  
  329.      RATimeLogRecord = Record
  330.                         StartDate   : RADate;
  331.                         BusyPerHour : Array[0..23] of Word;
  332.                         BusyPerDay  : Array[0..6] of Word;
  333.                        End;
  334.  
  335.      RAEventRecord    = Record
  336.                          Status      : Byte; { 0=Deleted 1=Enabled 2=Disabled }
  337.                          StartTime   : RATime;
  338.                          ErrorLevel  : Byte;
  339.                          Days        : Byte;
  340.                          Forced      : Boolean;
  341.                          LastTimeRun : RADate;
  342.                         End;
  343.  
  344.      RAExitInfoRecord = Record
  345.                          Baud            : Word;
  346.                          SysInfo         : RASysInfoRecord;
  347.                          TimeLogInfo     : RATimeLogRecord;
  348.                          UserInfo        : RAUsersRecord;
  349.                          EventInfo       : RAEventRecord;
  350.                          NetMailEntered,
  351.                          EchoMailEntered : Boolean;
  352.                          LoginTime       : RATime;
  353.                          LoginDate       : RADate;
  354.                          TimeLimit       : Word;
  355.                          LoginSec,
  356.                          Credit          : LongInt;
  357.                          UserRecord      : Integer;
  358.                          ReadThru        : Word;
  359.                          NumberPages     : Word;
  360.                          DownloadLimit   : Word;
  361.                          TimeOfCreation  : RATime;
  362.                          LogOnPassword   : String[15];
  363.                          WantChat        : Boolean;
  364.   { New 1.0 }
  365.                          DeductedTime    : Integer;
  366.                          MenuStack       : Array[1..50] of String[8];
  367.                          MenuStackPointer: Byte;
  368.                          UserXIinfo      : RAUSERSXIrecord;
  369.                          ErrorFreeConnect,
  370.                          SysopNext       : Boolean;
  371.                          EMSI_Session    : Boolean;        { These fields hold  }
  372.                          EMSI_Crtdef,                      { data related to an }
  373.                          EMSI_Protocols,                   { EMSI session       }
  374.                          EMSI_Capabilities,
  375.                          EMSI_Requests,
  376.                          EMSI_Software   : String[40];
  377.                          Hold_Attr1,
  378.                          Hold_Attr2,
  379.                          Hold_Len        : Byte;
  380.  
  381.                          ExtraSpace      : Array[1..100] of Byte;
  382.                        End;
  383.  
  384.  
  385. {--------------------------------------------------------------------------|
  386.   Variables which contain the CONFIG.RA and the EXITINFO.BBS info. Note
  387.   that I included RA in the variable name to avoid conflicts with the names
  388.   of other BBS's their configuration files.
  389. |--------------------------------------------------------------------------}
  390.  
  391. Var RAExitInfo  : RAExitInfoRecord;
  392.     RAConfig    : RAConfigRecord;
  393.  
  394. {--------------------------------------------------------------------------|
  395.   And the procedures to read and write the configuration info.
  396.  
  397.   InitRA should be called once at the start of your program to initialize
  398.          your door for RemoteAccess.
  399.  
  400.   UpdateExitInfo
  401.          Rewrites the EXITINFO.BBS Record. To avoid problems with newer
  402.          version of RA, which probably add fields to this file, only
  403.          as much bytes are read and written as the size of the record
  404.          defined in this unit. As long as the file is upward compatible
  405.          this should avoid conflicts.
  406.          The function returns false if it wasn't able to write the info.
  407.  
  408.          The users TimeLimit and Security are always updated while writing,
  409.          Other field you have to change for yourself.
  410.  
  411. |--------------------------------------------------------------------------}
  412.  
  413.  
  414. Procedure InitRA;
  415. Function RAUpdateExitInfo:Boolean;
  416.  
  417. Implementation
  418. Uses LowLevel; { To avoid a circular reference error }
  419.  
  420. Const UseLog : Boolean = False; { Is set to TRUE as soon as a LogProcedure }
  421.                                 { is installed                             }
  422.  
  423. {$F+}
  424. Procedure FroDoLogIt(LogLine  : MaxlogStr);
  425. {$F-}
  426.  
  427. Var Log    : Text;
  428.     temp   : Integer;
  429.     Hour   : Word;
  430.     Minute : Word;
  431.     Second : Word;
  432.     Dum    : Word;
  433.  
  434. Begin
  435. If Not UseLog
  436.    Then Exit;
  437. {$IfDef UseMultiLanguage}
  438.   LogLine:=ExpandString(LogLine);
  439. {$EndIf}
  440. GetTime(Hour,Minute,Second,Dum);
  441. LogLine:= '> '+
  442.           S(Hour,2)+':'+
  443.           S(Minute,2)+':'+
  444.           S(Second,2)+'  '+
  445.           LogLine;
  446. For Dum:=3 To 10 Do
  447.  If LogLine[Dum]=' '
  448.     Then LogLine[Dum]:='0';
  449.  
  450. FileMode:=ReadWrite+ShareDenyNone;
  451. Assign(Log,GlobalInfo.LogFileName);
  452. Append(Log);
  453. If IoResult<>0
  454.    Then Rewrite(Log);
  455. WriteLn(Log,LogLine);
  456. Close(Log);
  457. If IoResult<>0
  458.    Then Begin
  459.         WriteLn(#254' Can''t LOG anymore !!!');
  460.         UseLog:=False;
  461.         End;
  462. End;
  463.  
  464. Const Months : Array[1..12] Of String[3] =
  465.        ('Jan','Feb','Mar','Apr','May','Jun',
  466.         'Jul','Aug','Sep','Oct','Nov','Dec');
  467.  
  468. {$F+}
  469. Procedure OpusLogIt(LogLine  : MaxlogStr);
  470. {$F-}
  471.  
  472. Var Log    : Text;
  473.     temp   : Integer;
  474.     Hour   : Word;
  475.     Minute : Word;
  476.     Second : Word;
  477.     Dum    : Word;
  478.     Day    : Word;
  479.     Month  : Word;
  480.  
  481. Begin
  482. If Not UseLog
  483.    Then Exit;
  484. {$IfDef UseMultiLanguage}
  485.   LogLine:=ExpandString(LogLine);
  486. {$EndIf}
  487. GetTime(Hour,Minute,Second,Dum);
  488. GetDate(Dum,Month,Day,Dum);
  489. LogLine:= '> '+
  490.           S(Day,2)+'-'+
  491.           Months[Month]+' '+
  492.           S(Hour,2)+':'+
  493.           S(Minute,2)+':'+
  494.           S(Second,2)+' '+
  495.           'RA'+S(GlobalInfo.Node,2)+' '+
  496.           LogLine;
  497.  
  498. If LogLine[3]=' '
  499.    Then LogLine[3]:='0';
  500. If LogLine[21]=' '
  501.    Then LogLine[21]:='0';
  502.  
  503.  
  504. For Dum:=10 To 17 Do
  505.  If LogLine[Dum]=' '
  506.     Then LogLine[Dum]:='0';
  507.  
  508. FileMode:=ReadWrite+ShareDenyNone;
  509. Assign(Log,GlobalInfo.LogFileName);
  510. Append(Log);
  511. If IoResult<>0
  512.    Then Rewrite(Log);
  513. WriteLn(Log,LogLine);
  514. Close(Log);
  515. If IoResult<>0
  516.    Then Begin
  517.         WriteLn(#254' Can''t LOG anymore !!!');
  518.         UseLog:=False;
  519.         End;
  520. End;
  521.  
  522. {---- Language support ---------------------------------------------------}
  523.  
  524. Type LangID = String[3];
  525.  
  526. Function ReadRALanguage(Nr : Byte):LangID;
  527. Var Lang    : FileObject;
  528.     LangRec : RALanguageRecord;
  529.     Dum     : String[10];
  530.     FName   : String[8];
  531.  
  532. Begin
  533. ReadRALanguage:='English';
  534. If Nr=0
  535.    Then Exit;
  536. With Lang Do
  537.  Begin
  538.  Open(GlobalInfo.SystemPath+'LANGUAGE.RA',SizeOf(LangRec),ReadOnly+ShareDenyNone);
  539.  GotoRecord(Nr-1);
  540.  If IoError<>0
  541.     Then GotoRecord(0);
  542.  Read(LangRec);
  543.  Close;
  544.  If IoError<>0
  545.     Then Exit;
  546.  End;
  547. FSplit(LangRec.DefName,Dum,FName,Dum);
  548. If Length(Fname)>3
  549.    Then FName[0]:=#3;
  550. ReadRALanguage:=FName;
  551. End;
  552.  
  553. {---- Read CONFIG record -------------------------------------------------}
  554.  
  555. Function ReadRAConfig:Boolean;
  556. Var Conf : FileObject;
  557.     Size : Word;
  558. Begin
  559. ReadRAConfig:=False;
  560. FillChar(RAConfig,SizeOf(RAConfig),#00);
  561.  
  562. Conf.Open('CONFIG.RA',1,ReadOnly+ShareDenyNone);
  563. If Conf.Error<>0
  564.    Then Begin
  565.         Conf.Open(RAPath+'CONFIG.RA',1,ReadOnly+ShareDenyNone);
  566.         If Conf.Error<>0
  567.            Then Exit;
  568.         End;
  569. Size:=SizeOf(RAConfig);
  570. Conf.ReadBuffer(RAConfig,Size);
  571. Conf.Close;
  572.  
  573.  
  574. With GlobalInfo Do
  575.  Begin
  576.  BBStag  := RABBS;
  577.  BBSName := 'RemoteAccess 1.xx';
  578.  
  579.  OnlineStatus:=Normal;
  580.  SystemStatus:=S_OK;
  581.  
  582.  LogfileName   := RAConfig.LogFileName;
  583.  LogType       := RAConfig.LogStyle;
  584.  
  585.  Case LogType Of
  586.   1 : LogIt := FrodoLogIt;
  587.   0 : LogIt := OpusLogIt;
  588.  End; {Case}
  589.  
  590.  UseLog        := True;
  591.  TimeOutTime   := RAConfig.UserTimeout;
  592.  Warnings      := 2; { My constate! }
  593.  
  594.  UserFilePath  := RAConfig.MsgBasePath;
  595.  CompletePath(UserFilePath);
  596.  
  597.  CommonDir:=RaConfig.SemPath;
  598.  If CommonDir=''
  599.     Then CommonDir:=RAConfig.SysPath;
  600.  CompletePath(CommonDir);
  601.  
  602.  LeftBracket   := RAConfig.LeftBracket;
  603.  RightBracket  := RAConfig.RightBracket;
  604.  
  605.  SysopName     := RAConfig.SysOp;
  606.  SystemName    := RAConfig.SystemName;
  607.  SystemLocation:= RAConfig.Location;
  608.  
  609.  LocalMono     := RAConfig.MonoMode;
  610.  
  611.  If ExistParameter('P:')
  612.     Then ComPort:=Str2Nr(GrabParameter('P:'))
  613.     Else ComPort := RAConfig.CommPort;
  614.  
  615.  MultiLine     := RAConfig.MultiLine;
  616.  End; {With}
  617.  
  618. {---- To make sure the major paths are all nice and complete... ---------}
  619.  
  620. CompletePath(RAConfig.MenuPath);
  621. CompletePath(RAConfig.TextPath);
  622. CompletePath(RAConfig.AttachPath);
  623. CompletePath(RAConfig.NodelistPath);
  624. CompletePath(RAConfig.MsgBasePath);
  625. CompletePath(RAConfig.SysPath);
  626. CompletePath(RAConfig.SemPath);
  627. CompletePath(RAConfig.ListPath);
  628.  
  629. ReadRAConfig  := True;
  630. End;
  631.  
  632.  
  633.  
  634. {---- ExitInfo.bbs procedures -----------------------------------------}
  635.  
  636. Function RAUpdateExitInfo:Boolean;
  637. Var Info : FileObject;
  638.     Size : Word;
  639. Begin
  640. RAUpdateExitInfo:=False;
  641.  
  642. If GlobalInfo.MultiLine
  643.    Then Info.Open('EXITINFO.BBS',1,ReadWrite+ShareDenyNone)
  644.    Else Info.Open(GlobalInfo.SystemPath+'EXITINFO.BBS',1,ReadWrite+ShareDenyNone);
  645.  
  646. If Info.Error <> 0
  647.    Then Exit;
  648.  
  649. Size:=SizeOf(RAExitInfo);
  650.  
  651. RAExitInfo.UserInfo.Security:=GlobalInfo.UserSecurity;
  652.  
  653.  
  654. Inc(
  655.      RAExitInfo.UserInfo.Elapsed,
  656.      Integer(RAExitInfo.TimeLimit-GlobalInfo.MinRemaining)
  657.    );
  658.  
  659.  
  660.  
  661. Info.GotoRecord(0);
  662. Info.WriteBuffer(RAExitInfo,Size);
  663. Info.Close;
  664.  
  665. RAUpdateExitInfo:=Info.Error=0;
  666. End;
  667.  
  668. Procedure RABirthDay(Var D : RADate;Var Age: Byte);
  669. Var Year,Month,Day : Word;
  670.     Now            : DateTime;
  671.     Dum            : Word;
  672. Begin
  673. With Now Do
  674.  GetDAte(Year,Month,Day,Dum);
  675. Month:=Str2Nr(Copy(D,1,2));
  676. Day:=Str2Nr(Copy(D,4,2));
  677. Year:=Str2Nr(Copy(D,7,2))+1900;
  678. If (Month*Year*Day=0)
  679.    Then Begin
  680.         Age:=0;
  681.         D:='UnKnown';
  682.         Exit;
  683.         End;
  684. Age:=Now.Year-Year-1;
  685. If (Now.Month>Month) Or
  686.    ((Month=Now.Month) And (Now.Day>=Day))
  687.    Then Inc(Age);
  688. D:=SF(Day,2)+'-'+SF(Month,2)+'-'+SF(Year-1900,2);
  689. End;
  690.  
  691.  
  692. Function ReadExitInfo:Boolean;
  693. Var Info : FileObject;
  694.     Size : Word;
  695. Begin
  696. ReadExitInfo:=False;
  697. FillChar(RAExitInfo,SizeOf(RAExitInfo),#00);
  698.  
  699. If GlobalInfo.MultiLine
  700.    Then Info.Open('EXITINFO.BBS',1,ReadOnly+ShareDenyNone)
  701.    Else Info.Open(GlobalInfo.SystemPath+'EXITINFO.BBS',1,ReadOnly+ShareDenyNone);
  702.  
  703. If Info.Error <> 0
  704.    Then Exit;
  705.  
  706. Size:=SizeOf(RAExitInfo);
  707. Info.ReadBuffer(RAExitInfo,Size);
  708. Info.Close;
  709.  
  710. With GlobalInfo Do
  711.  Begin
  712.  
  713.  ScreenWidth  := RAExitInfo.UserXiInfo.ScreenWidth;
  714.  If ScreenWidth=0
  715.     Then ScreenWidth:=80;
  716.  
  717.  UserName     := RAExitInfo.UserInfo.Name;
  718.  UserHandle   := RAExitInfo.UserXIInfo.Handle;
  719.  If UserHandle=''
  720.     Then UserHandle:=UserName;
  721.  UserLocation := RAExitInfo.UserInfo.Location;
  722.  UserSecurity := RAExitInfo.UserInfo.Security;
  723.  
  724.  UserBirthDay := RAExitInfo.UserXIInfo.BirthDate;
  725.  RABirthDay(UserBirthDay,UserAge);
  726.  UserGroup := RAExitInfo.UserInfo.Group;
  727.  
  728.  
  729.  ScreenLength := RAExitInfo.UserInfo.ScreenLength;
  730.  UseGraphics  := (RAExitInfo.UserInfo.Attribute  And $08 ) = $08;
  731.  UseAVATAR    := (RAExitInfo.UserInfo.Attribute2 And $02 ) = $02;
  732.  UseMoreYN    := (RAExitInfo.UserInfo.Attribute  And $04 ) = $04;
  733.  UseClrScr    := (RAExitInfo.UserInfo.Attribute  And $02 ) = $02;
  734.  UseQuietMode := (RAExitInfo.UserInfo.Attribute  And $80 ) = $80;
  735.  BaudRate     := RAExitInfo.Baud;
  736.  MinRemaining := RAExitInfo.TimeLimit;
  737.  TimeLimit    := RAExitInfo.TimeLimit;
  738.  End; {With}
  739.  
  740. FillChar(IEMSIInfo,SizeOf(IEMSIInfo),#00);
  741. With RAExitInfo, IEMSIInfo Do
  742.  Begin
  743.  Session        := EMSI_Session;
  744.  CRTDef         := EMSI_Crtdef;
  745.  Protocols      := EMSI_Protocols;
  746.  Capabilities   := EMSI_Capabilities;
  747.  Requests       := EMSI_Requests;
  748.  Software       := EMSI_Software;
  749.  
  750.  Attr1          := Hold_Attr1;    { The original values! Not the IEMSI values }
  751.  Attr2          := Hold_Attr2;
  752.  Len            := Hold_Len;
  753.  End;
  754.  
  755. ReadExitInfo:= True;
  756. End;
  757.  
  758.  
  759.  
  760. {--------------------------------------------------------------------------|
  761.   INITRA:
  762.  
  763.   Read the RA configuration files (CONFIG.RA and EXITINFO.BBS) and fill
  764.   and check for the standard commandline parameters.
  765.  
  766.   -T:<Time>     Maximal time in this door, overrules the EXITINFO.BBS setting
  767.                 The time has to be given in minutes. Mostly here for
  768.                 compatability with RAdoor 2.3
  769.   -N:<Node>     Node number, there's no other way under RA. Defaults to node 1
  770.   -P:<CommPort> Overrules the CONFIG.RA Comport setting. Usefull for multiline
  771.                 Systems.
  772.   -NOS          Turns off local noise for default.
  773.  
  774.   Further the GlobalInfo variables SystemPath and HomeDir are filled:
  775.  
  776.   SystemPath    Path to the RA system directory. The environment variable
  777.                 RA= has to be there.
  778.  
  779.   HomeDir       The directory from where the door was fired up. I usual
  780.                 use this directory to look for auxilary files. The homedir
  781.                 is found by stripping the filename of ParamStr(0). The user
  782.                 can ALWAYS overrule this value by setting an environment
  783.                 variable <PROGNAME> with an other path. PROGNAME is the REAL
  784.                 name of the program (the EXE file) minus the path and the
  785.                 extention!
  786.  
  787. |--------------------------------------------------------------------------}
  788.  
  789.  
  790.  
  791. Procedure InitRA;
  792.  
  793. Var ProgName : String[8];
  794.     Dum      : String[4];
  795.     TTime    : Word;
  796. Begin
  797. FillChar(GlobalInfo,SizeOf(GlobalInfo),#00);
  798. RAPath:=GetEnv('RA');
  799. CompletePath(RAPath);
  800. GlobalInfo.SystemPath:=RAPath;
  801.  
  802.  
  803. FSplit(ParamStr(0),GlobalInfo.HomeDir,ProgName,Dum);
  804. If GetEnv(ProgName)<>''
  805.    Then GlobalInfo.HomeDir:=GetEnv(ProgName);
  806. If GlobalInfo.HomeDir<>''
  807.    Then CompletePath(GlobalInfo.HomeDir);
  808.  
  809.  
  810. GlobalInfo.Node:=Str2Nr(GrabParameter('N:'));
  811. If GlobalInfo.Node=0
  812.    Then GlobalInfo.Node:=1;
  813.  
  814. If Not ReadRAConfig
  815.    Then Begin
  816.         WriteLn(#254' Couldn''t read CONFIG.RA!');
  817.         Halt;
  818.         End;
  819.  
  820. If Not ReadExitInfo
  821.    Then Begin
  822.         WriteLn(#254' Couldn''t read EXITINFO.BBS!');
  823.         Halt;
  824.         End;
  825.  
  826. If ExistParameter('T:')
  827.    Then Begin
  828.         TTime:=Str2Nr(GrabParameter('T:'));
  829.         If TTime<=GlobalInfo.MinRemaining
  830.            Then GlobalInfo.MinRemaining:=TTime;
  831.         End;
  832.  
  833. GlobalInfo.Language:=ReadRALanguage(RAExitinfo.UserXIinfo.Language);
  834.  
  835. GlobalInfo.LocalNoise:=Not ExistParameter('NOS');
  836. End;
  837. End.
  838.  
  839.  
  840.