From e0ef7071f45a3fae2f7cb4a8ecde5e6ccac4274a Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Tue, 17 Sep 2013 22:28:47 -0400 Subject: [PATCH] More A38 stuff see WHATSNEW --- mystic/bbs_cfg_msgbase.pas | 35 +++++++++++++--- mystic/bbs_io.pas | 8 ++-- mystic/bbs_msgbase_jam.pas | 8 ++-- mystic/bbs_user.pas | 7 ++-- mystic/mis_client_binkp.pas | 2 + mystic/mis_client_nntp.pas | 1 - mystic/mkcrap.pas | 41 +++++++++++------- mystic/mpl_compile.pas | 2 + mystic/mpl_execute.pas | 2 +- mystic/mutil_echoimport.pas | 84 ++++++++++++++++++++++--------------- mystic/mystic.pas | 1 + mystic/qwkpoll.pas | 11 +++-- mystic/todo.pas | 1 + mystic/whatsnew.txt | 20 +++++++++ 14 files changed, 151 insertions(+), 72 deletions(-) diff --git a/mystic/bbs_cfg_msgbase.pas b/mystic/bbs_cfg_msgbase.pas index c9660e7..bf9b42e 100644 --- a/mystic/bbs_cfg_msgbase.pas +++ b/mystic/bbs_cfg_msgbase.pas @@ -158,7 +158,7 @@ Begin Form.AddBits ('9', ' Pvt Reply' , 55, 21, 68, 21, 11, MBPrivReply, @MBase.Flags, Topic + 'Allow private posts in public?'); Repeat - WriteXY (19, 15, 113, strPadR(Addr2Str(bbsCfg.NetAddress[MBase.NetAddr]), 19, ' ')); + WriteXY (19, 15, 113, strPadR(Addr2Str(bbsCfg.NetAddress[MBase.NetAddr]) + ' (' + bbsCfg.NetDesc[MBase.NetAddr] + ')', 33, ' ')); Links := FileByteSize(MBase.Path + MBase.FileName + '.lnk'); @@ -478,7 +478,7 @@ Var Write (MBaseFile, MBase); End; - Procedure EraseData; + Procedure EraseData (DoScn: Boolean); Begin FileErase (MBase.Path + MBase.FileName + '.jhr'); FileErase (MBase.Path + MBase.FileName + '.jlr'); @@ -487,7 +487,9 @@ Var FileErase (MBase.Path + MBase.FileName + '.sqd'); FileErase (MBase.Path + MBase.FileName + '.sqi'); FileErase (MBase.Path + MBase.FileName + '.sql'); - FileErase (MBase.Path + MBase.FileName + '.scn'); + + If DoScn Then + FileErase (MBase.Path + MBase.FileName + '.scn'); End; Var @@ -526,7 +528,7 @@ Begin Case List.ExitCode of '/' : If Edit Then - Case GetCommandOption(8, 'I-Insert|D-Delete|C-Copy|M-Move|P-Paste|G-Global|S-Sort|') of + Case GetCommandOption(8, 'I-Insert|D-Delete|C-Copy|M-Move|P-Paste|G-Global|S-Sort|R-Reset|') of 'I' : If List.Picked > 1 Then Begin AssignRecord(False); MakeList; @@ -543,7 +545,7 @@ Begin KillRecord (MBaseFile, Count, SizeOf(MBase)); FileErase (MBase.Path + MBase.FileName + '.lnk'); - If KillData Then EraseData; + If KillData Then EraseData(True); End; MakeList; @@ -558,7 +560,7 @@ Begin FileErase (MBase.Path + MBase.FileName + '.lnk'); If ShowMsgBox(1, 'Delete data: ' + strStripPipe(MBase.Name)) Then - EraseData; + EraseData(True); MakeList; End; @@ -605,6 +607,27 @@ Begin GlobalEdit (MBase); End; 'S' : SortMessageBases (List, MBaseFile); + 'R' : If List.Marked > 0 Then Begin + If ShowMsgBox(1, 'Reset msgs in ' + strI2S(List.Marked) + ' bases?') Then Begin + For Count := List.ListMax DownTo 1 Do + If List.List[Count].Tagged = 1 Then Begin + Seek (MBaseFile, Count - 1); + Read (MBaseFile, MBase); + + EraseData(False); + End; + + If ShowMsgBox (1, 'Reset echomail duplicate tracking?') Then + FileErase (bbsCfg.DataPath + 'echodupes.dat'); + End; + End Else + If (List.Picked > 1) and (List.Picked < List.ListMax) Then + If ShowMsgBox(1, 'Reset msgs in this base?') Then Begin + Seek (MBaseFile, List.Picked - 1); + Read (MBaseFile, MBase); + + EraseData(False); + End; End; #13 : If List.Picked < List.ListMax Then Begin Seek (MBaseFile, List.Picked - 1); diff --git a/mystic/bbs_io.pas b/mystic/bbs_io.pas index e30bfc8..39177ac 100644 --- a/mystic/bbs_io.pas +++ b/mystic/bbs_io.pas @@ -1414,12 +1414,12 @@ Begin Result := #255; IsArrow := False; - If Input.KeyWait(Wait) Then Begin - Result := Input.ReadKey; + If Keyboard.KeyWait(Wait) Then Begin + Result := Keyboard.ReadKey; LocalInput := True; If Result = #0 Then Begin - Result := Input.ReadKey; + Result := Keyboard.ReadKey; If (AllowArrow) and (Result in [#71..#73, #75, #77, #79..#83]) Then Begin IsArrow := True; @@ -2294,7 +2294,7 @@ End; Procedure TBBSIO.PurgeInputBuffer; Begin {$IFDEF UNIX} - While Input.KeyPressed Do Input.ReadKey; + While Keyboard.KeyPressed Do Keyboard.ReadKey; {$ENDIF} {$IFDEF WINDOWS} If Not TBBSCore(Core).LocalMode Then TBBSCore(Core).Client.PurgeInputData(100); diff --git a/mystic/bbs_msgbase_jam.pas b/mystic/bbs_msgbase_jam.pas index 5e2e16d..3c1e4a6 100644 --- a/mystic/bbs_msgbase_jam.pas +++ b/mystic/bbs_msgbase_jam.pas @@ -758,7 +758,7 @@ Begin End; MsgHdr^.JamHdr.Rev := 1; - MsgHdr^.JamHdr.DateArrived := ToUnixDate(CurDateDos); {Get date processed} + MsgHdr^.JamHdr.DateArrived := DateDos2Unix(CurDateDos); {Get date processed} DT.Year := strS2I(Copy(JM^.MsgDate, 7, 2)); {Convert date written} DT.Month := strS2I(Copy(JM^.MsgDate, 1, 2)); @@ -773,7 +773,7 @@ Begin DT.Hour := strS2I(Copy(JM^.MsgTime, 1, 2)); DT.Min := strS2I(Copy(JM^.MsgTime, 4, 2)); - MsgHdr^.JamHdr.DateWritten := DTToUnixDate(DT); + MsgHdr^.JamHdr.DateWritten := DateDT2Unix(DT); End; If WriteError = 0 Then Begin {Lock message base for update} @@ -941,7 +941,7 @@ Procedure TMsgBaseJAM.MsgStartUp; Error := IoResult; End; If Error = 0 Then Begin - UnixToDt(MsgHdr^.JamHdr.DateWritten, DT); + DT := DateUnix2DT(MsgHdr^.JamHdr.DateWritten); JM^.MsgDate := strZero(DT.Month) + '-' + strZero(DT.Day) + '-' + Copy(strI2S(DT.Year), 3, 2); JM^.MsgTime := strZero(DT.Hour) + ':' + strZero(DT.Min); @@ -1542,7 +1542,7 @@ Begin TmpHdr^.Signature[2] := 'A'; TmpHdr^.Signature[3] := 'M'; TmpHdr^.BaseMsgNum := 1; - TmpHdr^.Created := ToUnixDate(CurDateDos); + TmpHdr^.Created := DateDos2Unix(CurDateDos); TmpHdr^.PwdCrc := -1; CreateError := SaveFilePos(JM^.MsgPath + '.jhr', TmpHdr^, SizeOf(TmpHdr^), 0); diff --git a/mystic/bbs_user.pas b/mystic/bbs_user.pas index f659ced..0922bba 100644 --- a/mystic/bbs_user.pas +++ b/mystic/bbs_user.pas @@ -427,8 +427,8 @@ Begin Console.BufFlush; For Loop := 1 to 24 Do Begin - While Input.KeyPressed Do - If Input.ReadKey in [#27, '[', '0'..'9', ';', 'R'] Then Begin + While Keyboard.KeyPressed Do + If Keyboard.ReadKey in [#27, '[', '0'..'9', ';', 'R'] Then Begin Session.io.Graphics := 1; Break; End; @@ -438,7 +438,8 @@ Begin WaitMS(250); End; - While Input.KeyPressed Do Loop := Byte(Input.ReadKey); + While Keyboard.KeyPressed Do + Loop := Byte(Keyboard.ReadKey); Session.io.OutFullLn (Session.GetPrompt(259)); Session.io.BufFlush; diff --git a/mystic/mis_client_binkp.pas b/mystic/mis_client_binkp.pas index 483a10a..03e7f13 100644 --- a/mystic/mis_client_binkp.pas +++ b/mystic/mis_client_binkp.pas @@ -6,6 +6,7 @@ Interface Uses DOS, + MKCRAP, m_io_Sockets, m_DateTime, m_FileIO, @@ -670,6 +671,7 @@ Begin // set file time based on intime value // does this not work in linux? + SetFTime (InFile, DateUnix2Dos(InTime)); Close (InFile); SendFrame (M_GOT, EscapeFileName(InFN) + ' ' + strI2S(InSize) + ' ' + strI2S(InTime)); diff --git a/mystic/mis_client_nntp.pas b/mystic/mis_client_nntp.pas index f4a10a9..bd5f7c8 100644 --- a/mystic/mis_client_nntp.pas +++ b/mystic/mis_client_nntp.pas @@ -473,7 +473,6 @@ Var Count : LongInt; GotStart : Boolean; Found : Boolean; - SemFile : File; Begin If Not LoggedIn Then Begin ClientWriteLine(re_AuthReq); diff --git a/mystic/mkcrap.pas b/mystic/mkcrap.pas index 7f9a154..f245543 100644 --- a/mystic/mkcrap.pas +++ b/mystic/mkcrap.pas @@ -13,9 +13,10 @@ Interface Uses DOS; -Function ToUnixDate (DosDate: LongInt): LongInt; -Function DTToUnixDate (DT: DateTime): LongInt; -Procedure UnixToDT (SecsPast: LongInt; Var Dt: DateTime); +Function DateDos2Unix (DosDate: LongInt): LongInt; +Function DateDT2Unix (DT: DateTime): LongInt; +Function DateUnix2DT (SecsPast: LongInt) : DateTime; +Function DateUnix2Dos (D: LongInt) : LongInt; Procedure Str2Az (Str: String; MaxLen: Byte; Var AZStr); {Convert string to asciiz} Function LoadFilePos (FN: String; Var Rec; FS: Word; FPos: LongInt): Word; Function ExtendFile (FN: String; ToSize: LongInt): Word; @@ -34,7 +35,15 @@ Const // DATED1 = 146097; // DATED2 = 1721119; -Function DTToUnixDate (DT: DateTime): LongInt; +Function DateUnix2Dos (D: LongInt) : LongInt; +Var + DT : DateTime; +Begin + DT := DateUnix2DT(D); + PackTime (DT, Result); +End; + +Function DateDT2Unix (DT: DateTime): LongInt; Var SecsPast, DaysPast: LongInt; Begin @@ -44,33 +53,33 @@ Begin SecsPast := DaysPast * 86400; SecsPast := SecsPast + (LongInt(DT.Hour) * 3600) + (DT.Min * 60) + (DT.Sec); - DTToUnixDate := SecsPast; + Result := SecsPast; End; -Function ToUnixDate (DosDate: LongInt): LongInt; +Function DateDos2Unix (DosDate: LongInt): LongInt; Var DT: DateTime; Begin UnpackTime(DosDate, DT); - ToUnixDate := DTToUnixDate(DT); + Result := DateDT2Unix(DT); End; -Procedure UnixToDT (SecsPast: LongInt; Var DT: DateTime); +Function DateUnix2DT (SecsPast: LongInt) : DateTime; Var DateNum : LongInt; //might be able to remove this Begin - Datenum := (SecsPast Div 86400) + DATEc1970; + DateNum := (SecsPast Div 86400) + DATEc1970; - FillChar(DT, SizeOf(DT), 0); + FillChar(Result, SizeOf(Result), 0); - DateJ2G(DateNum, SmallInt(DT.Year), SmallInt(DT.Month), SmallInt(DT.Day)); + DateJ2G(DateNum, SmallInt(Result.Year), SmallInt(Result.Month), SmallInt(Result.Day)); - SecsPast := SecsPast Mod 86400; - DT.Hour := SecsPast Div 3600; - SecsPast := SecsPast Mod 3600; - DT.Min := SecsPast Div 60; - DT.Sec := SecsPast Mod 60; + SecsPast := SecsPast Mod 86400; + Result.Hour := SecsPast Div 3600; + SecsPast := SecsPast Mod 3600; + Result.Min := SecsPast Div 60; + Result.Sec := SecsPast Mod 60; End; Function SaveFilePos (FN: String; Var Rec; FS: Word; FPos: LongInt): Word; diff --git a/mystic/mpl_compile.pas b/mystic/mpl_compile.pas index 868014d..27c83eb 100644 --- a/mystic/mpl_compile.pas +++ b/mystic/mpl_compile.pas @@ -1737,6 +1737,8 @@ Function TParserEngine.ParseVariableInfo (Param: Boolean; IsRec: Boolean; Var In End; Begin + Result := 0; + FillChar (Info, SizeOf(Info), 0); Case tkwType of diff --git a/mystic/mpl_execute.pas b/mystic/mpl_execute.pas index 85ba181..6e51057 100644 --- a/mystic/mpl_execute.pas +++ b/mystic/mpl_execute.pas @@ -1610,7 +1610,7 @@ Begin End; 18 : Begin {$IFDEF UNIX} - TempBool := Input.KeyPressed; + TempBool := Keyboard.KeyPressed; {$ELSE} TempBool := Keyboard.KeyPressed OR Session.Client.DataWaiting; {$ENDIF} diff --git a/mystic/mutil_echoimport.pas b/mystic/mutil_echoimport.pas index f4e9174..1f0b725 100644 --- a/mystic/mutil_echoimport.pas +++ b/mystic/mutil_echoimport.pas @@ -10,8 +10,10 @@ Implementation Uses DOS, + Classes, m_FileIO, m_Strings, + m_DateTime, AView, BBS_Records, BBS_DataBase, @@ -242,7 +244,7 @@ Var Inc (TotalEcho); - Log (2, '+', ' Added Msg #' + strI2S(MsgBase^.GetHighMsgNum) + ' to ' + strStripPipe(MBase.Name)); + Log (2, '+', ' Added Msg #' + strI2S(MsgBase^.GetHighMsgNum) + ' (' + MsgBase^.GetDate + ') to ' + strStripPipe(MBase.Name)); End; End; End; @@ -264,13 +266,13 @@ Var Procedure ImportPacketBundle (PktBundle: String); Var - PKTFound : Boolean; PKTMatched : Boolean; DirInfo : SearchRec; NodeFile : File of RecEchoMailNode; EchoNode : RecEchoMailNode; ArcType : String[4]; - Count : Byte; + Count : LongInt; + BundleList : TStringList; Begin PKTMatched := False; @@ -306,21 +308,18 @@ Var End; End; - PKTFound := False; - ProcessStatus ('Extracting ' + PktBundle, False); ExecuteArchive (TempPath, bbsCfg.InboundPath + PktBundle, ArcType, '*', 2); + BundleList := TStringList.Create; + FindFirst (TempPath + '*', AnyFile, DirInfo); While DosError = 0 Do Begin If DirInfo.Attr And Directory = 0 Then Begin - If strUpper(JustFileExt(DirInfo.Name)) = 'PKT' Then Begin - PKTFound := True; - - ImportPacketFile (TempPath + DirInfo.Name); - End; + If strUpper(JustFileExt(DirInfo.Name)) = 'PKT' Then + BundleList.Add(FormatDate(DateDos2DT(DirInfo.Time), 'YYYYMMDDHHIISS') + ' ' + DirInfo.Name); End; FindNext (DirInfo); @@ -328,16 +327,26 @@ Var FindClose (DirInfo); - If Not PKTFound Then + BundleList.Sort; + + If BundleList.Count = 0 Then Log (2, '!', ' Unable to extract bundle; skipping') - Else + Else Begin + For Count := 1 to BundleList.Count Do + ImportPacketFile (TempPath + strWordGet(2, BundleList.Strings[Count - 1], ' ')); + FileErase (bbsCfg.InboundPath + PktBundle); + End; + + BundleList.Free; End; Var - DirInfo : SearchRec; - Count : LongInt; - FileExt : String; + DirInfo : SearchRec; + Count : LongInt; + FileExt : String; + PktList : TStringList; + FileName : String; Begin TotalEcho := 0; TotalNet := 0; @@ -386,39 +395,48 @@ Begin If Not GetMBaseByIndex (DupeIndex, DupeMBase) Then DupeIndex := -1; + PktList := TStringList.Create; + FindFirst (bbsCfg.InboundPath + '*', AnyFile, DirInfo); While DosError = 0 Do Begin - If DirInfo.Attr And Directory = 0 Then Begin - FileExt := Copy(strUpper(JustFileExt(DirInfo.Name)), 1, 2); - - If FileExt = 'PK' Then - ImportPacketFile(bbsCfg.InboundPath + DirInfo.Name) - Else - If (FileExt = 'SU') or - (FileExt = 'MO') or - (FileExt = 'TU') or - (FileExt = 'WE') or - (FileExt = 'TH') or - (FileExt = 'FR') or - (FileExt = 'SA') Then - ImportPacketBundle(DirInfo.Name) - Else - Log (2, '!', ' Unknown inbound file ' + DirInfo.Name); - End; + If DirInfo.Attr And Directory = 0 Then + PktList.Add(FormatDate(DateDos2DT(DirInfo.Time), 'YYYYMMDDHHIISS') + ' ' + DirInfo.Name); FindNext (DirInfo); End; FindClose (DirInfo); + PktList.Sort; + + For Count := 1 to PktList.Count Do Begin + FileName := strWordGet(2, PktList.Strings[Count - 1], ' '); + FileExt := Copy(strUpper(JustFileExt(FileName)), 1, 2); + + If FileExt = 'PK' Then + ImportPacketFile(bbsCfg.InboundPath + FileName) + Else + If (FileExt = 'SU') or + (FileExt = 'MO') or + (FileExt = 'TU') or + (FileExt = 'WE') or + (FileExt = 'TH') or + (FileExt = 'FR') or + (FileExt = 'SA') Then + ImportPacketBundle(FileName) + Else + Log (2, '!', ' Unknown inbound file ' + FileName); + End; + PKT.Free; Dupes.Free; + PktList.Free; ProcessStatus ('Total |15' + strI2S(TotalEcho) + ' |07echo |15' + strI2S(TotalNet) + ' |07net |15' + strI2S(TotalDupes) + ' |07dupe', True); ProcessResult (rDONE, True); FileErase (bbsCfg.SemaPath + fn_SemFileEchoIn); - End; +End; End. diff --git a/mystic/mystic.pas b/mystic/mystic.pas index 27735dd..72728a1 100644 --- a/mystic/mystic.pas +++ b/mystic/mystic.pas @@ -369,6 +369,7 @@ End; Var Count : Byte; + Saved : LongInt; Temp : String[120]; Script : String[120]; Begin diff --git a/mystic/qwkpoll.pas b/mystic/qwkpoll.pas index 084ea90..15fed7b 100644 --- a/mystic/qwkpoll.pas +++ b/mystic/qwkpoll.pas @@ -63,17 +63,19 @@ Begin Case FTP.SendFile(QwkNet.UsePassive, TempPath + QwkNet.PacketID + '.rep') of ftpResOK : SentFile := True; - ftpResFailed : WriteLn (' - Failed'); ftpResBadData : WriteLn (' - Unable to open data connection'); + Else + WriteLn (' - Failed'); End; End; WriteLn (' - Downloading QWK packet'); - Case FTP.GetFile (QwkNet.UsePassive, TempPath + QwkNet.PacketID + '.qwk') of + Case FTP.GetFile(QwkNet.UsePassive, TempPath + QwkNet.PacketID + '.qwk') of ftpResOK : WriteLn (' - OK: ' + QwkNet.PacketID + '.qwk', ' (' + strComma(FileByteSize(TempPath + QwkNet.PacketID + '.qwk')) + ' bytes)'); ftpResFailed : WriteLn (' - Failed'); ftpResBadData : WriteLn (' - Unable to open data connection'); + ftpResNoFile : WriteLn (' - Packet does not exist on remote'); End; End; End; @@ -93,12 +95,13 @@ Begin WriteLn (' - Importing QWK packet'); + filecopy(temppath + qwknet.packetid + '.qwk', 'd:\s7\vert.qwk'); + If QWK.ImportPacket(True) Then WriteLn (' - Imported ', QWK.RepOK, ' messages (', QWK.RepFailed, ' failed)') Else WriteLn (' - Unable to find QWK packet'); - End Else - Writeln (' - No QWK file received'); + End; QWK.Free; diff --git a/mystic/todo.pas b/mystic/todo.pas index 087c644..fdbf1f8 100644 --- a/mystic/todo.pas +++ b/mystic/todo.pas @@ -44,6 +44,7 @@ BUGS AND POSSIBLE ISSUES FUTURE / IDEAS / WORK IN PROGRESS / NOTES ========================================= - auto create qwk network message bases? +- make -CFG mode NOT use inactivity timeout - ability when editing a posted message to be able to toggle the Private flag if the base is Pub/Priv - when editing an already posted message with reference linkage, export the diff --git a/mystic/whatsnew.txt b/mystic/whatsnew.txt index dfab69e..9101cde 100644 --- a/mystic/whatsnew.txt +++ b/mystic/whatsnew.txt @@ -3763,4 +3763,24 @@ ! Fixed: Posts to networked bases via NNTP were not adding origin lines. + ! BINKP server should now properly escape filenames with spaces in them. + + + When tossing ECHOMAIL PKT files and bundles, Mystic will now sort the + entire incoming directory by filename and then filename as a secondary and + process each PKT or bundle in order. + + + When tossing an ECHOMAIL bundle, Mystic will now extract the bundle and + then sort the contents of the bundle by filedate and secondly by filename + and process each PKT in the sorted order. + + + The message base editor now has a new function /R (Reset messages). This + will take a single base or a selection of tagged bases and remove ALL + messages in them without effecting your user's new scan/qwk scan settings + OR the echomail linkage. IF bases are tagged before /R Mystic will also + offer to reset the echomail duplicate tracking pointers as well. + + + QWKPOLL should now provide more detail during the polling process, + including possible data port issues and when the HUB does not have a QWK + packet with new messages for you. +