From 85f02a78bf6fa5274f65cc76502cc7a9e3e5bf16 Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Thu, 23 Feb 2012 19:45:28 -0500 Subject: [PATCH] Restructure of filebase list data files --- mystic/109to110.pas | 78 ++++++++++++++++-- mystic/bbs_filebase.pas | 166 +++++++++++++++++++------------------- mystic/mbbsutil.pas | 24 +++--- mystic/mis_client_ftp.pas | 26 +++--- mystic/records.pas | 22 ++--- mystic/todo.pas | 101 ++++++++++++++++++++++- 6 files changed, 293 insertions(+), 124 deletions(-) diff --git a/mystic/109to110.pas b/mystic/109to110.pas index 946bc27..418dea6 100644 --- a/mystic/109to110.pas +++ b/mystic/109to110.pas @@ -6,11 +6,24 @@ Program UP110; Uses CRT, - m_Strings; + DOS, + m_Strings, + m_FileIO; {$I RECORDS.PAS} Type + OldFDirRec = Record { *.DIR } + FileName : String[70]; { File name } + Size : LongInt; { File size (in bytes) } + DateTime : LongInt; { Date and time of upload } + Uploader : String[30]; { User name who uploaded the file } + Flags : Byte; { Set of FDIRFLAGS (see above) } + Pointer : LongInt; { Pointer to file description } + Lines : Byte; { Number of description lines } + DLs : Word; { # of times this file was downloaded} + End; + ExtAddrType = Record Zone, Net, @@ -955,20 +968,71 @@ Begin End; End; +Procedure ConvertFileLists; +Var + DirInfo : SearchRec; + OldList : OlDFDirRec; + OldFile : File of OldFDirRec; + List : RecFileList; + ListFile : File of RecFileList; + FN : String; +Begin + WriteLn ('[-] Updating file listings...'); + + FindFirst (Config.DataPath + '*.dir', AnyFile, DirInfo); + + While DosError = 0 Do Begin + FN := Config.DataPath + JustFile(DirInfo.Name) + '.old'; + + RenameFile (Config.DataPath + DirInfo.Name, FN); + + Assign (OldFile, FN); + Reset (OldFile); + + Assign (ListFile, Config.DataPath + DirInfo.Name); + ReWrite (ListFile); + + While Not Eof(OldFile) Do Begin + Read (OldFile, OldList); + + List.FileName := OldList.FileName; + List.Size := OldList.Size; + List.DateTime := OldList.DateTime; + List.Uploader := OldList.Uploader; + List.Flags := OldList.Flags; + List.Downloads := OldList.DLs; + List.Rating := 0; + List.DescPtr := OldList.Pointer; + List.DescLines := OldList.Lines; + + Write (ListFile, List); + End; + + Close (OldFile); + Close (ListFile); + + DeleteFile (FN); + FindNext (DirInfo); + End; + + FindClose(DirInfo); +End; + Var ConfigFile : File of RecConfig; Begin WarningDisplay; -// comment this out ONLY IF config needs converting -// Assign (ConfigFile, 'mystic.dat'); -// Reset (ConfigFile); -// Read (ConfigFile, Config); -// Close (ConfigFile); +// COMMENT this out if mystic.dat is being converted: + Assign (ConfigFile, 'mystic.dat'); + Reset (ConfigFile); + Read (ConfigFile, Config); + Close (ConfigFile); - ConvertConfig; //1.10a11 +// ConvertConfig; //1.10a11 // ConvertUsers; //1.10a11 //ConvertSecurity; //1.10a11 +ConvertFileLists; //1.10a11 // ConvertArchives; //1.10a1 // ConvertGroups; //1.10a1 diff --git a/mystic/bbs_filebase.pas b/mystic/bbs_filebase.pas index ef4f525..f901d21 100644 --- a/mystic/bbs_filebase.pas +++ b/mystic/bbs_filebase.pas @@ -24,7 +24,7 @@ Type TFileBase = Class FBaseFile : File of FBaseRec; - FDirFile : File of FDirRec; + FDirFile : File of RecFileList; FScanFile : File of FScanRec; ProtocolFile : File of RecProtocol; FGroupFile : File of RecGroup; @@ -32,7 +32,7 @@ Type FBase : FBaseRec; FGroup : RecGroup; FScan : FScanRec; - FDir : FDirRec; + FDir : RecFileList; Arc : RecArchive; Protocol : RecProtocol; BatchNum : Byte; @@ -261,12 +261,12 @@ Function TFileBase.ImportDIZ (FN: String) : Boolean; Var A : Byte; Begin - For A := Num To FDir.Lines - 1 Do + For A := Num To FDir.DescLines - 1 Do Session.Msgs.Msgtext[A] := Session.Msgs.MsgText[A + 1]; - Session.Msgs.MsgText[FDir.Lines] := ''; + Session.Msgs.MsgText[FDir.DescLines] := ''; - Dec (FDir.Lines); + Dec (FDir.DescLines); End; Var @@ -280,26 +280,26 @@ Begin {$I-} Reset (tFile); {$I+} If IoResult = 0 Then Begin - Result := True; - FDir.Lines := 0; + Result := True; + FDir.DescLines := 0; While Not Eof(tFile) Do Begin - Inc (FDir.Lines); - ReadLn (tFile, Session.Msgs.MsgText[FDir.Lines]); - Session.Msgs.MsgText[FDir.Lines] := strStripLOW(Session.Msgs.MsgText[FDir.Lines]); - If Length(Session.Msgs.MsgText[FDir.Lines]) > mysMaxFileDescLen Then Session.Msgs.MsgText[FDir.Lines][0] := Chr(mysMaxFileDescLen); - If FDir.Lines = Config.MaxFileDesc Then Break; + 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; Close (tFile); FileErase(Session.TempPath + 'file_id.diz'); - While (Session.Msgs.MsgText[1] = '') and (FDir.Lines > 0) Do + While (Session.Msgs.MsgText[1] = '') and (FDir.DescLines > 0) Do RemoveLine(1); - While (Session.Msgs.MsgText[FDir.Lines] = '') And (FDir.Lines > 0) Do - Dec (FDir.Lines); + While (Session.Msgs.MsgText[FDir.DescLines] = '') And (FDir.DescLines > 0) Do + Dec (FDir.DescLines); End; End; @@ -510,8 +510,8 @@ Begin WriteLn (TF, FDir.FileName); Write (TF, ' `- ' + strPadL(strComma(FDir.Size), 11, ' ') + ' ' + DateDos2Str(FDir.DateTime, Session.User.ThisUser.DateType) + ' '); - Seek (DF, FDir.Pointer); - For A := 1 to FDir.Lines Do Begin + Seek (DF, FDir.DescPtr); + For A := 1 to FDir.DescLines Do Begin BlockRead (DF, Temp[0], 1); BlockRead (DF, Temp[1], Ord(Temp[0])); If A = 1 Then WriteLn (TF, Temp) Else WriteLn (TF, strRep(' ', 27) + Temp); @@ -1349,7 +1349,7 @@ Function TFileBase.ListFileAreas (Compress: Boolean) : Integer; Var Total : Word = 0; Listed : Word = 0; - tDirFile : File of FDirRec; + tDirFile : File of RecFileList; Begin Reset (FBaseFile); @@ -1588,8 +1588,8 @@ Var 3 : Begin T2 := Bool_Search(Data, FDir.FileName); If Not T2 Then Begin - Seek (DataFile, FDir.Pointer); - For A := 1 to FDir.Lines Do Begin + Seek (DataFile, FDir.DescPtr); + For A := 1 to FDir.DescLines Do Begin BlockRead (DataFile, Temp[0], 1); BlockRead (DataFile, Temp[1], Length(Temp)); If Bool_Search(Data, Temp) Then Begin @@ -1696,11 +1696,11 @@ Var If Not OkFile Then Continue; If TopDesc > 0 Then Begin - Inc (Count, FDir.Lines - (FDir.Lines - TopDesc + 1) + 1); - If TopDesc = FDir.Lines + 2 Then Dec(Count); + Inc (Count, FDir.DescLines - (FDir.DescLines - TopDesc + 1) + 1); + If TopDesc = FDir.DescLines + 2 Then Dec(Count); TopDesc := 0; End Else Begin - Inc (Count, FDir.Lines + 1); + Inc (Count, FDir.DescLines + 1); If FBase.ShowUL Then Inc(Count); End; End; @@ -1838,7 +1838,7 @@ Var Session.io.PromptInfo[3] := ' '; Session.io.PromptInfo[4] := GetFileListSize; Session.io.PromptInfo[5] := DateDos2Str(FDir.DateTime, Session.User.ThisUser.DateType); - Session.io.PromptInfo[6] := strI2S(FDir.DLs); + Session.io.PromptInfo[6] := strI2S(FDir.Downloads); List[ListSize + 1].Batch := False; @@ -1864,10 +1864,10 @@ Var End Else HeaderCheck; - If BotDesc <= FDir.Lines + 2 Then Begin { skip if 1st line is uler } - Seek (DataFile, FDir.Pointer); + If BotDesc <= FDir.DescLines + 2 Then Begin { skip if 1st line is uler } + Seek (DataFile, FDir.DescPtr); - For A := 1 to FDir.Lines Do Begin + For A := 1 to FDir.DescLines Do Begin BlockRead (DataFile, Str[0], 1); BlockRead (DataFile, Str[1], Ord(Str[0])); @@ -1878,7 +1878,7 @@ Var If A = 1 Then Begin Session.io.PromptInfo[1] := GetFileListSize; Session.io.PromptInfo[2] := DateDos2Str(FDir.DateTime, Session.User.ThisUser.DateType); - Session.io.PromptInfo[3] := strI2S(FDir.DLs); + Session.io.PromptInfo[3] := strI2S(FDir.Downloads); Session.io.PromptInfo[4] := Str; Session.io.PromptInfo[5] := FDir.Uploader; OK := ShowText(strDesc); @@ -1891,7 +1891,7 @@ Var End; End; - If BotDesc > FDir.Lines Then Begin + If BotDesc > FDir.DescLines Then Begin If FBase.ShowUL Then Begin OK := ShowText(strUploader); If OK Then @@ -2334,8 +2334,8 @@ Var Procedure Check_Area; Var - TempFile : File of FDirRec; - Temp : FDirRec; + TempFile : File of RecFileList; + Temp : RecFileList; Begin Assign (TempFile, Config.DataPath + FBase.FileName + '.dir'); {$I-} Reset (TempFile); {$I+} @@ -2382,21 +2382,21 @@ Begin Session.io.OutFullLn (Session.GetPrompt(72)); - FDir.Lines := Config.MaxFileDesc; + FDir.DescLines := Config.MaxFileDesc; For A := 1 to Config.MaxFileDesc Do Begin Session.io.PromptInfo[1] := strZero(A); Session.io.OutFull (Session.GetPrompt(207)); Session.Msgs.MsgText[A] := Session.io.GetInput(mysMaxFileDescLen, mysMaxFileDescLen, 11, ''); If Session.Msgs.MsgText[A] = '' Then Begin - FDir.Lines := Pred(A); + FDir.DescLines := Pred(A); Break; End; End; - If FDir.Lines = 0 Then Begin + If FDir.DescLines = 0 Then Begin Session.Msgs.MsgText[1] := Session.GetPrompt(208); - FDir.Lines := 1; + FDir.DescLines := 1; End; End; @@ -2533,11 +2533,12 @@ Begin Session.SystemLog ('Uploaded: ' + FileName + ' to ' + strStripMCI(FBase.Name)); Session.io.OutFull (Session.GetPrompt(83)); - FDir.FileName := FileName; - FDir.DateTime := CurDateDos; - FDir.Uploader := Session.User.ThisUser.Handle; - FDir.Flags := 0; - FDir.DLs := 0; + FDir.FileName := FileName; + FDir.DateTime := CurDateDos; + FDir.Uploader := Session.User.ThisUser.Handle; + FDir.Flags := 0; + FDir.Downloads := 0; + FDir.Rating := 0; If Config.FDupeScan > 0 Then Begin Session.io.OutFull (Session.GetPrompt(377)); @@ -2592,9 +2593,9 @@ Begin End Else GetFileDescription(FileName); - FDir.Pointer := FileSize(DataFile); + FDir.DescPtr := FileSize(DataFile); - For A := 1 to FDir.Lines Do + For A := 1 to FDir.DescLines Do BlockWrite (DataFile, Session.Msgs.MsgText[A][0], Length(Session.Msgs.MsgText[A]) + 1); Assign (TempFile, FBase.Path + FileName); @@ -2705,7 +2706,7 @@ Begin Session.io.PromptInfo[2] := strComma(FDir.Size); Session.io.PromptInfo[3] := FDir.Uploader; Session.io.PromptInfo[4] := DateDos2Str(FDir.DateTime, Session.User.ThisUser.DateType); - Session.io.PromptInfo[5] := strI2S(FDir.DLs); + Session.io.PromptInfo[5] := strI2S(FDir.Downloads); GetTransferTime (FDir.Size, Min, Sec); @@ -2726,7 +2727,7 @@ Begin Inc (Session.User.ThisUser.DLsToday); Inc (Session.User.ThisUser.DLk, FDir.Size DIV 1024); Inc (Session.User.ThisUser.DLkToday, FDir.Size DIV 1024); - Inc (FDir.DLs); + Inc (FDir.Downloads); Inc (Session.HistoryDLs); Inc (Session.HistoryDLKB, FDir.Size DIV 1024); @@ -2827,7 +2828,7 @@ Begin Read (FDirFile, FDir); If (FDir.FileName = Batch[A].FileName) And (FDir.Flags And FDirDeleted = 0) Then Begin - Inc (FDir.DLs); + Inc (FDir.Downloads); Seek (FDirFile, FilePos(FDirFile) - 1); Write (FDirFile, FDir); Break; @@ -3011,7 +3012,7 @@ Procedure TFileBase.DirectoryEditor (Edit : Boolean; Mask: String); Function Get_Next_File (Back: Boolean): Boolean; Var - Old : FDirRec; + Old : RecFileList; Pos : LongInt; Begin Old := FDir; @@ -3091,7 +3092,7 @@ Begin '|033) Uploader : |11' + FDir.Uploader); Session.io.OutFullLn ('|034) File Date : |11' + strPadR(DateDos2Str(FDir.DateTime, Session.User.ThisUser.DateType), 19, ' ') + - '|035) Downloads : |11' + strI2S(FDir.DLs)); + '|035) Downloads : |11' + strI2S(FDir.Downloads)); Session.io.OutFull ('|036) Status : |11'); @@ -3110,11 +3111,11 @@ Begin Session.io.OutFullLn (Temp); Session.io.OutFullLn ('|08|$D79Ä'); - Seek (DataFile, FDir.Pointer); + Seek (DataFile, FDir.DescPtr); For A := 1 to 11 Do Begin Temp := ''; - If A <= FDir.Lines Then Begin + If A <= FDir.DescLines Then Begin BlockRead (DataFile, Temp[0], 1); BlockRead (DataFile, Temp[1], Ord(Temp[0])); End; @@ -3158,9 +3159,9 @@ Begin 'I' : Begin Session.io.OutFullLn ('|CR|14Importing file_id.diz...'); If ImportDIZ(FDir.FileName) Then Begin - FDir.Pointer := FileSize(DataFile); - Seek (DataFile, FDir.Pointer); - For A := 1 to FDir.Lines Do + FDir.DescPtr := FileSize(DataFile); + Seek (DataFile, FDir.DescPtr); + For A := 1 to FDir.DescLines Do BlockWrite (DataFile, Session.Msgs.MsgText[A][0], Length(Session.Msgs.MsgText[A]) + 1); End; End; @@ -3203,11 +3204,11 @@ Begin {$I-} Reset (DataFile2, 1); {$I+} If IoResult <> 0 Then ReWrite (DataFile2, 1); - Seek (DataFile, FDir.Pointer); - FDir.Pointer := FileSize(DataFile2); - Seek (DataFile2, FDir.Pointer); + Seek (DataFile, FDir.DescPtr); + FDir.DescPtr := FileSize(DataFile2); + Seek (DataFile2, FDir.DescPtr); - For B := 1 to FDir.Lines Do Begin + For B := 1 to FDir.DescLines Do Begin BlockRead (DataFile, Temp[0], 1); BlockRead (DataFile, Temp[1], Ord(Temp[0])); BlockWrite (DataFile2, Temp[0], Length(Temp) + 1); @@ -3245,9 +3246,9 @@ Begin Assign (TF, Session.TempPath + 'file_id.diz'); ReWrite (TF); - Seek (DataFile, FDir.Pointer); + Seek (DataFile, FDir.DescPtr); - For B := 1 to FDir.Lines Do Begin + For B := 1 to FDir.DescLines Do Begin BlockRead (DataFile, Temp[0], 1); BlockRead (DataFile, Temp[1], Ord(Temp[0])); WriteLn (TF, Temp); @@ -3273,22 +3274,24 @@ Begin Get_Next_File(False); End; '!' : Begin - Seek (DataFile, FDir.Pointer); - If FDir.Lines > Config.MaxFileDesc Then FDir.Lines := Config.MaxFileDesc; + Seek (DataFile, FDir.DescPtr); + If FDir.DescLines > Config.MaxFileDesc Then FDir.DescLines := Config.MaxFileDesc; - For A := 1 to FDir.Lines Do Begin + For A := 1 to FDir.DescLines Do Begin BlockRead (DataFile, Session.Msgs.MsgText[A][0], 1); BlockRead (DataFile, Session.Msgs.MsgText[A][1], Ord(Session.Msgs.MsgText[A][0])); End; Temp := 'Description Editor'; - B := FDir.Lines; + B := FDir.DescLines; If Editor(B, mysMaxFileDescLen, Config.MaxFileDesc, True, False, Temp) Then Begin - FDir.Lines := B; - FDir.Pointer := FileSize(DataFile); - Seek (DataFile, FDir.Pointer); - For A := 1 to FDir.Lines Do + FDir.DescLines := B; + FDir.DescPtr := FileSize(DataFile); + + Seek (DataFile, FDir.DescPtr); + + For A := 1 to FDir.DescLines Do BlockWrite (DataFile, Session.Msgs.MsgText[A][0], Length(Session.Msgs.MsgText[A]) + 1); End; End; @@ -3296,9 +3299,9 @@ Begin Session.io.OutFull ('Size: '); FDir.Size := strS2I(Session.io.GetInput(8, 8, 12, strI2S(FDir.Size))); End; - '4' : FDir.DateTime := DateStr2Dos(Session.io.InXY(16, 6, 8, 8, 15, DateDos2Str(FDir.DateTime, Session.User.ThisUser.DateType))); - '3' : FDir.Uploader := Session.io.InXY(50, 5, 30, 30, 18, FDir.Uploader); - '5' : FDir.DLs := strS2I(Session.io.InXY(50, 6, 4, 4, 12, strI2S(FDir.DLs))); + '4' : FDir.DateTime := DateStr2Dos(Session.io.InXY(16, 6, 8, 8, 15, DateDos2Str(FDir.DateTime, Session.User.ThisUser.DateType))); + '3' : FDir.Uploader := Session.io.InXY(50, 5, 30, 30, 18, FDir.Uploader); + '5' : FDir.Downloads := strS2I(Session.io.InXY(50, 6, 4, 4, 12, strI2S(FDir.Downloads))); '6' : Begin Session.io.OutFull('|CRFlags: F(a)iled, (F)ree, (O)ffline, (U)nvalidated, (Q)uit: '); Case Session.io.OneKey('AFOUQ', True) of @@ -3381,27 +3384,28 @@ Var End; If Not Skip Then Begin - FDir.FileName := DirInfo.Name; - FDir.Size := DirInfo.Size; - FDir.DateTime := CurDateDos; - FDir.Uploader := Session.User.ThisUser.Handle; - FDir.DLs := 0; - FDir.Flags := 0; - FDir.Lines := 0; + FDir.FileName := DirInfo.Name; + FDir.Size := DirInfo.Size; + FDir.DateTime := CurDateDos; + FDir.Uploader := Session.User.ThisUser.Handle; + FDir.Downloads := 0; + FDir.Flags := 0; + FDir.DescLines := 0; + FDir.Rating := 0; If Config.ImportDIZ Then If Not ImportDIZ(DirInfo.Name) Then If Not AutoArea Then GetFileDescription(DirInfo.Name); - If FDir.Lines = 0 Then Begin + If FDir.DescLines = 0 Then Begin Session.Msgs.MsgText[1] := Session.GetPrompt(208); - FDir.Lines := 1; + FDir.DescLines := 1; End; - FDir.Pointer := FileSize(DataFile); + FDir.DescPtr := FileSize(DataFile); - For A := 1 to FDir.Lines Do + For A := 1 to FDir.DescLines Do BlockWrite (DataFile, Session.Msgs.MsgText[A][0], Length(Session.Msgs.MsgText[A]) + 1); If Config.TestUploads and (Config.TestCmdLine <> '') Then Begin @@ -3468,4 +3472,4 @@ Begin FBase := Old; End; -End. +End. \ No newline at end of file diff --git a/mystic/mbbsutil.pas b/mystic/mbbsutil.pas index 8d6552a..c77e702 100644 --- a/mystic/mbbsutil.pas +++ b/mystic/mbbsutil.pas @@ -133,9 +133,9 @@ Var SortList : TQuickSort; FBaseFile : File of FBaseRec; FBase : FBaseRec; - FDirFile : File of FDirRec; - TFDirFile : File of FDirRec; - FDir : FDirRec; + FDirFile : File of RecFileList; + TFDirFile : File of RecFileList; + FDir : RecFileList; A : Word; Begin Write ('Sorting File Bases : '); @@ -194,9 +194,9 @@ Procedure Pack_File_Bases; Var A : Byte; Temp : String[50]; - FDirFile : File of FDirRec; - TFDirFile : File of FDirRec; - FDir : FDirRec; + FDirFile : File of RecFileList; + TFDirFile : File of RecFileList; + FDir : RecFileList; DataFile : File; TDataFile : File; FBaseFile : File of FBaseRec; @@ -232,11 +232,11 @@ Begin While Not Eof(FDirFile) Do Begin Read (FDirFile, FDir); If FDir.Flags AND FDirDeleted = 0 Then Begin - Seek (TDataFile, FDir.Pointer); + Seek (TDataFile, FDir.DescPtr); - FDir.Pointer := FilePos(DataFile); + FDir.DescPtr := FilePos(DataFile); - For A := 1 to FDir.Lines Do Begin + For A := 1 to FDir.DescLines Do Begin BlockRead (TDataFile, Temp[0], 1); BlockRead (TDataFile, Temp[1], Ord(Temp[0])); @@ -267,9 +267,9 @@ Procedure Check_File_Bases; Var FBaseFile : File of FBaseRec; FBase : FBaseRec; - FDirFile : File of FDirRec; - FDir : FDirRec; - TFDirFile : File of FDirRec; + FDirFile : File of RecFileList; + FDir : RecFileList; + TFDirFile : File of RecFileList; DF : File of Byte; Begin Write ('Checking File Bases : '); diff --git a/mystic/mis_client_ftp.pas b/mystic/mis_client_ftp.pas index 5e540bc..0376a85 100644 --- a/mystic/mis_client_ftp.pas +++ b/mystic/mis_client_ftp.pas @@ -46,8 +46,8 @@ Type Destructor Destroy; Override; Procedure ResetSession; - Procedure UpdateUserStats (TFBase: FBaseRec; FDir: FDirRec; DirPos: LongInt); - Function CheckFileLimits (TempFBase: FBaseRec; FDir: FDirRec) : Byte; + Procedure UpdateUserStats (TFBase: FBaseRec; FDir: RecFileList; DirPos: LongInt); + Function CheckFileLimits (TempFBase: FBaseRec; FDir: RecFileList) : Byte; Function OpenDataSession : Boolean; Procedure CloseDataSession; Function ValidDirectory (TempBase: FBaseRec) : Boolean; @@ -129,14 +129,14 @@ Begin InTransfer := False; End; -Procedure TFTPServer.UpdateUserStats (TFBase: FBaseRec; FDir: FDirRec; DirPos: LongInt); +Procedure TFTPServer.UpdateUserStats (TFBase: FBaseRec; FDir: RecFileList; DirPos: LongInt); Var HistFile: File of HistoryRec; History : HistoryRec; - FDirFile: File of FDirRec; + FDirFile: File of RecFileList; UserFile: File of RecUser; Begin - Inc (FDir.DLs); + Inc (FDir.Downloads); Assign (UserFile, bbsConfig.DataPath + 'users.dat'); ioReset (UserFile, SizeOf(RecUser), fmReadWrite + fmDenyWrite); @@ -162,7 +162,7 @@ Begin Close (UserFile); Assign (FDirFile, bbsConfig.DataPath + TFBase.FileName + '.dir'); - ioReset (FDirFile, SizeOf(FDirRec), fmReadWrite + fmDenyWrite); + ioReset (FDirFile, SizeOf(RecFileList), fmReadWrite + fmDenyWrite); ioSeek (FDirFile, DirPos - 1); ioWrite (FDirFile, FDir); Close (FDirFile); @@ -195,7 +195,7 @@ Begin Close (HistFile); End; -Function TFTPServer.CheckFileLimits (TempFBase: FBaseRec; FDir: FDirRec) : Byte; +Function TFTPServer.CheckFileLimits (TempFBase: FBaseRec; FDir: RecFileList) : Byte; { 0 = OK to download } { 1 = Offline or Invalid or Failed or NO ACCESS or no file (prompt 224)} { 2 = DL per day limit exceeded (prompt 58) } @@ -479,7 +479,7 @@ Var TempBase : FBaseRec; TempPos : LongInt; DirFile : TBufFile; - Dir : FDirRec; + Dir : RecFileList; Begin If LoggedIn Then Begin TempPos := FindDirectory(TempBase); @@ -495,7 +495,7 @@ Begin DirFile := TBufFile.Create(FileBufSize); - If DirFile.Open(bbsConfig.DataPath + TempBase.FileName + '.dir', fmOpenCreate, fmRWDN, SizeOf(FDirRec)) Then Begin + If DirFile.Open(bbsConfig.DataPath + TempBase.FileName + '.dir', fmOpenCreate, fmRWDN, SizeOf(RecFileList)) Then Begin While Not DirFile.EOF Do Begin DirFile.Read(Dir); @@ -532,7 +532,7 @@ Var TempPos : LongInt; FBaseFile : TBufFile; DirFile : TBufFile; - Dir : FDirRec; + Dir : RecFileList; Begin If LoggedIn Then Begin TempPos := FindDirectory(TempBase); @@ -562,7 +562,7 @@ Begin DirFile := TBufFile.Create(FileBufSize); - If DirFile.Open(bbsConfig.DataPath + TempBase.FileName + '.dir', fmOpenCreate, fmRWDN, SizeOf(FDirRec)) Then Begin + If DirFile.Open(bbsConfig.DataPath + TempBase.FileName + '.dir', fmOpenCreate, fmRWDN, SizeOf(RecFileList)) Then Begin While Not DirFile.EOF Do Begin DirFile.Read(Dir); @@ -587,7 +587,7 @@ Var TempPos : LongInt; TempBase : FBaseRec; DirFile : TBufFile; - Dir : FDirRec; + Dir : RecFileList; Found : LongInt; F : File; Buf : Array[1..4096] of Byte; @@ -605,7 +605,7 @@ Begin DirFile := TBufFile.Create(FileBufSize); Found := -1; - If DirFile.Open(bbsConfig.DataPath + TempBase.FileName + '.dir', fmOpenCreate, fmRWDN, SizeOf(FDirRec)) Then Begin + If DirFile.Open(bbsConfig.DataPath + TempBase.FileName + '.dir', fmOpenCreate, fmRWDN, SizeOf(RecFileList)) Then Begin While Not DirFile.EOF Do Begin DirFile.Read(Dir); diff --git a/mystic/records.pas b/mystic/records.pas index 32f09e6..dc77305 100644 --- a/mystic/records.pas +++ b/mystic/records.pas @@ -481,21 +481,23 @@ Const FDirFree = $10; Type - FDirRec = Record { *.DIR } - FileName : String[70]; { File name } - Size : LongInt; { File size (in bytes) } - DateTime : LongInt; { Date and time of upload } - Uploader : String[30]; { User name who uploaded the file } - Flags : Byte; { Set of FDIRFLAGS (see above) } - Pointer : LongInt; { Pointer to file description } - Lines : Byte; { Number of description lines } - DLs : Word; { # of times this file was downloaded} + RecFileList = Record + FileName : String[70]; + Size : LongInt; + DateTime : LongInt; + Uploader : String[30]; + Flags : Byte; + Downloads : LongInt; + Rating : Byte; + DescPtr : LongInt; + DescLines : Byte; End; - FDirCommentRec = Record { .FCI and .FCT in DATA directory } + RecFileComment = Record { .FCI and .FCT in DATA directory } UserName : String[30]; Rating : Byte; Date : LongInt; + Pointer : LongInt; Lines : Word; End; diff --git a/mystic/todo.pas b/mystic/todo.pas index 44e803a..77a324a 100644 --- a/mystic/todo.pas +++ b/mystic/todo.pas @@ -2,7 +2,8 @@ This file showcases the direction of where this software wants to go as it continues to expand. Some things that will probably be mentioned will be vague, and serve mostly to remind me of my own ideas. -The scope of this file is to document bugs and future enhancements/ideas. +The scope of this file is to document bugs, future enhancements/ideas and +design elements/issues. BUGS AND POSSIBLE ISSUES ======================== @@ -84,9 +85,107 @@ FUTURE / IDEAS / WORK IN PROGRESS / NOTES - MIDE version using the Lazaurs GUI editor [Spec]. Maybe he would be interested in working on that? - PCBoard-style "quickscan"? Yes? No? +- This line intentionally means nothing. - Filebase allow anonymous flag for FTP or just use FreeFiles - Build in "telnetd" STDIO redirection into MIS in Linux/OSX - Template system similar to Mystic 2 (ansiedit.ans ansiedit.ans.cfg) - Rename Template filenames to allow more than 8 characters (for clarity) - Does anyone use Version 7 compiled nodelists? Worth supporting? - Ignore user inactivity flag per user +- HOME and END keys added to lightbar file listings + +RANDOM DRUNKEN BRAINDUMP AKA DESIGN DETAILS +=========================================== + +------------------------------------------------------------------------- +Disconnect while posting design: + +1. Before msg post or msg reply Session.Msgs.Posting is set to that bases + Index. +2. All editors reset this value on any save/abort +3. Any disconnect checks that value. +4. If disconnect while value is set: + a. Save MSGTMP from node's TEMP dir into DATA as msg_.tmp + overwrite if exists + b. Save MsgText into DATA as msg_.txt with format: + Line 1: Base perm index + Line 2: Msg From + Line 3: Msg To + Line 4: Msg Subj + Line 5: Network address (or blank if none) + Line 6: MsgText + overwrite if exists +5. During LOGIN, check for msg_.txt +6. If exists, process and prompt user: + + You were recently disconnected while posting a message: + + Base: Clever Message Base Name + To: MOM JOKEZ R FUNNY LOLZ + Subj: I eat hot coal. + + (R)esume post, (D)elete, or (A)sk me later? + +7. Case result: + Resume: + Copy msg_UID.tmp if exists to MSGTMP in temp node directory + Populate MsgText and execute editor with the other values + Execute editor + If save... save... this will be the hard part. :( + If abort... delete msg_UID* since they aborted? + What happens if they disconnect while continuing? lol + make sure this is handled appropriately. + Delete: + Delete msg_UID* in data. + Ask later: + Do nothing. Keep files so Mystic asks on next login. + +PROBLEM: When we localize MsgText for the ANSI viewer integration... +how will this work? I am not sure it really can work without it being +global. We cannot save what we do not have access to from a class. + +SOLUTION: Actual MsgText should be separate from Attributes in the msg +base ANSI class. Memory requirements almost double though for MsgText +storage if it remains global = 1000 lines x 80. 80,000 bytes memory per +node. But attributes are only really required while READING. So maybe +somehow it can be separated so attributes are specific to reading and +the entire class is "unused" until then? + +----------------------------------------------------------------------- + +CHANGE to support 50 line mode + +1. terminal "screen length" is no longer an option of lines but a + selection: + + 80x25 + 80x50 + 132x50 + +2. all display files and templates will have this logic added: + + if 132 mode .132.ans is the extention + if 50 mode .50.ans is the extention + if 25 mode then .ans is the extention + +----------------------------------------------------------------------- + +NEW TEMPLATE system + +templates will be .cfg files with various things defined within them +based on the template. no more "injecting" screeninfo codes (|!X) into +files. Extentions for random ANSI templates: + +ansiflst.ans = ansiflist.ans.cfg +ansiflst.an1 = ansiflist.an1.cfg + +50 line mode template examples with random selected templates + +ansiflst.50.ans = ansiflist.50.ans.cfg +ansiflst.50.an1 = ansiflist.50.an1.cfg + +----------------------------------------------------------------------- + +FILE rating system + +-----------------------------------------------------------------------