home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / RADOOR30.ZIP / RA200.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-04-10  |  34.0 KB  |  984 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 RA200;
  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..200] of Word;
  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, Only);
  75.  
  76.      RALANGUAGErecord = Record
  77.                           Name           : String[20];
  78.                           Attribute      : Byte;
  79.                           DefName,
  80.                           MenuPath,
  81.                           TextPath,
  82.                           QuesPath       : String[60];
  83.                           Security       : Word;
  84.                           Flags,
  85.                           NotFlagsMask   : RAFlagType;
  86.                           FreeSpace      : Array[1..190] of Byte;
  87.                         End;
  88.  
  89.        RAMODEMrecord  = record
  90.                          ComPort,
  91.                          InitTries        : Byte;
  92.                          BufferSize,
  93.                          ModemDelay       : Word;
  94.                          MaxSpeed         : LongInt;
  95.                          SendBreak,
  96.                          LockModem,
  97.                          AnswerPhone,
  98.                          OffHook          : Boolean;
  99.                          InitStr,
  100.                          InitStr2,
  101.                          BusyStr          : String[70];
  102.                          InitResp,
  103.                          BusyResp,
  104.                          Connect300,
  105.                          Connect1200,
  106.                          Connect2400,
  107.                          Connect4800,
  108.                          Connect7200,
  109.                          Connect9600,
  110.                          Connect12k,
  111.                          Connect14k,
  112.                          Connect16k,
  113.                          Connect19k,
  114.                          Connect38k,
  115.                          ConnectFax       : String[40];
  116.                          RingStr,
  117.                          AnswerStr        : String[20];
  118.                          ErrorFreeString  : String[15];
  119.                          FreeSpace        : Array[1..300] of Byte;
  120.                        end;
  121.  
  122.   RAARCrecord = record
  123.                   Extension : String[3];
  124.                   UnpackCmd,
  125.                   PackCmd   : String[60];
  126.                 end;
  127.  
  128.        RACONFIGrecord = record
  129.                          VersionID           : Word;
  130.                          xCommPort           : Byte;
  131.                          xBaud               : LongInt;
  132.                          xInitTries          : Byte;
  133.                          xInitStr,
  134.                          xBusyStr            : String[70];
  135.                          xInitResp,
  136.                          xBusyResp,
  137.                          xConnect300,
  138.                          xConnect1200,
  139.                          xConnect2400,
  140.                          xConnect4800,
  141.                          xConnect9600,
  142.                          xConnect19k,
  143.                          xConnect38k         : String[40];
  144.                          xAnswerPhone        : Boolean;
  145.                          xRing,
  146.                          xAnswerStr          : String[20];
  147.                          xFlushBuffer        : Boolean;
  148.                          xModemDelay         : Integer;
  149.  
  150.                          MinimumBaud,
  151.                          GraphicsBaud,
  152.                          TransferBaud        : Integer;
  153.                          SlowBaudTimeStart,
  154.                          SlowBaudTimeEnd,
  155.                          DownloadTimeStart,
  156.                          DownloadTimeEnd     : RATime;
  157.  
  158.                          PageStart           : Array[0..6] of RATime;
  159.                          PageEnd             : Array[0..6] of RATime;
  160.  
  161.                          SeriNum,
  162.                          CustNum             : String[22];
  163.                      {}  FreeSpace1          : Array[1..24] of Byte;
  164.                          PwdExpiry           : Word;
  165.  
  166.                          MenuPath,
  167.                          TextPath,
  168.                          AttachPath,
  169.                          NodelistPath,
  170.                          MsgBasePath,
  171.                          SysPath,
  172.                          ExternalEdCmd       : String[60];
  173.  
  174.                          Address             : Array[0..9] of RANetAddress;
  175.                          SystemName          : String[30];
  176.  
  177.                          NewSecurity         : Word;
  178.                          NewCredit           : Word;
  179.                          NewFlags            : RAFlagType;
  180.  
  181.                          OriginLine          : String[60];
  182.                          QuoteString         : String[15];
  183.                          Sysop               : String[35];
  184.                          LogFileName         : String[60];
  185.                          FastLogon,
  186.                          AllowSysRem,
  187.                          MonoMode,
  188.                          StrictPwdChecking,
  189.                          DirectWrite,
  190.                          SnowCheck           : Boolean;
  191.                          CreditFactor        : Integer;
  192.  
  193.                          UserTimeOut,
  194.                          LogonTime,
  195.                          PasswordTries,
  196.                          MaxPage,
  197.                          PageLength          : Word;
  198.                          CheckForMultiLogon,
  199.                          ExcludeSysopFromList,
  200.                          OneWordNames        : Boolean;
  201.                          CheckMail           : RAAskType;
  202.                          AskVoicePhone,
  203.                          AskDataPhone,
  204.                          DoFullMailCheck,
  205.                          AllowFileShells,
  206.                          FixUploadDates,
  207.                          FreezeChat          : Boolean;
  208.                          ANSI,                       { ANSI: Yes, no, or ask new users     }
  209.                          ClearScreen,                { Clear:        "                     }
  210.                          MorePrompt          : RAAskType;    { More:         "                     }
  211.                          UploadMsgs          : Boolean;
  212.                          KillSent            : RAAskType;    { Kill/Sent     "                     }
  213.  
  214.                          CrashAskSec         : Word;       { Min sec# to ask 'Crash Mail ?'      }
  215.                          CrashAskFlags       : RAFlagType;
  216.                          CrashSec            : Word;       { Min sec# to always send crash mail. }
  217.                          CrashFlags          : RAFlagType;
  218.                          FAttachSec          : Word;       {        "    ask 'File Attach ?'     }
  219.                          FAttachFlags        : RAFlagType;
  220.  
  221.                          NormFore,
  222.                          NormBack,
  223.                          StatFore,
  224.                          StatBack,
  225.                          HiBack,
  226.                          HiFore,
  227.                          WindFore,
  228.                          WindBack,
  229.                          ExitLocal,
  230.                          Exit300,
  231.                          Exit1200,
  232.                          Exit2400,
  233.                          Exit4800,
  234.                          Exit9600,
  235.                          Exit19k,
  236.                          Exit38k             : Byte;
  237.  
  238.                          MultiLine           : Boolean;
  239.                          MinPwdLen           : Byte;
  240.                          MinUpSpace          : Word;
  241.                          HotKeys             : RAAskType;
  242.                          BorderFore,
  243.                          BorderBack,
  244.                          BarFore,
  245.                          BarBack,
  246.                          LogStyle,
  247.                          MultiTasker,
  248.                          PwdBoard            : Byte;
  249.                          xBufferSize         : Word;
  250.                          FKeys               : Array[1..10] of String[60];
  251.  
  252.                          WhyPage             : Boolean;
  253.                          LeaveMsg            : Byte;
  254.                          ShowMissingFiles,
  255.                          xLockModem          : Boolean;
  256.                      {}  FreeSpace2          : Array[1..10] of Byte;
  257.                          AllowNetmailReplies : Boolean;
  258.                          LogonPrompt         : String[40];
  259.                          CheckNewFiles       : RAAskType;
  260.                          ReplyHeader         : String[60];
  261.                          BlankSecs           : byte;
  262.                          ProtocolAttrib      : Array[1..6] of Byte;
  263.                          xErrorFreeString    : String[15];
  264.                          xDefaultCombined    : array[1..25] of Byte;
  265.                          RenumThreshold      : Word;
  266.                          LeftBracket,
  267.                          RightBracket        : Char;
  268.                          AskForHandle        : Boolean;
  269.                          AskForBirthDate     : Boolean;
  270.  
  271.                          GroupMailSec        : Word;
  272.  
  273.                          ConfirmMsgDeletes   : Boolean;
  274.  
  275.                          FreeSpace4          : Array[1..30] of byte;
  276.  
  277.                          TempScanDir         : String[60];
  278.                          ScanNow             : RAAskType;
  279.                          xUnknownArcAction,
  280.                          xFailedUnpackAction,
  281.                          FailedScanAction    : Byte; {Bit 0:Mark deleted, 1:Mark unlisted, 2:Mark notavail}
  282.                          xUnknownArcArea,
  283.                          xFailedUnpackArea,
  284.                          FailedScanArea      : Word;
  285.                          ScanCmd             : String[60];
  286.                          xDeductIfUnknown    : Boolean;
  287.  
  288.                          NewUserGroup        : Byte;
  289.                          AVATAR              : RAAskType;
  290.                          BadPwdArea          : Byte;
  291.                          Location            : String[40];
  292.                          DoAfterAction       : Byte; {0 = wait for CR, > 0 = wait for x seconds}
  293.                      {}  OldFileLine         : String[40];
  294.                          CRfore,
  295.                          CRback              : Byte;
  296.                          LangHdr             : String[40];
  297.                          xSendBreak          : Boolean;
  298.                      {}  ListPath            : String[60];
  299.                          FullMsgView         : RAAskType;
  300.                          EMSI_Enable         : RAAskType;
  301.                          EMSI_NewUser        : Boolean;
  302.  
  303.                          EchoChar            : String[1];
  304.                          xConnect7200,
  305.                          xConnect12000,
  306.                          xConnect14400       : String[40];
  307.                          Exit7200,
  308.                          Exit12000,
  309.                          Exit14400           : Byte;
  310.                          ChatCommand         : String[60];
  311.                          ExtEd               : RAAskType;
  312.                          NewuserLanguage     : Byte;
  313.                          LanguagePrompt      : String[40];
  314.                          VideoMode           : RAVideoType;
  315.                          AutoDetectANSI      : Boolean;
  316.                          xOffHook            : Boolean;
  317.                          NewUserDateFormat   : Byte;
  318.                          KeyboardPwd         : String[15];
  319.                          CapLocation         : Boolean;
  320.                          NewuserSub          : Byte;
  321.                          PrinterName         : String[4];
  322.                          HilitePromptFore,
  323.                          HiLitePromptBack    : Byte;
  324.                          xInitStr2           : String[70];
  325.                          AltJSwap            : Boolean;
  326.                          SemPath             : String[60];
  327.                          AutoChatCapture     : Boolean;
  328.  
  329.                          FileBasePath        : String[60];
  330.                          NewFileTag          : Boolean;
  331.                          IgnoreDupeExt       : Boolean;
  332.                          TempCDFilePath      : String[60];
  333.                          TagFore,
  334.                          TagBack             : Byte;
  335.                          xConnect16k         : String[40];
  336.                          Exit16k,
  337.                          FilePayback         : Byte;
  338.                          FileLine,
  339.                          FileMissingLine     : String[200];
  340.                          NewUserULCredit     : Byte;
  341.                          NewUserULCreditK    : Word;
  342.                          ArcInfo             : Array[1..10] of RAARCrecord;
  343.                          RAMGRAltFKeys       : Array[1..5] of String[60];
  344.                          ArcViewCmd          : String[60];
  345.                          xConnectFax         : String[40];
  346.                          ExitFax             : Byte;
  347.                          UseXMS,
  348.                          UseEMS              : Boolean;
  349.                          CheckDOB            : Byte;
  350.                          EchoCheck           : RAAskType;
  351.                          ccSec,
  352.                          ReturnRecSec        : Word;
  353.                          HonourNetReq        : Boolean;
  354.                          DefaultCombined     : RACOMBINEDrecord;
  355.                          AskForSex,
  356.                          AskForAddress       : Boolean;
  357.                          DLdesc              : RAAskType;
  358.                          FutureExpansion : Array[1..588] of Byte;
  359.                        end;
  360.  
  361.  
  362.   RAUSERSrecord    = record
  363.                      Name           : RANameString;
  364.                      Location       : String[25];
  365.                      Organisation,
  366.                      Address1,
  367.                      Address2,
  368.                      Address3       : String[50];
  369.                      Handle         : String[35];
  370.                      Comment        : String[80];
  371.                      PasswordCRC    : LongInt;
  372.                      DataPhone,
  373.                      VoicePhone     : String[15];
  374.                      LastTime       : RATime;
  375.                      LastDate       : RADate;
  376.  
  377.                      Attribute,
  378.  
  379.                       { Bit 0 : Deleted
  380.                             1 : Clear screen
  381.                             2 : More prompt
  382.                             3 : ANSI
  383.                             4 : No-kill
  384.                             5 : Xfer priority
  385.                             6 : Full screen msg editor
  386.                             7 : Quiet mode }
  387.  
  388.                      Attribute2     : Byte;
  389.  
  390.                       { Bit 0 : Hot-keys
  391.                             1 : AVT/0
  392.                             2 : Full screen message viewer
  393.                             3 : Hidden from userlist 
  394.                             4 : Page priority
  395.                             5 : No echomail in mailbox scan
  396.                             6 : Guest account 
  397.                             7 : Post bill enabled }
  398.  
  399.                      Flags          : RAFlagType;
  400.                      Credit,
  401.                      Pending        : LongInt;
  402.                      MsgsPosted,
  403.                      Security       : Word;
  404.                      LastRead,
  405.                      NoCalls,
  406.                      Uploads,
  407.                      Downloads,
  408.                      UploadsK,
  409.                      DownloadsK,
  410.                      TodayK         : LongInt;
  411.                      Elapsed        : Integer;
  412.                      ScreenLength   : Word;
  413.                      LastPwdChange  : Byte;
  414.                      Group          : Word;
  415.                      CombinedInfo   : RACOMBINEDrecord;
  416.                      FirstDate,
  417.                      BirthDate,
  418.                      SubDate        : RADate;
  419.                      ScreenWidth,
  420.                      Language,
  421.                      DateFormat     : Byte;
  422.                      ForwardTo      : String[35];
  423.                      MsgArea,
  424.                      FileArea       : Word;
  425.                      DefaultProtocol: Char;
  426.                      FileGroup      : Word;
  427.                      LastDOBCheck   : Byte;
  428.                      Sex            : Byte;
  429.                      XIrecord       : LongInt;
  430.                      MsgGroup       : Word;
  431.                      FreeSpace      : Array[1..48] of Byte;
  432.                    end;
  433.  
  434.    RAUSERSXIrecord  = record
  435.                        FreeSpace      : Array[1..200] of Byte;
  436.                       end;
  437.  
  438.  
  439.  
  440.      RASysInfoRecord = Record
  441.                         TotalCalls  : LongInt;
  442.                         LastCaller  : RANameString;
  443.                         ExtraSpace  : Array[1..128] of Byte;
  444.                        End;
  445.  
  446.      RATimeLogRecord = Record
  447.                         StartDate   : RADate;
  448.                         BusyPerHour : Array[0..23] of Word;
  449.                         BusyPerDay  : Array[0..6] of Word;
  450.                        End;
  451.  
  452.      RAEventRecord    = Record
  453.                          Status      : Byte; { 0=Deleted 1=Enabled 2=Disabled }
  454.                          StartTime   : RATime;
  455.                          ErrorLevel  : Byte;
  456.                          Days        : Byte;
  457.                          Forced      : Boolean;
  458.                          LastTimeRun : RADate;
  459.                         End;
  460.  
  461.    RAEVENTrecordArray = array[1..20] of RAEVENTrecord;
  462.  
  463.    RAEXITINFOrecord = record
  464.                         Baud             : Word;
  465.                         SysInfo          : RASYSINFOrecord;
  466.                         TimeLogInfo      : RATIMELOGrecord;
  467.                         UserInfo         : RAUSERSrecord;
  468.                         EventInfo        : RAEVENTrecord;
  469.                         NetMailEntered,
  470.                         EchoMailEntered  : Boolean;
  471.                         LoginTime        : RATime;
  472.                         LoginDate        : RADate;
  473.                         TimeLimit        : Word;
  474.                         LoginSec         : LongInt;
  475.                         UserRecord       : Integer;
  476.                         ReadThru,
  477.                         NumberPages,
  478.                         DownloadLimit    : Word;
  479.                         TimeOfCreation   : RATime;
  480.                         LogonPasswordCRC : LongInt;
  481.                         WantChat         : Boolean;
  482.  
  483.                         DeductedTime     : Integer;
  484.                         MenuStack        : Array[1..50] of String[8];
  485.                         MenuStackPointer : Byte;
  486.                         UserXIinfo       : RAUSERSXIrecord;
  487.                         ErrorFreeConnect,
  488.                         SysopNext        : Boolean;
  489.  
  490.                         EMSI_Session     : Boolean;        { These fields hold  }
  491.                         EMSI_Crtdef,                       { data related to an }
  492.                         EMSI_Protocols,                    { EMSI session       }
  493.                         EMSI_Capabilities,
  494.                         EMSI_Requests,
  495.                         EMSI_Software    : String[40];
  496.                         Hold_Attr1,
  497.                         Hold_Attr2,
  498.                         Hold_Len         : Byte;
  499.  
  500.                         PageReason       : String[80];
  501.  
  502.                         ExtraSpace       : Array[1..100] of Byte;
  503.                        end;
  504.  
  505.  
  506.  
  507.  
  508. {--------------------------------------------------------------------------|
  509.   Variables which contain the CONFIG.RA and the EXITINFO.BBS info. Note
  510.   that I included RA in the variable name to avoid conflicts with the names
  511.   of other BBS's their configuration files.
  512. |--------------------------------------------------------------------------}
  513.  
  514. Var RAExitInfo  : RAExitInfoRecord;
  515.     RAConfig    : RAConfigRecord;
  516.  
  517. {--------------------------------------------------------------------------|
  518.   And the procedures to read and write the configuration info.
  519.  
  520.   InitRA should be called once at the start of your program to initialize
  521.          your door for RemoteAccess.
  522.  
  523.   UpdateExitInfo
  524.          Rewrites the EXITINFO.BBS Record. To avoid problems with newer
  525.          version of RA, which probably add fields to this file, only
  526.          as much bytes are read and written as the size of the record
  527.          defined in this unit. As long as the file is upward compatible
  528.          this should avoid conflicts.
  529.          The function returns false if it wasn't able to write the info.
  530.  
  531.          The users TimeLimit and Security are always updated while writing,
  532.          Other field you have to change for yourself.
  533.  
  534. |--------------------------------------------------------------------------}
  535.  
  536.  
  537. Procedure InitRA;
  538. Function RAUpdateExitInfo:Boolean;
  539.  
  540. Implementation
  541. Uses LowLevel; { To avoid a circular reference error }
  542.  
  543. Const UseLog : Boolean = False; { Is set to TRUE as soon as a LogProcedure }
  544.                                 { is installed                             }
  545.  
  546. {$F+}
  547. Procedure FroDoLogIt(LogLine  : MaxlogStr);
  548. {$F-}
  549.  
  550. Var Log    : Text;
  551.     temp   : Integer;
  552.     Hour   : Word;
  553.     Minute : Word;
  554.     Second : Word;
  555.     Dum    : Word;
  556.  
  557. Begin
  558. If Not UseLog
  559.    Then Exit;
  560. {$IfDef UseMultiLanguage}
  561.   LogLine:=ExpandString(LogLine);
  562. {$EndIf}
  563. GetTime(Hour,Minute,Second,Dum);
  564. LogLine:= '> '+
  565.           S(Hour,2)+':'+
  566.           S(Minute,2)+':'+
  567.           S(Second,2)+'  '+
  568.           LogLine;
  569. For Dum:=3 To 10 Do
  570.  If LogLine[Dum]=' '
  571.     Then LogLine[Dum]:='0';
  572.  
  573. FileMode:=ReadWrite+ShareDenyNone;
  574. Assign(Log,GlobalInfo.LogFileName);
  575. Append(Log);
  576. If IoResult<>0
  577.    Then Rewrite(Log);
  578. WriteLn(Log,LogLine);
  579. Close(Log);
  580. If IoResult<>0
  581.    Then Begin
  582.         WriteLn(#254' Can''t LOG anymore !!!');
  583.         UseLog:=False;
  584.         End;
  585. End;
  586.  
  587. Const Months : Array[1..12] Of String[3] =
  588.        ('Jan','Feb','Mar','Apr','May','Jun',
  589.         'Jul','Aug','Sep','Oct','Nov','Dec');
  590.  
  591. {$F+}
  592. Procedure OpusLogIt(LogLine  : MaxlogStr);
  593. {$F-}
  594.  
  595. Var Log    : Text;
  596.     temp   : Integer;
  597.     Hour   : Word;
  598.     Minute : Word;
  599.     Second : Word;
  600.     Dum    : Word;
  601.     Day    : Word;
  602.     Month  : Word;
  603.  
  604. Begin
  605. If Not UseLog
  606.    Then Exit;
  607. {$IfDef UseMultiLanguage}
  608.   LogLine:=ExpandString(LogLine);
  609. {$EndIf}
  610. GetTime(Hour,Minute,Second,Dum);
  611. GetDate(Dum,Month,Day,Dum);
  612. LogLine:= '> '+
  613.           S(Day,2)+'-'+
  614.           Months[Month]+' '+
  615.           S(Hour,2)+':'+
  616.           S(Minute,2)+':'+
  617.           S(Second,2)+' '+
  618.           'RA'+S(GlobalInfo.Node,2)+' '+
  619.           LogLine;
  620.  
  621. If LogLine[3]=' '
  622.    Then LogLine[3]:='0';
  623. If LogLine[21]=' '
  624.    Then LogLine[21]:='0';
  625.  
  626.  
  627. For Dum:=10 To 17 Do
  628.  If LogLine[Dum]=' '
  629.     Then LogLine[Dum]:='0';
  630.  
  631. FileMode:=ReadWrite+ShareDenyNone;
  632. Assign(Log,GlobalInfo.LogFileName);
  633. Append(Log);
  634. If IoResult<>0
  635.    Then Rewrite(Log);
  636. WriteLn(Log,LogLine);
  637. Close(Log);
  638. If IoResult<>0
  639.    Then Begin
  640.         WriteLn(#254' Can''t LOG anymore !!!');
  641.         UseLog:=False;
  642.         End;
  643. End;
  644.  
  645. {---- Language support ---------------------------------------------------}
  646.  
  647. Type LangID = String[3];
  648.  
  649. Function ReadRALanguage(Nr : Byte):LangID;
  650. Var Lang    : FileObject;
  651.     LangRec : RALanguageRecord;
  652.     Dum     : String[10];
  653.     FName   : String[8];
  654.  
  655. Begin
  656. ReadRALanguage:='English';
  657. If Nr=0
  658.    Then Exit;
  659. With Lang Do
  660.  Begin
  661.  Open(GlobalInfo.SystemPath+'LANGUAGE.RA',SizeOf(LangRec),ReadOnly+ShareDenyNone);
  662.  GotoRecord(Nr-1);
  663.  If IoError<>0
  664.     Then GotoRecord(0);
  665.  Read(LangRec);
  666.  Close;
  667.  If IoError<>0
  668.     Then Exit;
  669.  End;
  670. FSplit(LangRec.DefName,Dum,FName,Dum);
  671. If Length(Fname)>3
  672.    Then FName[0]:=#3;
  673. ReadRALanguage:=FName;
  674. End;
  675.  
  676. {---- Read CONFIG record -------------------------------------------------}
  677.  
  678. Function GrabRAPort:Byte;
  679. Var Mdm : File of Byte;
  680.     B   : Byte;
  681. Begin
  682. FileMode:=ReadOnly+ShareDenyNone;
  683. Assign(Mdm,'MODEM.RA');
  684. Reset(Mdm);
  685. If IoResult<>0
  686.    Then Begin
  687.         Assign(Mdm,RAPath+'MODEM.RA');
  688.         Reset(Mdm);
  689.         If IoResult<>0
  690.            Then Begin
  691.                 GrabRAPort:=1;
  692.                 Exit;
  693.                 End;
  694.         End;
  695. Read(Mdm,B);
  696. Close(Mdm);
  697. GrabRAPort:=B;
  698. End;
  699.  
  700.  
  701. Function ReadRAConfig:Boolean;
  702. Var Conf : FileObject;
  703.     Size : Word;
  704. Begin
  705. ReadRAConfig:=False;
  706. FillChar(RAConfig,SizeOf(RAConfig),#00);
  707.  
  708. Conf.Open('CONFIG.RA',1,ReadOnly+ShareDenyNone);
  709. If Conf.Error<>0
  710.    Then Begin
  711.         Conf.Open(RAPath+'CONFIG.RA',1,ReadOnly+ShareDenyNone);
  712.         If Conf.Error<>0
  713.            Then Exit;
  714.         End;
  715. Size:=SizeOf(RAConfig);
  716. Conf.ReadBuffer(RAConfig,Size);
  717. Conf.Close;
  718.  
  719.  
  720. With GlobalInfo Do
  721.  Begin
  722.  BBStag  := RABBS;
  723.  BBSName := 'RemoteAccess 1.2x';
  724.  
  725.  OnlineStatus:=Normal;
  726.  SystemStatus:=S_OK;
  727.  
  728.  LogfileName   := RAConfig.LogFileName;
  729.  LogType       := RAConfig.LogStyle;
  730.  
  731.  Case LogType Of
  732.   1 : LogIt := FrodoLogIt;
  733.   0 : LogIt := OpusLogIt;
  734.  End; {Case}
  735.  
  736.  UseLog        := True;
  737.  TimeOutTime   := RAConfig.UserTimeout;
  738.  Warnings      := 2; { My constate! }
  739.  
  740.  UserFilePath  := RAConfig.MsgBasePath;
  741.  CompletePath(UserFilePath);
  742.  
  743.  CommonDir:=RaConfig.SemPath;
  744.  If CommonDir=''
  745.     Then CommonDir:=RAConfig.SysPath;
  746.  CompletePath(CommonDir);
  747.  
  748.  LeftBracket   := RAConfig.LeftBracket;
  749.  RightBracket  := RAConfig.RightBracket;
  750.  
  751.  SysopName     := RAConfig.SysOp;
  752.  SystemName    := RAConfig.SystemName;
  753.  SystemLocation:= RAConfig.Location;
  754.  
  755.  LocalMono     := RAConfig.MonoMode;
  756.  
  757.  If ExistParameter('P:')
  758.     Then ComPort:=Str2Nr(GrabParameter('P:'))
  759.     Else ComPort := GrabRAPort;
  760.  
  761.  MultiLine     := RAConfig.MultiLine;
  762.  End; {With}
  763.  
  764. {---- To make sure the major paths are all nice and complete... ---------}
  765.  
  766. CompletePath(RAConfig.MenuPath);
  767. CompletePath(RAConfig.TextPath);
  768. CompletePath(RAConfig.AttachPath);
  769. CompletePath(RAConfig.NodelistPath);
  770. CompletePath(RAConfig.MsgBasePath);
  771. CompletePath(RAConfig.SysPath);
  772. CompletePath(RAConfig.SemPath);
  773. CompletePath(RAConfig.ListPath);
  774.  
  775. ReadRAConfig  := True;
  776. End;
  777.  
  778.  
  779.  
  780. {---- ExitInfo.bbs procedures -----------------------------------------}
  781.  
  782. Function RAUpdateExitInfo:Boolean;
  783. Var Info : FileObject;
  784.     Size : Word;
  785. Begin
  786. RAUpdateExitInfo:=False;
  787.  
  788. If GlobalInfo.MultiLine
  789.    Then Info.Open('EXITINFO.BBS',1,ReadWrite+ShareDenyNone)
  790.    Else Info.Open(GlobalInfo.SystemPath+'EXITINFO.BBS',1,ReadWrite+ShareDenyNone);
  791.  
  792. If Info.Error <> 0
  793.    Then Exit;
  794.  
  795. Size:=SizeOf(RAExitInfo);
  796.  
  797. RAExitInfo.UserInfo.Security:=GlobalInfo.UserSecurity;
  798.  
  799.  
  800. Inc(
  801.      RAExitInfo.UserInfo.Elapsed,
  802.      Integer(RAExitInfo.TimeLimit-GlobalInfo.MinRemaining)
  803.    );
  804.  
  805.  
  806.  
  807. Info.GotoRecord(0);
  808. Info.WriteBuffer(RAExitInfo,Size);
  809. Info.Close;
  810.  
  811. RAUpdateExitInfo:=Info.Error=0;
  812. End;
  813.  
  814. Procedure RABirthDay(Var D : RADate;Var Age: Byte);
  815. Var Year,Month,Day : Word;
  816.     Now            : DateTime;
  817.     Dum            : Word;
  818. Begin
  819. With Now Do
  820.  GetDAte(Year,Month,Day,Dum);
  821. Month:=Str2Nr(Copy(D,1,2));
  822. Day:=Str2Nr(Copy(D,4,2));
  823. Year:=Str2Nr(Copy(D,7,2))+1900;
  824. If (Month*Year*Day=0)
  825.    Then Begin
  826.         Age:=0;
  827.         D:='UnKnown';
  828.         Exit;
  829.         End;
  830. Age:=Now.Year-Year-1;
  831. If (Now.Month>Month) Or
  832.    ((Month=Now.Month) And (Now.Day>=Day))
  833.    Then Inc(Age);
  834. D:=SF(Day,2)+'-'+SF(Month,2)+'-'+SF(Year-1900,2);
  835. End;
  836.  
  837.  
  838. Function ReadExitInfo:Boolean;
  839. Var Info : FileObject;
  840.     Size : Word;
  841. Begin
  842. ReadExitInfo:=False;
  843. FillChar(RAExitInfo,SizeOf(RAExitInfo),#00);
  844.  
  845. If GlobalInfo.MultiLine
  846.    Then Info.Open('EXITINFO.BBS',1,ReadOnly+ShareDenyNone)
  847.    Else Info.Open(GlobalInfo.SystemPath+'EXITINFO.BBS',1,ReadOnly+ShareDenyNone);
  848.  
  849. If Info.Error <> 0
  850.    Then Exit;
  851.  
  852. Size:=SizeOf(RAExitInfo);
  853. Info.ReadBuffer(RAExitInfo,Size);
  854. Info.Close;
  855.  
  856. With GlobalInfo Do
  857.  Begin
  858.  
  859.  ScreenWidth  := RAExitInfo.UserInfo.ScreenWidth;
  860.  If ScreenWidth=0
  861.     Then ScreenWidth:=80;
  862.  
  863.  UserName     := RAExitInfo.UserInfo.Name;
  864.  UserHandle   := RAExitInfo.UserInfo.Handle;
  865.  If UserHandle=''
  866.     Then UserHandle:=UserName;
  867.  UserLocation := RAExitInfo.UserInfo.Location;
  868.  UserSecurity := RAExitInfo.UserInfo.Security;
  869.  
  870.  UserBirthDay := RAExitInfo.UserInfo.BirthDate;
  871.  RABirthDay(UserBirthDay,UserAge);
  872.  UserGroup := RAExitInfo.UserInfo.Group;
  873.  
  874.  
  875.  ScreenLength := RAExitInfo.UserInfo.ScreenLength;
  876.  UseGraphics  := (RAExitInfo.UserInfo.Attribute  And $08 ) = $08;
  877.  UseAVATAR    := (RAExitInfo.UserInfo.Attribute2 And $02 ) = $02;
  878.  UseMoreYN    := (RAExitInfo.UserInfo.Attribute  And $04 ) = $04;
  879.  UseClrScr    := (RAExitInfo.UserInfo.Attribute  And $02 ) = $02;
  880.  UseQuietMode := (RAExitInfo.UserInfo.Attribute  And $80 ) = $80;
  881.  BaudRate     := RAExitInfo.Baud;
  882.  MinRemaining := RAExitInfo.TimeLimit;
  883.  TimeLimit    := RAExitInfo.TimeLimit;
  884.  End; {With}
  885.  
  886. With RAExitInfo, GlobalInfo.IEMSI Do
  887.  Begin
  888.  Session        := EMSI_Session;
  889.  CRTDef         := EMSI_Crtdef;
  890.  Protocols      := EMSI_Protocols;
  891.  Capabilities   := EMSI_Capabilities;
  892.  Requests       := EMSI_Requests;
  893.  Software       := EMSI_Software;
  894.  
  895.  Attr1          := Hold_Attr1;    { The original values! Not the IEMSI values }
  896.  Attr2          := Hold_Attr2;
  897.  Len            := Hold_Len;
  898.  End;
  899.  
  900. ReadExitInfo:= True;
  901. End;
  902.  
  903.  
  904.  
  905. {--------------------------------------------------------------------------|
  906.   INITRA:
  907.  
  908.   Read the RA configuration files (CONFIG.RA and EXITINFO.BBS) and fill
  909.   and check for the standard commandline parameters.
  910.  
  911.   -T:<Time>     Maximal time in this door, overrules the EXITINFO.BBS setting
  912.                 The time has to be given in minutes. Mostly here for
  913.                 compatability with RAdoor 2.3
  914.   -N:<Node>     Node number, there's no other way under RA. Defaults to node 1
  915.   -P:<CommPort> Overrules the CONFIG.RA Comport setting. Usefull for multiline
  916.                 Systems.
  917.   -NOS          Turns off local noise for default.
  918.  
  919.   Further the GlobalInfo variables SystemPath and HomeDir are filled:
  920.  
  921.   SystemPath    Path to the RA system directory. The environment variable
  922.                 RA= has to be there.
  923.  
  924.   HomeDir       The directory from where the door was fired up. I usual
  925.                 use this directory to look for auxilary files. The homedir
  926.                 is found by stripping the filename of ParamStr(0). The user
  927.                 can ALWAYS overrule this value by setting an environment
  928.                 variable <PROGNAME> with an other path. PROGNAME is the REAL
  929.                 name of the program (the EXE file) minus the path and the
  930.                 extention!
  931.  
  932. |--------------------------------------------------------------------------}
  933.  
  934.  
  935.  
  936. Procedure InitRA;
  937.  
  938. Var ProgName : String[8];
  939.     Dum      : String[4];
  940.     TTime    : Word;
  941. Begin
  942. RAPath:=GetEnv('RA');
  943. CompletePath(RAPath);
  944. GlobalInfo.SystemPath:=RAPath;
  945.  
  946.  
  947. FSplit(ParamStr(0),GlobalInfo.HomeDir,ProgName,Dum);
  948. If GetEnv(ProgName)<>''
  949.    Then GlobalInfo.HomeDir:=GetEnv(ProgName);
  950. If GlobalInfo.HomeDir<>''
  951.    Then CompletePath(GlobalInfo.HomeDir);
  952.  
  953.  
  954. GlobalInfo.Node:=Str2Nr(GrabParameter('N:'));
  955. If GlobalInfo.Node=0
  956.    Then GlobalInfo.Node:=1;
  957.  
  958. If Not ReadRAConfig
  959.    Then Begin
  960.         WriteLn(#254' Couldn''t read CONFIG.RA!');
  961.         Halt;
  962.         End;
  963.  
  964. If Not ReadExitInfo
  965.    Then Begin
  966.         WriteLn(#254' Couldn''t read EXITINFO.BBS!');
  967.         Halt;
  968.         End;
  969.  
  970. If ExistParameter('T:')
  971.    Then Begin
  972.         TTime:=Str2Nr(GrabParameter('T:'));
  973.         If TTime<=GlobalInfo.MinRemaining
  974.            Then GlobalInfo.MinRemaining:=TTime;
  975.         End;
  976.  
  977. GlobalInfo.Language:=ReadRALanguage(RAExitinfo.Userinfo.Language);
  978.  
  979. GlobalInfo.LocalNoise:=Not ExistParameter('NOS');
  980. End;
  981. End.
  982.  
  983.  
  984.