diff --git a/mystic/mutil.cfg b/mystic/mutil.cfg index 85e5033..f71f088 100644 --- a/mystic/mutil.cfg +++ b/mystic/mutil.cfg @@ -12,21 +12,27 @@ ; tasks supported by MUTIL, or a single configuration can be maintained that ; does everything. ; +; Current abilities: +; +; - Import FIDONET.NA into Message bases +; ; ========================================================================== ; ========================================================================== [General] ; Uncomment this and set it to the full path and filename to - ; MYSTIC.DAT if you want to run mutil from a directory other than - ; the root Mystic directory. Otherwise, leave this commented and - ; MUTIL will look in the current directory. + ; MYSTIC.DAT if you want to run mutil from a directory other than + ; the root Mystic directory. Otherwise, leave this commented and + ; MUTIL will look in the current directory. - ; mystic_directory= + ; mystic_directory=c:\mystic\mystic.dat ; list of functions to perform on startup - Import_FIDONET.NA = true + Import_FIDONET.NA = true + Import_FILEBONE.NA = false + MassUpload = true ; ========================================================================== ; ========================================================================== @@ -36,10 +42,14 @@ ; filename to import - filename = test.na +filename = fidonet.na + + ; convert tags to lower case for message base filename + + lowercase_filename = 1 ; The following options define the "default" values used when creating any - ; new message bases. netaddress must be an exiting network address + ; new message bases. netaddress must match an exiting network address ; configured within Mystic BBS. default values are also taken from ; the system configuration for origin line, colors, etc. @@ -67,3 +77,21 @@ ; value is either 0 for JAM or 1 for Squish base_format = 0 + +; ========================================================================== +; ========================================================================== +; ========================================================================== + +[Import_FILEBONE.NA] + + filename = filebone.na + +; ========================================================================== +; ========================================================================== +; ========================================================================== + +[MassUpload] + + uploader_name = Mystic BBS + import_fileid = 1 + no_description = No Description diff --git a/mystic/mutil.pas b/mystic/mutil.pas index 8dc115b..a0c58f6 100644 --- a/mystic/mutil.pas +++ b/mystic/mutil.pas @@ -33,6 +33,10 @@ Program MUTIL; // tosser too. TOP 10 generators, etc. It's all planned for MUTIL. Uses + {$IFDEF DEBUG} + HeapTrc, + LineInfo, + {$ENDIF} INIFiles, m_Output, m_DateTime, @@ -40,7 +44,8 @@ Uses m_FileIO, mutil_Common, mutil_Status, - mutil_ImportNA; + mutil_ImportNA, + mutil_Upload; {$I MUTIL_ANSI.PAS} @@ -124,18 +129,30 @@ Begin Halt(1); End; + TempPath := bbsConfig.SystemPath + 'temp0' + PathChar; + + GetDIR (0, StartPath); + + {$I-} + MkDir (TempPath); + {$I+} + + DirClean (TempPath, ''); + BarOne := TStatusBar.Create(3); BarAll := TStatusBar.Create(6); End; Var - DoImportNA : Boolean; + DoImportNA : Boolean; + DoMassUpload : Boolean; Begin ApplicationStartup; // Build process list - DoImportNA := CheckProcess(Header_IMPORTNA); + DoImportNA := CheckProcess(Header_IMPORTNA); + DoMassUpload := CheckProcess(Header_UPLOAD); // Exit with an error if nothing is configured @@ -149,5 +166,6 @@ Begin // We're good lets execute this stuff! - If DoImportNA Then uImportNA; + If DoImportNA Then uImportNA; + If DoMassUpload Then uMassUpload; End. diff --git a/mystic/mutil_common.pas b/mystic/mutil_common.pas index a3e72ac..b76439e 100644 --- a/mystic/mutil_common.pas +++ b/mystic/mutil_common.pas @@ -19,20 +19,28 @@ Var ProcessTotal : Byte = 0; ProcessPos : Byte = 0; bbsConfig : RecConfig; + TempPath : String; + StartPath : String; Const Header_GENERAL = 'General'; Header_IMPORTNA = 'Import_FIDONET.NA'; + Header_UPLOAD = 'MassUpload'; Function strAddr2Str (Addr : RecEchoMailAddr) : String; Function GenerateMBaseIndex : LongInt; Function IsDupeMBase (FN: String) : Boolean; Procedure AddMessageBase (Var MBase: RecMessageBase); +Function ShellDOS (ExecPath: String; Command: String) : LongInt; +Procedure ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte); Implementation Uses - m_Strings; + DOS, + m_Types, + m_Strings, + m_FileIO; Function strAddr2Str (Addr : RecEchoMailAddr) : String; Var @@ -61,11 +69,7 @@ Begin While Not Eof(MBaseFile) Do Begin Read (MBaseFile, MBase); - {$IFDEF FS_SENSITIVE} - If MBase.FileName = FN Then Begin - {$ELSE} If strUpper(MBase.FileName) = strUpper(FN) Then Begin - {$ENDIF} Result := True; Break; End; @@ -107,4 +111,85 @@ Begin Close (MBaseFile); End; +Function ShellDOS (ExecPath: String; Command: String) : LongInt; +Var + Image : TConsoleImageRec; +Begin + Console.GetScreenImage(1, 1, 80, 25, Image); + + If ExecPath <> '' Then DirChange(ExecPath); + + {$IFDEF UNIX} + Result := Shell(Command); + {$ENDIF} + + {$IFDEF WINDOWS} + If Command <> '' Then Command := '/C' + Command; + + Exec (GetEnv('COMSPEC'), Command); + + Result := DosExitCode; + {$ENDIF} + + DirChange(StartPath); + + Console.PutScreenImage(Image); +End; + +Procedure ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte); +Var + ArcFile : File of RecArchive; + Arc : RecArchive; + Count : LongInt; + Str : String; +Begin + Temp := strUpper(JustFileExt(FName)); + + Assign (ArcFile, bbsConfig.DataPath + 'archive.dat'); + {$I-} Reset (ArcFile); {$I+} + + If IoResult <> 0 Then Exit; + + Repeat + If Eof(ArcFile) Then Begin + Close (ArcFile); + + Exit; + End; + + Read (ArcFile, Arc); + + If (Not Arc.Active) or (Arc.OSType <> OSType) Then Continue; + + If strUpper(Arc.Ext) = Temp Then Break; + Until False; + + Close (ArcFile); + + Case Mode of + 1 : Str := Arc.Pack; + 2 : Str := Arc.Unpack; + End; + + If Str = '' Then Exit; + + Temp := ''; + Count := 1; + + While Count <= Length(Str) Do Begin + If Str[Count] = '%' Then Begin + Inc (Count); + + If Str[Count] = '1' Then Temp := Temp + FName Else + If Str[Count] = '2' Then Temp := Temp + Mask Else + If Str[Count] = '3' Then Temp := Temp + TempPath; + End Else + Temp := Temp + Str[Count]; + + Inc (Count); + End; + + ShellDOS ('', Temp); +End; + End. diff --git a/mystic/mutil_importna.pas b/mystic/mutil_importna.pas index 9dd3116..3254418 100644 --- a/mystic/mutil_importna.pas +++ b/mystic/mutil_importna.pas @@ -21,7 +21,6 @@ Var Buffer : Array[1..2048] of Byte; TagName : String; BaseName : String; - MBaseFile : File of RecMessageBase; MBase : RecMessageBase; Count : Byte; Begin @@ -90,6 +89,9 @@ Begin Break; End; + If INI.ReadString(Header_IMPORTNA, 'lowercase_filename', '1') = '1' Then + MBase.FileName := strLower(MBase.FileName); + If INI.ReadString(Header_IMPORTNA, 'use_autosig', '1') = '1' Then MBase.Flags := MBase.Flags OR MBAutoSigs; @@ -110,9 +112,6 @@ Begin ProcessStatus ('Created |15' + strI2S(CreatedBases) + ' |07base(s)'); ProcessResult (rDONE, True); - - BarOne.Update (100, 100); - BarAll.Update (ProcessPos, ProcessTotal); End; End. diff --git a/mystic/mutil_status.pas b/mystic/mutil_status.pas index 4094e2a..3e37c24 100644 --- a/mystic/mutil_status.pas +++ b/mystic/mutil_status.pas @@ -32,7 +32,11 @@ Procedure ProcessName (Str: String; Start: Boolean); Begin Console.WriteXYPipe (5, Console.CursorY, 7, 26, Str); - If Start Then Inc (ProcessPos); + If Start Then Begin + Inc (ProcessPos); + + BarOne.Reset; + End; End; Procedure ProcessStatus (Str: String); @@ -49,7 +53,12 @@ Begin rFATAL : Console.WriteXYPipe(66, Console.CursorY, 12, 11, 'FATAL'); End; - If Done Then Console.WriteLine(''); + If Done Then Begin + Console.WriteLine(''); + + BarOne.Update (100, 100); + BarAll.Update (ProcessPos, ProcessTotal); + End; End; Procedure TStatusBar.Reset;