MassUpload and other stuffs

This commit is contained in:
mysticbbs 2012-03-01 18:21:16 -05:00
parent 5435a9319c
commit d4bb04adfc
5 changed files with 161 additions and 22 deletions

View File

@ -12,21 +12,27 @@
; tasks supported by MUTIL, or a single configuration can be maintained that ; tasks supported by MUTIL, or a single configuration can be maintained that
; does everything. ; does everything.
; ;
; Current abilities:
;
; - Import FIDONET.NA into Message bases
;
; ========================================================================== ; ==========================================================================
; ========================================================================== ; ==========================================================================
[General] [General]
; Uncomment this and set it to the full path and filename to ; 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 ; MYSTIC.DAT if you want to run mutil from a directory other than
; the root Mystic directory. Otherwise, leave this commented and ; the root Mystic directory. Otherwise, leave this commented and
; MUTIL will look in the current directory. ; MUTIL will look in the current directory.
; mystic_directory= ; mystic_directory=c:\mystic\mystic.dat
; list of functions to perform on startup ; 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 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 ; 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 ; configured within Mystic BBS. default values are also taken from
; the system configuration for origin line, colors, etc. ; the system configuration for origin line, colors, etc.
@ -67,3 +77,21 @@
; value is either 0 for JAM or 1 for Squish ; value is either 0 for JAM or 1 for Squish
base_format = 0 base_format = 0
; ==========================================================================
; ==========================================================================
; ==========================================================================
[Import_FILEBONE.NA]
filename = filebone.na
; ==========================================================================
; ==========================================================================
; ==========================================================================
[MassUpload]
uploader_name = Mystic BBS
import_fileid = 1
no_description = No Description

View File

@ -33,6 +33,10 @@ Program MUTIL;
// tosser too. TOP 10 generators, etc. It's all planned for MUTIL. // tosser too. TOP 10 generators, etc. It's all planned for MUTIL.
Uses Uses
{$IFDEF DEBUG}
HeapTrc,
LineInfo,
{$ENDIF}
INIFiles, INIFiles,
m_Output, m_Output,
m_DateTime, m_DateTime,
@ -40,7 +44,8 @@ Uses
m_FileIO, m_FileIO,
mutil_Common, mutil_Common,
mutil_Status, mutil_Status,
mutil_ImportNA; mutil_ImportNA,
mutil_Upload;
{$I MUTIL_ANSI.PAS} {$I MUTIL_ANSI.PAS}
@ -124,18 +129,30 @@ Begin
Halt(1); Halt(1);
End; End;
TempPath := bbsConfig.SystemPath + 'temp0' + PathChar;
GetDIR (0, StartPath);
{$I-}
MkDir (TempPath);
{$I+}
DirClean (TempPath, '');
BarOne := TStatusBar.Create(3); BarOne := TStatusBar.Create(3);
BarAll := TStatusBar.Create(6); BarAll := TStatusBar.Create(6);
End; End;
Var Var
DoImportNA : Boolean; DoImportNA : Boolean;
DoMassUpload : Boolean;
Begin Begin
ApplicationStartup; ApplicationStartup;
// Build process list // Build process list
DoImportNA := CheckProcess(Header_IMPORTNA); DoImportNA := CheckProcess(Header_IMPORTNA);
DoMassUpload := CheckProcess(Header_UPLOAD);
// Exit with an error if nothing is configured // Exit with an error if nothing is configured
@ -149,5 +166,6 @@ Begin
// We're good lets execute this stuff! // We're good lets execute this stuff!
If DoImportNA Then uImportNA; If DoImportNA Then uImportNA;
If DoMassUpload Then uMassUpload;
End. End.

View File

