From 26d2da196e82acf4f8c1f8d1e2cc393b75c9708b Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Fri, 24 Feb 2012 16:46:14 -0500 Subject: [PATCH] Minor reformatting and updates. Mystic compiles for Linux again now. --- mystic/bbs_cfg_useredit.pas | 4 +-- mystic/bbs_common.pas | 24 ++++++------- mystic/bbs_doors.pas | 2 +- mystic/bbs_filebase.pas | 72 +++++++++++++++++++++++++++---------- mystic/bbs_general.pas | 4 +-- mystic/bbs_io.pas | 6 ++-- mystic/bbs_menus.pas | 2 +- mystic/bbs_sysopchat.pas | 8 ++--- mystic/bbs_user.pas | 2 +- mystic/install.pas | 11 +++--- mystic/install_ansi.pas | 2 +- mystic/mystic.pas | 13 ++++--- mystic/todo.pas | 1 - 13 files changed, 93 insertions(+), 58 deletions(-) diff --git a/mystic/bbs_cfg_useredit.pas b/mystic/bbs_cfg_useredit.pas index b4afa50..f39299b 100644 --- a/mystic/bbs_cfg_useredit.pas +++ b/mystic/bbs_cfg_useredit.pas @@ -333,8 +333,8 @@ Begin Screen.PutScreenImage(Image); - Session.SetTimeLeft (Session.User.TempUser.TimeLeft); - Update_Status_Line (StatusPtr, ''); + Session.SetTimeLeft (Session.User.TempUser.TimeLeft); + UpdateStatusLine (StatusPtr, ''); End; {$ENDIF} diff --git a/mystic/bbs_common.pas b/mystic/bbs_common.pas index 10221c3..7f2da39 100644 --- a/mystic/bbs_common.pas +++ b/mystic/bbs_common.pas @@ -59,8 +59,8 @@ Function CheckPath (Str: String) : String; Function ShellDOS (ExecPath: String; Command: String) : LongInt; {$IFNDEF UNIX} -Procedure Update_Status_Line (Mode: Byte; Str: String); -Procedure Process_Sysop_Cmd (Cmd: Char); +Procedure UpdateStatusLine (Mode: Byte; Str: String); +Procedure ProcessSysopCommand (Cmd: Char); {$ENDIF} Implementation @@ -243,8 +243,8 @@ Begin End; Function ShellDOS (ExecPath: String; Command: String) : LongInt; -Var {$IFNDEF UNIX} + Var Image : TConsoleImageRec; {$ENDIF} Begin @@ -303,14 +303,14 @@ Begin {$IFNDEF UNIX} Screen.PutScreenImage(Image); - Update_Status_Line(StatusPtr, ''); + UpdateStatusLine(StatusPtr, ''); {$ENDIF} Session.TimeOut := TimerSeconds; End; {$IFNDEF UNIX} -Procedure Update_Status_Line (Mode: Byte; Str: String); +Procedure UpdateStatusLine (Mode: Byte; Str: String); Begin If Not Config.UseStatusBar Then Exit; @@ -354,7 +354,7 @@ Begin Screen.SetWindow (1, 1, 80, 24, False); End; -Procedure Process_Sysop_Cmd (Cmd: Char); +Procedure ProcessSysopCommand (Cmd: Char); Var A : Integer; X, @@ -367,7 +367,7 @@ Begin {U} #22 : Begin X := Screen.CursorX; Y := Screen.CursorY; - Update_Status_Line (0, 'Upgrade Security Level: '); + UpdateStatusLine (0, 'Upgrade Security Level: '); Screen.SetWindow (1, 25, 80, 25, False); Screen.TextAttr := 8 + 7 * 16; Screen.CursorXY (52, 2); @@ -380,7 +380,7 @@ Begin Session.SetTimeLeft(Session.User.ThisUser.TimeLeft); End; - Update_Status_Line(StatusPtr, ''); + UpdateStatusLine(StatusPtr, ''); Screen.CursorXY (X, Y); End; @@ -395,7 +395,7 @@ Begin Screen.WriteXY (1, 25, 0, strRep(' ', 80)); Screen.SetWindow (1, 1, 80, 25, False); End Else - Update_Status_Line (StatusPtr, ''); + UpdateStatusLine (StatusPtr, ''); End; {S} #31 : If Not Session.User.InChat Then OpenChat(True); {H} #35 : Begin @@ -413,7 +413,7 @@ Begin Else StatusPtr := 1; - Update_Status_Line (StatusPtr, ''); + UpdateStatusLine (StatusPtr, ''); End; #59.. #62 : Begin @@ -428,11 +428,11 @@ Begin End; {+} #130: If Session.TimeLeft > 1 Then Begin Session.SetTimeLeft(Session.TimeLeft-1); - Update_Status_Line(StatusPtr, ''); + UpdateStatusLine(StatusPtr, ''); End; {-} #131: If Session.TimeLeft < 999 Then Begin Session.SetTimeLeft(Session.TimeLeft+1); - Update_Status_Line(StatusPtr, ''); + UpdateStatusLine(StatusPtr, ''); End; End; End; diff --git a/mystic/bbs_doors.pas b/mystic/bbs_doors.pas index 19d6c54..a469dc5 100644 --- a/mystic/bbs_doors.pas +++ b/mystic/bbs_doors.pas @@ -263,7 +263,7 @@ Begin Screen.SetWindowTitle(WinConsoleTitle + strI2S(Session.NodeNum)); Screen.PutScreenImage(Image); - Update_Status_Line(StatusPtr, ''); + UpdateStatusLine(StatusPtr, ''); Session.TimeOut := TimerSeconds; End; diff --git a/mystic/bbs_filebase.pas b/mystic/bbs_filebase.pas index 3d37a97..6085f8f 100644 --- a/mystic/bbs_filebase.pas +++ b/mystic/bbs_filebase.pas @@ -233,8 +233,8 @@ Begin If Not Send And Protocol.Batch Then Path := FName; If Res[1] = '!' Then Begin - Delete (Res, 1, 1); - ExecuteMPL(NIL, Res); + Delete (Res, 1, 1); + ExecuteMPL (NIL, Res); End Else {$IFDEF UNIX} ShellDOS (Path, 'sh ' + Session.TempPath + 'xfer.sh'); @@ -242,7 +242,7 @@ Begin ShellDOS (Path, Session.TempPath + 'xfer.bat'); {$ENDIF} - DirChange(Config.SystemPath); + DirChange (Config.SystemPath); End; Procedure TFileBase.GetTransferTime (Size: Longint; Var Mins : Integer; Var Secs: Byte); @@ -284,10 +284,13 @@ Begin FDir.DescLines := 0; While Not Eof(tFile) Do Begin - Inc (FDir.DescLines); + Inc (FDir.DescLines); ReadLn (tFile, Session.Msgs.MsgText[FDir.DescLines]); + Session.Msgs.MsgText[FDir.DescLines] := strStripLOW(Session.Msgs.MsgText[FDir.DescLines]); + If Length(Session.Msgs.MsgText[FDir.DescLines]) > mysMaxFileDescLen Then Session.Msgs.MsgText[FDir.DescLines][0] := Chr(mysMaxFileDescLen); + If FDir.DescLines = Config.MaxFileDesc Then Break; End; @@ -315,6 +318,7 @@ Begin Assign (FScanFile, Config.DataPath + FBase.FileName + '.scn'); {$I-} Reset (FScanFile); {$I+} + If IoResult <> 0 Then ReWrite (FScanFile); If FileSize(FScanFile) < Session.User.UserNum - 1 Then Begin @@ -475,6 +479,7 @@ Begin TotalFiles := 0; Reset (FBaseFile); + While Not Eof(FBaseFile) Do Begin Read (FBaseFile, FBase); If Session.User.Access(FBase.ListACS) Then Begin @@ -498,7 +503,9 @@ Begin If IoResult = 0 Then Begin Assign (DF, Config.DataPath + FBase.FileName + '.des'); {$I-} Reset (DF, 1); {$I+} + If IoResult <> 0 Then ReWrite (DF, 1); + While Not Eof(FDirFile) Do Begin Read (FDirFile, FDir); If (NewFiles and (FDir.DateTime > FScan.LastNew)) or Not NewFiles Then @@ -541,6 +548,7 @@ Begin Session.io.OutFullLn (Session.GetPrompt(223)); End; End; + Close (FBaseFile); Close (TF); @@ -781,6 +789,7 @@ Var Session.io.PromptInfo[3] := Session.io.OutYN(FScan.NewScan > 0); Session.io.OutFull (Session.GetPrompt(201)); + If (Total MOD 2 = 0) And (Total > 0) Then Session.io.OutRawLn(''); End; @@ -845,8 +854,11 @@ Begin Repeat Session.io.OutFull (Session.GetPrompt(202)); + Temp := Session.io.GetInput(11, 11, 12, ''); + If (Temp = '') or (Temp = 'Q') Then Break; + If Temp = '?' Then List_Bases Else Begin @@ -857,12 +869,14 @@ Begin N1 := strS2I(Temp); N2 := N1; End; + For A := N1 to N2 Do If (A > 0) and (A <= Total) Then ToggleBase(A); End; Until False; Close (FBaseFile); + FBase := Old; End; @@ -886,9 +900,11 @@ Begin While Not Eof(ArcFile) Do Begin Read (ArcFile, Arc); + Session.io.PromptInfo[1] := strI2S(FilePos(ArcFile)); Session.io.PromptInfo[2] := Arc.Desc; Session.io.PromptInfo[3] := Arc.Ext; + Session.io.OutFullLn (Session.GetPrompt(170)); End; @@ -1658,8 +1674,6 @@ Var Pos(Data, strUpper(Temp))); Screen.TextAttr := Attr; - - Session.systemlog('debug: ' + temp); End; End; @@ -1861,6 +1875,7 @@ Var If Batch[A].FileName = FDir.FileName Then Begin List[ListSize + 1].Batch := True; Session.io.PromptInfo[3] := Session.Lang.TagCh; + Break; End; @@ -1868,6 +1883,7 @@ Var If Not OK Then Begin IsNotLast := True; + Break; End; @@ -2134,7 +2150,7 @@ Var Reset (FDirFile); Reset (DataFile, 1); - fullReDraw; + FullReDraw; DrawPage; If CurPos > ListSize Then CurPos := ListSize; @@ -2148,7 +2164,7 @@ Var 'V' : Begin Session.io.AnsiGotoXY (1, 23); If ArchiveView(FBase.Path + List[CurPos].FileName) Then Begin - fullRedraw; + FullRedraw; DrawPage; End Else PrintMessage (324); @@ -2293,7 +2309,9 @@ Begin If (Mode = 1) and (Data = 'SEARCH') Then Begin Session.io.OutFull (Session.GetPrompt(195)); + Data := Session.io.GetInput(70, 70, 11, '*.*'); + If Data = '' Then Exit; End; @@ -2317,14 +2335,13 @@ Begin {$I-} Reset (DataFile, 1); {$I+} If IoResult <> 0 Then ReWrite (DataFile, 1); - Result := 0; - - CurPage := 0; - TopPage := 0; - TopDesc := 0; - BotPage := 0; - BotDesc := 0; - Found := False; + Result := 0; + CurPage := 0; + TopPage := 0; + TopDesc := 0; + BotPage := 0; + BotDesc := 0; + Found := False; If (Session.User.ThisUser.FileList = 1) and (Session.io.Graphics > 0) Then Ansi_List @@ -2375,6 +2392,7 @@ Var Begin Assign (TempFile, Config.DataPath + FBase.FileName + '.dir'); {$I-} Reset (TempFile); {$I+} + If IoResult <> 0 Then ReWrite (TempFile); While Not Eof(TempFile) Do Begin @@ -2388,6 +2406,7 @@ Var Break; End; End; + Close (TempFile); End; @@ -2450,7 +2469,6 @@ Var DataFile : File; TempFile : File; Found : Boolean; - LogFile : Text; FileStatus : Boolean; Begin @@ -2466,6 +2484,8 @@ Begin If IoResult = 0 Then Read (FBaseFile, FBase); Close (FBaseFile); + + // reset ignoregroup here? End; If Not Session.User.Access(FBase.ULacs) Then Begin @@ -2490,6 +2510,9 @@ Begin If Config.FreeUL > 0 Then Begin FSplit (FBase.Path, D, N, E); + + // this might be broken? + If DiskFree(Ord(UpCase(D[1])) - 64) DIV 1024 < Config.FreeUL Then Begin Session.io.OutFullLn (Session.GetPrompt(81)); FBase := OLD; @@ -2562,11 +2585,15 @@ Begin If Not FileStatus Then Begin Session.SystemLog ('Failed Upload: ' + FileName + ' to ' + strStripMCI(FBase.Name)); + Session.io.OutFull (Session.GetPrompt(84)); + FileErase(FullName); End Else Begin Found := True; + Session.SystemLog ('Uploaded: ' + FileName + ' to ' + strStripMCI(FBase.Name)); + Session.io.OutFull (Session.GetPrompt(83)); FDir.FileName := FileName; @@ -2581,6 +2608,7 @@ Begin If IsDupeFile(FileName, Config.FDupeScan = 2) Then Begin Session.io.OutFullLn (Session.GetPrompt(378)); + Continue; End Else Session.io.OutFullLn (Session.GetPrompt(379)); @@ -2611,8 +2639,10 @@ Begin If ShellDOS('', Temp) <> Config.TestPassLevel Then Begin Session.io.OutFullLn (Session.GetPrompt(35)); + Session.SystemLog (FileName + ' has failed upload test'); - FDir.Flags := FDir.Flags Or FDirFailed; + + FDir.Flags := FDir.Flags or FDirFailed; End Else Session.io.OutFullLn (Session.GetPrompt(55)); End; @@ -2624,6 +2654,7 @@ Begin Session.io.OutFullLn (Session.GetPrompt(381)) Else Begin Session.io.OutFullLn (Session.GetPrompt(382)); + GetFileDescription(FileName); End; End Else @@ -2636,6 +2667,7 @@ Begin Assign (TempFile, FBase.Path + FileName); {$I-} Reset (TempFile, 1); {$I+} + If IoResult = 0 Then Begin FDir.Size := FileSize(TempFile); Close (TempFile); @@ -2648,6 +2680,7 @@ Begin Assign (FDirFile, Config.DataPath + FBase.FileName + '.dir'); {$I-} Reset (FDirFile); {$I+} + If IoResult <> 0 Then ReWrite (FDirFile); Seek (FDirFile, FileSize(FDirFile)); @@ -2660,6 +2693,7 @@ Begin Inc (Session.HistoryULKB, FDir.Size DIV 1024); End; End; + Close (LogFile); End; @@ -2919,6 +2953,7 @@ Begin Session.io.OutFile ('fsearch', True, 0); Session.io.OutFull (Session.GetPrompt(196)); + Str := Session.io.GetInput(40, 40, 12, ''); If Str = '' Then Exit; @@ -2926,6 +2961,7 @@ Begin Session.SystemLog ('File search: "' + Str + '"'); All := Session.io.GetYN(Session.GetPrompt(197), True); + If All Then Session.User.IgnoreGroup := Session.io.GetYN(Session.GetPrompt(64), True); If All Then Begin diff --git a/mystic/bbs_general.pas b/mystic/bbs_general.pas index 079db18..d2d94dc 100644 --- a/mystic/bbs_general.pas +++ b/mystic/bbs_general.pas @@ -1397,7 +1397,7 @@ Begin Session.SystemLog('Chat Page: ' + Temp); - Update_Status_Line (0, ' ' + strPadR(Session.User.ThisUser.Handle, 17, ' ') + ' ' + strPadR(Temp, 40, ' ') + ' ALT+(S)plit (C)Line'); + UpdateStatusLine (0, ' ' + strPadR(Session.User.ThisUser.Handle, 17, ' ') + ' ' + strPadR(Temp, 40, ' ') + ' ALT+(S)plit (C)Line'); Session.io.OutFull(Session.GetPrompt(24)); @@ -1421,7 +1421,7 @@ Begin End; End; - Update_Status_line (StatusPtr, ''); + UpdateStatusLine (StatusPtr, ''); Session.io.OutFull (Session.GetPrompt(28)); diff --git a/mystic/bbs_io.pas b/mystic/bbs_io.pas index ac115c6..26b1e43 100644 --- a/mystic/bbs_io.pas +++ b/mystic/bbs_io.pas @@ -1151,7 +1151,7 @@ Begin Exit; End; - Process_Sysop_Cmd (Result); + ProcessSysopCommand(Result); Result := #1; End; @@ -1246,7 +1246,7 @@ Begin Session.LastTimeLeft := TimeCount; {$IFNDEF UNIX} - Update_Status_Line(StatusPtr, ''); + UpdateStatusLine(StatusPtr, ''); {$ENDIF} If TBBSCore(Core).TimerOn Then Begin @@ -1825,7 +1825,7 @@ Procedure TBBSIO.LocalScreenEnable; Begin Screen.Active := True; Screen.ShowBuffer; - Update_Status_Line(StatusPtr, ''); + UpdateStatusLine(StatusPtr, ''); End; {$ENDIF} diff --git a/mystic/bbs_menus.pas b/mystic/bbs_menus.pas index a04a062..8c8b889 100644 --- a/mystic/bbs_menus.pas +++ b/mystic/bbs_menus.pas @@ -109,7 +109,7 @@ Begin End; {$IFNDEF UNIX} - Update_Status_Line(StatusPTR, ''); + UpdateStatusLine(StatusPTR, ''); {$ENDIF} End; diff --git a/mystic/bbs_sysopchat.pas b/mystic/bbs_sysopchat.pas index 8771edd..02c7976 100644 --- a/mystic/bbs_sysopchat.pas +++ b/mystic/bbs_sysopchat.pas @@ -98,7 +98,7 @@ Begin End; Case Ch of - #00 : If Session.io.LocalInput Then Process_Sysop_Cmd(Input.ReadKey); + #00 : If Session.io.LocalInput Then ProcessSysopCommand(Input.ReadKey); ^R : If Session.io.LocalInput Then Total_ReDraw; #08 : If Session.io.LocalInput Then Begin If SysopX > Session.io.ScreenInfo[7].X Then Begin @@ -254,7 +254,7 @@ Begin Screen.GetScreenImage(1,1,79,24,Image); - Update_Status_Line (0, '(ESC) to Quit, (Ctrl-R) to Redraw'); + UpdateStatusLine (0, '(ESC) to Quit, (Ctrl-R) to Redraw'); If Config.ChatLogging Then Begin Assign (tFile, Config.LogsPath + 'chat.log'); @@ -279,7 +279,7 @@ Begin Session.io.RemoteRestore(Image); - Update_Status_Line (StatusPtr, ''); + UpdateStatusLine (StatusPtr, ''); End; -End. \ No newline at end of file +End. diff --git a/mystic/bbs_user.pas b/mystic/bbs_user.pas index 51d2ffe..098eb56 100644 --- a/mystic/bbs_user.pas +++ b/mystic/bbs_user.pas @@ -1141,7 +1141,7 @@ Begin End; {$IFNDEF UNIX} - Update_Status_Line(StatusPtr, ''); + UpdateStatusLine(StatusPtr, ''); {$ENDIF} End; diff --git a/mystic/install.pas b/mystic/install.pas index c9757d0..6f6a0ee 100644 --- a/mystic/install.pas +++ b/mystic/install.pas @@ -488,9 +488,8 @@ Begin Screen.WriteLine ('Switch to the Mystic directory (' + Config.SystemPath + ') and then:'); Screen.WriteLine(''); {$IFDEF WINDOWS} - Screen.WriteLine ('Type "MYSTIC -L" to run Mystic in local mode'); - Screen.WriteLine ('Type "MCFG" to run the external configuration utility'); - Screen.WriteLine ('Type "MYSTIC -CFG" to run the internal configuration utility'); + Screen.WriteLine ('Type "MYSTIC" to run Mystic in local mode'); + Screen.WriteLine ('Type "MYSTIC -CFG" to run the configuration utility'); Screen.WriteLine(''); Screen.WriteLine ('As always, read the documentation!'); {$ENDIF} @@ -501,8 +500,7 @@ Begin Screen.WriteLine ('Set your terminal to 80x25 lines with an IBM characterset font!'); Screen.WriteLine(''); Screen.WriteLine ('Type "./mystic" from the installed directory to login locally'); - Screen.WriteLine ('Type "./mcfg" to run the external configuration utility'); - Screen.WriteLine ('Type "./mystic -cfg" to run the internal configuration utility'); + Screen.WriteLine ('Type "./mystic -cfg" to run the configuration utility'); {$ENDIF} {$IFDEF DARWIN} Screen.WriteLine ('Please read osx.install.doc for installation instructions'); @@ -512,8 +510,7 @@ Begin Screen.WriteLine ('See documentation for more terminal suggestions!'); Screen.WriteLine(''); Screen.WriteLine ('Type "./mystic" from the installed directory to login locally'); - Screen.WriteLine ('Type "./mcfg" to run the external configuration utility'); - Screen.WriteLine ('Type "./mystic -cfg" to run the internal configuration utility'); + Screen.WriteLine ('Type "./mystic -cfg" to run the configuration utility'); {$ENDIF} Screen.WriteLine(''); diff --git a/mystic/install_ansi.pas b/mystic/install_ansi.pas index e20b3a3..29ca11f 100644 --- a/mystic/install_ansi.pas +++ b/mystic/install_ansi.pas @@ -61,5 +61,5 @@ const Begin Screen.LoadScreenImage(ImageData, ImageData_Length, ImageData_Width, 1, 1); Screen.WriteXY (1, 13, 7, strPadC('Mystic BBS Installation Utility Version ' + mysVersion, 79, ' ')); - Screen.WriteXY (1, 14, 7, strPadC('Copyright (C) 1997-2011 By James Coyle. All Rights Reserved.', 79, ' ')); + Screen.WriteXY (1, 14, 7, strPadC('Copyright (C) 1997-2012 By James Coyle. All Rights Reserved.', 79, ' ')); End; diff --git a/mystic/mystic.pas b/mystic/mystic.pas index 7651288..d13905e 100644 --- a/mystic/mystic.pas +++ b/mystic/mystic.pas @@ -164,7 +164,7 @@ Var Begin Session.NodeNum := 0; - For Count := 1 to Config.INetTNMax Do Begin + For Count := 1 to Config.INetTNNodes Do Begin Assign (ChatFile, Config.DataPath + 'chat' + strI2S(Count) + '.dat'); {$I-} Reset(ChatFile); {$I+} @@ -268,11 +268,13 @@ Begin Close (Session.LangFile); If Not Session.LoadThemeData(Config.DefThemeFile) Then Begin - Screen.WriteLine ('ERROR: Default theme prompts not found [' + Config.DefThemeFile + '.lng]'); + If Not Session.ConfigMode Then Begin + Screen.WriteLine ('ERROR: Default theme prompts not found [' + Config.DefThemeFile + '.lng]'); - DisposeClasses; + DisposeClasses; - Halt(1); + Halt(1); + End; End; Assign (Session.User.UserFile, Config.DataPath + 'users.dat'); @@ -461,6 +463,7 @@ Begin If Session.ConfigMode Then Begin Configuration_MainMenu; + Screen.TextAttr := 7; Screen.ClearScreen; Screen.BufFlush; Halt(0); @@ -481,7 +484,7 @@ Begin {$ENDIF} {$IFNDEF UNIX} - Update_Status_Line(0, ''); + UpdateStatusLine(0, ''); {$ENDIF} Set_Node_Action (Session.GetPrompt(345)); diff --git a/mystic/todo.pas b/mystic/todo.pas index 8a6409c..0083a5c 100644 --- a/mystic/todo.pas +++ b/mystic/todo.pas @@ -8,7 +8,6 @@ design elements/issues. BUGS AND POSSIBLE ISSUES ======================== -? Validate ARCHIVE extensions are not case sensitive in Mystic ! GOTO does not always work properly in MPL (IceDevil) ! Complex boolean evaluations using numerical variables can sometime fail to compile (IceDevil)