home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / RADOOR30.ZIP / SUPERBBS.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-04-10  |  28.0 KB  |  786 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 SBBS 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. support for logging on/off}
  31.  
  32.  
  33. Unit SuperBBS;
  34. Interface
  35. Uses Dos,
  36.      CRT,
  37. {$IfDef UseMultiLanguage}
  38.      Language, { Language support, needed for Logging         }
  39. {$EndIf}
  40.      FileObj,  { Typed file handling object                   }
  41.      Fossil,   { Fossil object, needed for online msgs.       }
  42.      GlobInfo; { The globale info. Thisone needs to be filled }
  43.  
  44. Const  SBBS = 2; { This is a unike BBS tag to indentify the current  }
  45.                  { BBS in the global info. Make tags for other BBSes }
  46.                  { Also unique. At least for your own programs!      }
  47.  
  48.  
  49. Var   SBBSPath : ComStr;
  50.  
  51.  
  52. Type  SBBSMsgToIdxRecord = String[35];
  53.       SBBSFlagType       = Array[1..4] of Byte;
  54.  
  55.       SBBSLineIdxRec     = Record
  56.                             User        : SBBSMsgToIdxRecord;
  57.                             Attribute   : Byte;
  58.                             Status      : Byte;
  59.                             Baud        : Word;
  60.                             City        : String[25];
  61.                             ExtraSpace  : Array[1..10] of byte;
  62.                            End;
  63.  
  64. (*  Attribute :
  65.  
  66.      Bit 0 = Line in use
  67.          1 = Do not disturb mode
  68.  
  69.     Status (Not bit-mapped) :
  70.  
  71.      Nr  0 = Doing nothing
  72.          1 = Downloading file(s)
  73.          2 = Uploading file(s)
  74.          3 = Reading messages
  75.          4 = Entering message (also onlinemsg)
  76.          5 = Chatting with SysOp
  77.          6 = Using external program, etc...
  78.          7 = Logging on
  79.  
  80. *)
  81.  
  82.   SBBSNameIdx = Record
  83.                   Name            : SBBSMsgToIdxRecord;
  84.                   Alias           : SBBSMsgToIdxRecord;
  85.                   UserRecPtr      : Integer;
  86.                   ExtraUserRecPtr : Integer;
  87.                   ExtraSpace      : Array[1..4] of byte;
  88.                 End;
  89.  
  90.   SBBSUserRecord = Record                                 (*  USERS.BBS   *)
  91.                      Name             : SBBSMsgToIdxRecord;
  92.                      City             : String[25];
  93.                      Password         : String[15];
  94.                      DataPhone        : String[12];
  95.                      HomePhone        : String[12];
  96.                      LastTime         : String[5];
  97.                      LastDate         : String[8];
  98.                      Attrib           : Byte;
  99.                      Flags            : SBBSFlagType;
  100.                      Credit           : Integer;
  101.                      Pending          : Integer;
  102.                      MsgsPosted       : Word;
  103.                      HighMsgRead      : Word;
  104.                      SecLvl           : Word;
  105.                      Times            : Word;
  106.                      Ups              : Word;
  107.                      Downs            : Word;
  108.                      UpK              : Word;
  109.                      DownK            : Word;
  110.                      TodayK           : Integer;
  111.                      Elapsed          : Integer;
  112.                      Len              : Integer;
  113.                      ExtraSpace1      : Array[1..2] of byte;
  114.                      Age              : Byte;
  115.                      ExtraUserRecPtr  : Integer;
  116.                      ExtraSpace2      : Array[1..3] of Byte;
  117.                    End;
  118.  
  119.     (*  Attrib:
  120.  
  121.           bit 0: Deleted user
  122.           bit 1: Screen clear codes
  123.           bit 2: More prompt
  124.           bit 3: ANSI graphics
  125.           bit 4: No-Kill
  126.           bit 5: Ignore Download Hours
  127.           bit 6: ANSI editor
  128.           bit 7: Do not disturb mode ON
  129.  
  130.     *)
  131.  
  132.   SBBSExtraUserRec=Record                                 (*  SUSERS.BBS  *)
  133.                      Name              : SBBSMsgToIdxRecord;
  134.                      Birthday          : String[8];
  135.                      Attrib            : Word;
  136.                      Flags             : Array[1..4] of Byte; { Not yet used }
  137.                      Firsttime         : String[5];
  138.                      FirstDate         : String[8];
  139.                      CombinedBoards    : Array[1..25]  of Byte;
  140.                      SysOpComment      : String[79];
  141.                      DefaultProto      : Char;                { Not yet used }
  142.                      UserRecPtr        : Integer;
  143.                      Colors            : Array[1..10] of byte;
  144.                      FileListType      : Byte;                { Not yet used }
  145.                      Alias             : SBBSMsgToIdxRecord;
  146.                      MinutesUsed       : Longint;
  147.                      ViewFileName      : String[12]; { SeeAlso attrib bits 4 - 6 }
  148.                      MenuToRun         : String[8];
  149.                      Timeinbank        : Word;
  150.                      TodayCalls        : Byte;
  151.                      LanguageFileN     : String[8];  { *.LNG }
  152.                      ExtraSpace        : Array[1..425] of Byte;
  153.                    End;
  154.  
  155. (*  Attrib:
  156.  
  157.       Bit  0: MailCheck at logon
  158.       Bit  1: Newfiles Check at logon
  159.       Bit  2: No downloadratio
  160.       Bit  3: Female
  161.       Bit  4: Delete file after viewing
  162.       Bit  5: Display file only once
  163.       Bit  6: File viewed
  164.       Bit  7: Fullscreen viewer
  165.       Bit  8:
  166.       Bit  9:
  167.       Bit 10:
  168.       Bit 11:
  169.       Bit 12:
  170.       Bit 13:
  171.       Bit 14:
  172.       Bit 15:
  173. *)
  174.  
  175.     SBBSNetAddress = Record
  176.                        Zone   : Word;
  177.                        Net    : Word;
  178.                        Node   : Word;
  179.                        Point  : Word;
  180.                      End;
  181.  
  182.     SBBSSysInfoRecord = Record                           (* SYSINFO.BBS  *)
  183.                           CallCount  : LongInt;
  184.                           LastCaller : SBBSMsgToIdxRecord;
  185.                           ExtraSpace : Array[1..128] of Byte;
  186.                         End;
  187.  
  188.     SBBSTimeLogRecord = Record                              (* TIMELOG.BBS  *)
  189.                           StartDate   : String[8];
  190.                           BusyPerHour : Array[0..23] of Integer;
  191.                           BusyPerDay  : Array[0..6] of Integer;
  192.                         End;
  193.  
  194.  
  195.     SBBSEventRecord = Record
  196.                         Status      : Byte; { 0=Disabled 1=Enabled }
  197.                         RunTime     : String[5];
  198.                         ErrorLevel  : Byte;
  199.                         Days        : Byte;
  200.                         Forced      : Boolean;
  201.                         LastTimeRun : String[8];
  202.                       End;
  203.  
  204.     SBBSBoardRecord = Record
  205.                         Name:         String[16];
  206.                         Typ         : Byte; { 0=Standard 1=Net 3=Echo }
  207.                         Kinds       : Byte; { 0=Private & Public
  208.                                               1=Private 2=Public 3=Read-Only }
  209.                         Combined    : Boolean;
  210.                         Aliases     : Boolean;
  211.  
  212.                         ReadSecLvl  : Integer;
  213.                         ReadFlags   : SBBSFlagType;
  214.  
  215.                         WriteSecLvl : Integer;
  216.                         WriteFlags  : SBBSFlagType;
  217.  
  218.                         SysopSecLvl : Integer;
  219.                         SysopFlags  : SBBSFlagType;
  220.                       End;
  221.  
  222.      SBBSConfigRecord = Record
  223.                           CommPort       : Integer;
  224.                           InitBaud       : Word;
  225.                           InitTimes      : Word;
  226.                           AnswerWait     : Word;
  227.                           ModemInitStr   : String[70];
  228.                           ModemBusyStr   : String[70];
  229.                           ModemInitResp  : String[40];
  230.                           ModemBusyResp  : String[40];
  231.                           Resp300        : String[40];
  232.                           Resp1200       : String[40];
  233.                           Resp2400       : String[40];
  234.  
  235.                           MenuPath       : String[66];
  236.                           TextPath       : String[66];
  237.                           NetPath        : String[66];
  238.  
  239.                           MinBaud        : Integer;
  240.                           GraphicsBaud   : Integer;
  241.                           XferBaud       : Integer;
  242.                           LowBaudStart   : String[5];
  243.                           LowBaudEnd     : String[5];
  244.                           DownloadStart  : String[5];
  245.                           DownloadEnd    : String[5];
  246.                           PagingStart    : String[5];
  247.                           PagingEnd      : String[5];
  248.  
  249.                           MatrixZone     : Integer;
  250.                           MatrixNet      : Integer;
  251.                           MatrixNode     : Integer;
  252.                           AkaNet         : Array[1..5] of Integer;
  253.                           AkaNode        : Array[1..5] of Integer;
  254.                           NetMailBoard   : Integer;
  255.  
  256.                           DefaultSec     : Integer;
  257.                           DefaultCredit  : Integer;
  258.                           DefaultFlags   : SBBSFlagType;
  259.  
  260.                           EditorCmdStr   : String[70];
  261.                           OriginLine     : String[60];
  262.                           SysopName      : SBBSMsgToIdxRecord;
  263.                           AutoLogonChar  : Boolean;
  264.                           FastLogon      : Boolean;
  265.                           ScreenBlanking : Boolean;
  266.                           UseLastRead    : Boolean;
  267.                           MonoMode       : Boolean;
  268.                           DirectWrite    : Boolean;
  269.                           SnowCheck      : Boolean;
  270.                           NetEchoExit    : Boolean;
  271.                           OneWordNames   : Boolean;
  272.                           CheckMail      : Boolean;
  273.                           AskHomePhone   : Boolean;
  274.                           AskDataPhone   : Boolean;
  275.                           GraphicsAvail  : Boolean;
  276.                           InactiveTimeOut: Integer;
  277.                           LogonTime      : Integer;
  278.                           DefFgColor     : Integer;
  279.                           DefBgColor     : Integer;
  280.                           PasswordTries  : Integer;
  281.                           MaxPageTimes   : Integer;
  282.                           PageBellLen    : Integer;
  283.  
  284.                           Use_Xmodem     : Boolean;
  285.                           Use_Xmodem1k   : Boolean;
  286.                           Use_Ymodem     : Boolean;
  287.                           Use_YmodemG    : Boolean;
  288.                           Use_Sealink    : Boolean;
  289.                           Use_Zmodem     : Boolean;
  290.                           Inp_Fields     : Boolean;
  291.                           QuoteStr       : String[3];
  292.                           UploadCredit   : Integer;
  293.                           LoadingMessage : String[70];
  294.                           SelectionPrompt: String[70];
  295.  
  296.                           VersionID      : Word;
  297.                           Resp4800       : String[40];
  298.                           Resp9600       : String[40];
  299.  
  300.                           AkaZone        : Array[1..5] of Integer;
  301.  
  302.                           MatrixPoint    : Integer;
  303.                           AkaPoint       : Array[1..5] of Integer;
  304.  
  305.                           UseAka         : Array[1..200] of Byte;
  306.                           AskAge         : Boolean;         { Not used }
  307.                           SystemName     : String[40];
  308.                           RegKey         : Longint;
  309.  
  310.                           EntryfieldColor: Byte;
  311.                           MenuBorderColor: Byte;
  312.  
  313.                           SysOpSeclvl    : Integer;
  314.                           AllowDelMsgs   : Boolean;
  315.  
  316.                           EventRec       : Array[1..30] of SBBSEventRecord;
  317.                           BoardRec       : Array[1..200] of SBBSBoardRecord;
  318.                         End;
  319.  
  320.   SBBSExtraConfig = Record
  321.                       SystemPath         : String[66];
  322.                       MsgBasePath        : String[66];
  323.                       TempPath           : String[66];
  324.                       RedirectDevice     : String[12];
  325.                       Resp19200          : String[40];
  326.                       Resp38400          : String[40];
  327.                       ShowSecurity       : Boolean;
  328.                       ShowPswdAtLogon    : Boolean;
  329.                       BetaCode           : Longint;
  330.                       DefaultBoard       : Array[1..200] of boolean;
  331.                       Empty1             : Array[1..284] of byte;
  332.                       AllowCat           : Boolean;
  333.                       Answerboard        : Byte;
  334.                       Use7bitChars       : Boolean;
  335.                       BufferSize         : Word;
  336.                       Empty2             : Array[1..45] of byte;
  337.                       EntryColor         : Byte;
  338.                       FilesBeforeRatio   : Byte;
  339.                       MinSpace           : Word;
  340.                       ClearTemp          : Boolean;
  341.                       Empty3             : Array[1..163] of byte;
  342.                       UseAliasSystem     : Boolean;
  343.                       Ansilogon          : Byte; {0 = No,1 = Yes,2 = Auto detect}
  344.                       ExcludeSysOp       : Boolean;
  345.                       Empty4             : Array[1..122] of byte;
  346.                       AltFkeys           : Array[1..10] of string[60];
  347.                       Checkfiles         : Boolean;
  348.                       PasswordBoard      : Byte;
  349.                       Alt_J_Swaptoems    : Boolean;
  350.                       MaxTimeInBank      : Word;
  351.                       NoBirthDayAsk      : Boolean;
  352.                       MaxDescLines       : Byte;
  353.                       Empty5             : Array[1..45] of byte;
  354.                       FastMailCheck      : Boolean;
  355.                       DefaultColors      : Array[1..10] of byte;
  356.                       Empty6             : Array[1..45] of byte;
  357.                       LinesInSystem      : Byte;
  358.                       CommonDir          : String[79];
  359.                       VersionNumber      : Word;
  360.                       FullScrChatBaud    : Word;
  361.                       PressEnterColor    : Byte;
  362.                       AreaSelectColor    : Array[1..3] of byte;
  363.                       StatusLineColor    : Byte;
  364.                       VirusChkMode       : Byte;
  365.                       WorkPath           : String[79];
  366.                       WatchCDatDos       : Boolean;
  367.                       UseCtrlX           : Boolean;
  368.                       MsgAfterPageBoard  : Byte;
  369.                       SearchAliases      : Boolean;
  370.                       EchoConvert        : Boolean;
  371.                       Extraspace         : Array[1..3765] of Byte;
  372.                     End;
  373.  
  374.   SBBSGosubDataType = Array[1..20] of String[8];
  375.  
  376.   SBBSExitRecord = Record
  377.                      BaudRate            : Word;
  378.                      SysInfo             : SBBSSysInfoRecord;
  379.                      TimeLogInfo         : SBBSTimeLogRecord;
  380.                      UserInfo            : SBBSUserRecord;
  381.                      EventInfo           : SBBSEventRecord;
  382.                      NetMailEntered      : Boolean;
  383.                      EchoMailEntered     : Boolean;
  384.                      LoginTime           : String[5];
  385.                      LoginDate           : String[8];
  386.                      TmLimit             : Integer;
  387.                      LoginSec            : LongInt;
  388.                      Credit              : LongInt;
  389.                      UserRecNum          : Integer;
  390.                      ReadThru            : Integer;
  391.                      PageTimes           : Integer;
  392.                      DownLimit           : Integer;
  393.                      WantChat            : Boolean;
  394.                      GosubLevel          : Byte;
  395.                      GosubData           : SBBSGosubDataType;
  396.                      Menu                : String[8];
  397.                    End;
  398.  
  399.  
  400. {--------------------------------------------------------------------------|
  401.   Variables which contain the CONFIG and the EXITINFO.BBS info. Note
  402.   that I included SBBS in the variable name to avoid conflicts with the names
  403.   of other BBS's their configuration files.
  404. |--------------------------------------------------------------------------}
  405.  
  406. Var SBBSExitInfo  : SBBSExitRecord;
  407.     SBBSConfig    : SBBSConfigRecord;
  408.     SBBSEConfig   : SBBSExtraConfig;
  409.     SBBSEUser     : SBBSExtraUserRec;
  410.  
  411. {--------------------------------------------------------------------------|
  412.   And the procedures to read and write the configuration info.
  413.  
  414.   InitSBBS should be called once at the start of your program to initialize
  415.            your door for RemoteAccess.
  416.  
  417.   UpdateExitInfo
  418.          Rewrites the EXITINFO.BBS Record. To avoid problems with newer
  419.          version of SBBS, which probably add fields to this file, only
  420.          as much bytes are read and written as the size of the record
  421.          defined in this unit. As long as the file is upward compatible
  422.          this should avoid conflicts.
  423.          The function returns false if it wasn't able to write the info.
  424.  
  425.          The users TimeLimit and Security are always updated while writing,
  426.          Other field you have to change for yourself.
  427.  
  428. |--------------------------------------------------------------------------}
  429.  
  430.  
  431. Procedure InitSBBS;
  432. Function SBBSUpdateExitInfo:Boolean;
  433.  
  434. Implementation
  435. Uses LowLevel; { To avoid a circular reference error }
  436.  
  437. Const UseLog : Boolean = False; { Is set to TRUE as soon as a LogProcedure }
  438.                                 { is installed                             }
  439.  
  440. Const Months : Array[1..12] Of String[3] =
  441.       ('Jan','Feb','Mar','Apr','May','Jun',
  442.        'Jul','Aug','Sep','Oct','Nov','Dec');
  443.  
  444.  
  445. {$F+}
  446. Procedure SBBSLogIt(LogLine  : MaxlogStr);
  447. {$F-}
  448.  
  449. Var Log    : Text;
  450.     temp   : Integer;
  451.     Hour   : Word;
  452.     Minute : Word;
  453.     Second : Word;
  454.     Year   : Word;
  455.     Month  : Word;
  456.     Day    : Word;
  457.     Dum    : Word;
  458.  
  459. Begin
  460. If Not UseLog
  461.    Then Exit;
  462. {$IfDef UseMultiLanguage}
  463.   LogLine:=ExpandString(LogLine);
  464. {$EndIf}
  465. GetTime(Hour,Minute,Second,Dum);
  466. GetDate(Year,Month,Day,Dum);
  467.  
  468. LogLine:= SF(Day,2)+'-'+
  469.           Months[Month]+'-'+
  470.           SF(Year-1900,2)+' '+
  471.  
  472.           SF(Hour,2)+':'+
  473.           SF(Minute,2)+'  '+
  474.           LogLine;
  475.  
  476.  
  477. FileMode:=ReadWrite+ShareDenyNone;
  478. Assign(Log,GlobalInfo.LogFileName);
  479. Append(Log);
  480. If IoResult<>0
  481.    Then Rewrite(Log);
  482. WriteLn(Log,LogLine);
  483. Close(Log);
  484. If IoResult<>0
  485.    Then Begin
  486.         WriteLn(#254#7#7#7' Can''t LOG anymore !!!');
  487.         UseLog:=False;
  488.         End;
  489. End;
  490.  
  491. {----------------------------------------------------------------------------|
  492.  Read config function
  493. |----------------------------------------------------------------------------}
  494.  
  495.  
  496. Function ReadSBBSConfig:Boolean;
  497. Var Conf : FileObject;
  498.     EConf: FileObject;
  499.     Size : Word;
  500.  
  501. Begin
  502. ReadSBBSConfig:=False;
  503.  
  504. FillChar(SBBSConfig,SizeOf(SBBSConfig),#00);
  505. FillChar(SBBSEConfig,SizeOf(SBBSEConfig),#00);
  506.  
  507.  
  508. Conf.Open('CONFIG.BBS',1,ReadOnly+ShareDenyNone);
  509. If Conf.Error<>0
  510.    Then Begin
  511.         Conf.Open(SBBSPath+'CONFIG.BBS',1,ReadOnly+ShareDenyNone);
  512.         EConf.Open(SBBSPath+'SCONFIG.BBS',1,ReadOnly+ShareDenyNone);
  513.         If (Conf.Error<>0) Or
  514.            (EConf.Error<>0)
  515.            Then Begin
  516.                 Conf.Close;
  517.                 EConf.Close;
  518.                 Exit;
  519.                 End;
  520.         End
  521.    Else Begin
  522.         EConf.Open('SCONFIG.BBS',1,ReadOnly+ShareDenyNone);
  523.         If EConf.Error<>0
  524.            Then Begin
  525.                 Conf.Close;
  526.                 Exit;
  527.                 End;
  528.         End;
  529.  
  530. Size:=SizeOf(SBBSConfig);
  531. Conf.ReadBuffer(SBBSConfig,Size);
  532.  
  533. Size:=SizeOf(SBBSEConfig);
  534. EConf.ReadBuffer(SBBSEConfig,Size);
  535.  
  536. Conf.Close;
  537. EConf.Close;
  538.  
  539. With GlobalInfo Do
  540.  Begin
  541.  BBStag  := SBBS;
  542.  BBSName := 'SuperBBS v.'+S(Hi(SBBSEConfig.VersionNumber),0)+'.'+
  543.                           SF(Lo(SBBSEConfig.VersionNumber),2);
  544.  
  545.  OnlineStatus:=Normal;
  546.  SystemStatus:=S_OK;
  547.  
  548.  LogfileName   := 'SYSTEM.LOG';
  549.  LogType       := 0;
  550.  LogIt := SbbsLogIt;
  551.  
  552.  UseLog        := True;
  553.  TimeOutTime   := SBBSConfig.InactiveTimeout;
  554.  Warnings      := 2; { My constante! }
  555.  
  556.  
  557.  UserFilePath  := SBBSEConfig.MsgBasePath;
  558.  CompletePath(UserFilePath);
  559.  CommonDir     := SBBSEConfig.CommonDir;
  560.  CompletePath(CommonDir);
  561.  
  562.  LeftBracket   := '[';
  563.  RightBracket  := ']';
  564.  
  565.  SysopName     := SBBSConfig.SysOpName;
  566.  SystemName    := SBBSConfig.SystemName;
  567.  SystemLocation:= '* Unknown *';
  568.  
  569.  LocalMono     := SBBSConfig.MonoMode;
  570.  
  571.  If ExistParameter('P:')
  572.     Then ComPort:=Str2Nr(GrabParameter('P:'))
  573.     Else ComPort := SBBSConfig.CommPort;
  574.  
  575.  MultiLine     := SBBSEConfig.LinesInSystem>1;
  576.  End; {With}
  577.  
  578. {---- To make sure the major paths are all nice and complete... ---------}
  579.  
  580. CompletePath(SBBSConfig.MenuPath);
  581. CompletePath(SBBSConfig.TextPath);
  582. CompletePath(SBBSConfig.NetPath);
  583. CompletePath(SBBSEConfig.MsgBasePath);
  584. CompletePath(SBBSEConfig.SystemPath);
  585.  
  586. ReadSBBSConfig  := True;
  587. End;
  588.  
  589.  
  590.  
  591. {---- ExitInfo.bbs procedures -----------------------------------------}
  592.  
  593. {
  594.  If you want to use the update exitinfo, you have to tell the sysop to
  595.  provide the *E parameter on the commandline. Otherwise SBBS doesn't read
  596.  the ExitInfo on return from a door..
  597. }
  598.  
  599. {----------------------------------------------------------------------------|
  600.  Update ExitInfo function
  601. |----------------------------------------------------------------------------}
  602.  
  603.  
  604. Function SBBSUpdateExitInfo:Boolean;
  605. Var Info : FileObject;
  606.     Size : Word;
  607. Begin
  608. SBBSUpdateExitInfo:=False;
  609.  
  610. If GlobalInfo.MultiLine
  611.    Then Info.Open('EXITINFO.BBS',1,ReadWrite+ShareDenyNone)
  612.    Else Info.Open(GlobalInfo.SystemPath+'EXITINFO.BBS',1,ReadWrite+ShareDenyNone);
  613.  
  614. If Info.Error <> 0
  615.    Then Exit;
  616.  
  617. Size:=SizeOf(SBBSExitInfo);
  618.  
  619. SBBSExitInfo.UserInfo.SecLvl:=GlobalInfo.UserSecurity;
  620. SBBSExitInfo.TmLimit:=GlobalInfo.MinRemaining;
  621.  
  622. Info.GotoRecord(0);
  623. Info.WriteBuffer(SBBSExitInfo,Size);
  624. Info.Close;
  625.  
  626. SBBSUpdateExitInfo:=Info.Error=0;
  627. End;
  628.  
  629. {----------------------------------------------------------------------------|
  630.  Read ExitInfo function
  631. |----------------------------------------------------------------------------}
  632.  
  633. Function ReadExitInfo:Boolean;
  634. Var Info : FileObject;
  635.     Size : Word;
  636.  
  637. Begin
  638. ReadExitInfo:=False;
  639. FillChar(SBBSExitInfo,SizeOf(SBBSExitInfo),#00);
  640.  
  641. If GlobalInfo.MultiLine
  642.    Then Info.Open('EXITINFO.BBS',1,ReadOnly+ShareDenyNone)
  643.    Else Info.Open(GlobalInfo.SystemPath+'EXITINFO.BBS',1,ReadOnly+ShareDenyNone);
  644.  
  645. If Info.Error <> 0
  646.    Then Begin
  647.         LogIt('ExitInfo.bbs not found!');
  648.         Exit;
  649.         End;
  650.  
  651. Size:=SizeOf(SBBSExitInfo);
  652. Info.ReadBuffer(SBBSExitInfo,Size);
  653. Info.Close;
  654.  
  655. Size := SizeOf(SBBSEUser);
  656. Info.Open(GlobalInfo.SystemPath+'SUsers.bbs',1,ReadOnly+ShareDenyNone);
  657.  
  658. If Info.Error<>0
  659.    Then Begin
  660.         LogIt('SUSER.BBS not found!');
  661.         Exit;
  662.         End;
  663. Info.GotoRecord(SBBSExitInfo.UserInfo.ExtraUserRecPtr*Size);
  664. Info.ReadBuffer(SBBSEUser,Size);
  665. Info.Close;
  666.  
  667. With GlobalInfo Do
  668.  Begin
  669.  ScreenLength := SBBSExitInfo.UserInfo.Len;
  670.  ScreenWidth  := 80;
  671.  
  672.  UserName     := SBBSExitInfo.UserInfo.Name;
  673.  UserHandle   := SBBSEUser.Alias;
  674.  UserAge      := SBBSExitInfo.UserInfo.Age;
  675.  UserBirthDay := SBBSEUser.BirthDay;
  676.  UserGroup    := 1;
  677.  
  678.  If UserHandle=''
  679.     Then UserHandle:=SBBSExitInfo.UserInfo.Name;
  680.  
  681.  UserLocation := SBBSExitInfo.UserInfo.City;
  682.  UserSecurity := SBBSExitInfo.UserInfo.SecLvl;
  683.  
  684.  UseGraphics  := (SBBSExitInfo.UserInfo.Attrib  And $08 ) = $08;
  685.  UseAVATAR    := False; { Not in SBBS }
  686.  UseMoreYN    := (SBBSExitInfo.UserInfo.Attrib  And $04 ) = $04;
  687.  UseClrScr    := (SBBSExitInfo.UserInfo.Attrib  And $02 ) = $02;
  688.  UseQuietMode := (SBBSExitInfo.UserInfo.Attrib  And $80 ) = $80;
  689.  BaudRate     := SBBSExitInfo.BaudRate;
  690.  MinRemaining := SBBSExitInfo.TmLimit;
  691.  TimeLimit    := SBBSExitInfo.TmLimit;
  692.  End; {With}
  693.  
  694. GlobalInfo.IEMSI.Session:= False;
  695.  
  696.  
  697. ReadExitInfo:= True;
  698. End;
  699.  
  700.  
  701.  
  702. {--------------------------------------------------------------------------|
  703.   INITSBBS:
  704.  
  705.   Read the SBBS configuration files (CONFIG.RA and EXITINFO.BBS) and fill
  706.   and check for the standard commandline parameters.
  707.  
  708.   -T:<Time>     Maximal time in this door, overrules the EXITINFO.BBS setting
  709.                 The time has to be given in minutes. Mostly here for
  710.                 compatability with RAdoor 2.3
  711.   -N:<Node>     Node number, there's no other way under SBBS.
  712.                 Defaults to node 1
  713.   -P:<CommPort> Overrules the CONFIG.BBS Comport setting. Usefull for multiline
  714.                 Systems.
  715.   -NOS          Turns off local noise for default.
  716.  
  717.   Further the GlobalInfo variables SystemPath and HomeDir are filled:
  718.  
  719.   SystemPath    Path to the SBBS system directory. The environment variable
  720.                 SBBS= has to be there.
  721.  
  722.   HomeDir       The directory from where the door was fired up. I usual
  723.                 use this directory to look for auxilary files. The homedir
  724.                 is found by stripping the filename of ParamStr(0). The user
  725.                 can ALWAYS overrule this value by setting an environment
  726.                 variable <PROGNAME> with an other path. PROGNAME is the REAL
  727.                 name of the program (the EXE file) minus the path and the
  728.                 extention!
  729.  
  730. |--------------------------------------------------------------------------}
  731.  
  732.  
  733.  
  734. Procedure InitSBBS;
  735.  
  736. Var ProgName : String[8];
  737.     Dum      : String[4];
  738.     TTime    : Word;
  739. Begin
  740. SBBSPath:=GetEnv('SBBS');
  741. CompletePath(SBBSPath);
  742. GlobalInfo.SystemPath:=SBBSPath;
  743.  
  744.  
  745. FSplit(ParamStr(0),GlobalInfo.HomeDir,ProgName,Dum);
  746. If GetEnv(ProgName)<>''
  747.    Then GlobalInfo.HomeDir:=GetEnv(ProgName);
  748. If GlobalInfo.HomeDir<>''
  749.    Then CompletePath(GlobalInfo.HomeDir);
  750.  
  751.  
  752. GlobalInfo.Node:=Str2Nr(GrabParameter('N:'));
  753. If GlobalInfo.Node=0
  754.    Then GlobalInfo.Node:=1;
  755.  
  756. If Not ReadSBBSConfig
  757.    Then Begin
  758.         WriteLn(#254' Couldn''t read SBBS CONFIG info !');
  759.         Halt;
  760.         End;
  761.  
  762.  
  763. If Not ReadExitInfo
  764.    Then Begin
  765.         WriteLn(#254' Couldn''t read EXITINFO.BBS!');
  766.         Halt;
  767.         End;
  768.  
  769. If ExistParameter('T:')
  770.    Then Begin
  771.         TTime:=Str2Nr(GrabParameter('T:'));
  772.         If TTime<=GlobalInfo.MinRemaining
  773.            Then GlobalInfo.MinRemaining:=TTime;
  774.         End;
  775.  
  776. GlobalInfo.Language:=SBBSEUser.LanguageFileN;
  777. If GlobalInfo.Language=''
  778.    Then GlobalInfo.Language:='ENG';
  779.  
  780. If ExistParameter('NOS')
  781.    Then GlobalInfo.LocalNoise:=False;
  782.  
  783. End;
  784.  
  785. End.
  786.