@ -19,20 +19,28 @@ Var
ProcessTotal : Byte = 0; ProcessTotal : Byte = 0;
ProcessPos : Byte = 0; ProcessPos : Byte = 0;
bbsConfig : RecConfig; bbsConfig : RecConfig;
TempPath : String;
StartPath : String;
Const Const
Header_GENERAL = 'General'; Header_GENERAL = 'General';
Header_IMPORTNA = 'Import_FIDONET.NA'; Header_IMPORTNA = 'Import_FIDONET.NA';
Header_UPLOAD = 'MassUpload';
Function strAddr2Str (Addr : RecEchoMailAddr) : String; Function strAddr2Str (Addr : RecEchoMailAddr) : String;
Function GenerateMBaseIndex : LongInt; Function GenerateMBaseIndex : LongInt;
Function IsDupeMBase (FN: String) : Boolean; Function IsDupeMBase (FN: String) : Boolean;
Procedure AddMessageBase (Var MBase: RecMessageBase); Procedure AddMessageBase (Var MBase: RecMessageBase);
Function ShellDOS (ExecPath: String; Command: String) : LongInt;
Procedure ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte);
Implementation Implementation
Uses Uses
m_Strings; DOS,
m_Types,
m_Strings,
m_FileIO;
Function strAddr2Str (Addr : RecEchoMailAddr) : String; Function strAddr2Str (Addr : RecEchoMailAddr) : String;
Var Var
@ -61,11 +69,7 @@ Begin
While Not Eof(MBaseFile) Do Begin While Not Eof(MBaseFile) Do Begin
Read (MBaseFile, MBase); Read (MBaseFile, MBase);
{$IFDEF FS_SENSITIVE}
If MBase.FileName = FN Then Begin
{$ELSE}
If strUpper(MBase.FileName) = strUpper(FN) Then Begin If strUpper(MBase.FileName) = strUpper(FN) Then Begin
{$ENDIF}
Result := True; Result := True;
Break; Break;
End; End;
@ -107,4 +111,85 @@ Begin
Close (MBaseFile); Close (MBaseFile);
End; 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. End.

View File

@ -21,7 +21,6 @@ Var
Buffer : Array[1..2048] of Byte; Buffer : Array[1..2048] of Byte;
TagName : String; TagName : String;
BaseName : String; BaseName : String;
MBaseFile : File of RecMessageBase;
MBase : RecMessageBase; MBase : RecMessageBase;
Count : Byte; Count : Byte;
Begin Begin
@ -90,6 +89,9 @@ Begin
Break; Break;
End; 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 If INI.ReadString(Header_IMPORTNA, 'use_autosig', '1') = '1' Then
MBase.Flags := MBase.Flags OR MBAutoSigs; MBase.Flags := MBase.Flags OR MBAutoSigs;
@ -110,9 +112,6 @@ Begin
ProcessStatus ('Created |15' + strI2S(CreatedBases) + ' |07base(s)'); ProcessStatus ('Created |15' + strI2S(CreatedBases) + ' |07base(s)');
ProcessResult (rDONE, True); ProcessResult (rDONE, True);
BarOne.Update (100, 100);
BarAll.Update (ProcessPos, ProcessTotal);
End; End;
End. End.

View File

@ -32,7 +32,11 @@ Procedure ProcessName (Str: String; Start: Boolean);
Begin Begin
Console.WriteXYPipe (5, Console.CursorY, 7, 26, Str); Console.WriteXYPipe (5, Console.CursorY, 7, 26, Str);
If Start Then Inc (ProcessPos); If Start Then Begin
Inc (ProcessPos);
BarOne.Reset;
End;
End; End;
Procedure ProcessStatus (Str: String); Procedure ProcessStatus (Str: String);
@ -49,7 +53,12 @@ Begin
rFATAL : Console.WriteXYPipe(66, Console.CursorY, 12, 11, 'FATAL'); rFATAL : Console.WriteXYPipe(66, Console.CursorY, 12, 11, 'FATAL');
End; End;
If Done Then Console.WriteLine(''); If Done Then Begin
Console.WriteLine('');
BarOne.Update (100, 100);
BarAll.Update (ProcessPos, ProcessTotal);
End;
End; End;
Procedure TStatusBar.Reset; Procedure TStatusBar.Reset;