diff --git a/mystic/mutil.cfg b/mystic/mutil.cfg index 344ac82..85e5033 100644 --- a/mystic/mutil.cfg +++ b/mystic/mutil.cfg @@ -43,7 +43,7 @@ ; configured within Mystic BBS. default values are also taken from ; the system configuration for origin line, colors, etc. - netaddress = 1:1/124 + netaddress = 1:1/1 acs_list = acs_read = acs_post = diff --git a/mystic/mutil_common.pas b/mystic/mutil_common.pas index aecba93..a3e72ac 100644 --- a/mystic/mutil_common.pas +++ b/mystic/mutil_common.pas @@ -24,9 +24,87 @@ Const Header_GENERAL = 'General'; Header_IMPORTNA = 'Import_FIDONET.NA'; +Function strAddr2Str (Addr : RecEchoMailAddr) : String; +Function GenerateMBaseIndex : LongInt; +Function IsDupeMBase (FN: String) : Boolean; +Procedure AddMessageBase (Var MBase: RecMessageBase); + Implementation Uses m_Strings; +Function strAddr2Str (Addr : RecEchoMailAddr) : String; +Var + Temp : String[20]; +Begin + Temp := strI2S(Addr.Zone) + ':' + strI2S(Addr.Net) + '/' + + strI2S(Addr.Node); + + If Addr.Point <> 0 Then Temp := Temp + '.' + strI2S(Addr.Point); + + Result := Temp; +End; + +Function IsDupeMBase (FN: String) : Boolean; +Var + MBaseFile : File of RecMessageBase; + MBase : RecMessageBase; +Begin + Result := False; + + Assign (MBaseFile, bbsConfig.DataPath + 'mbases.dat'); + {$I-} Reset (MBaseFile); {$I+} + + If IoResult <> 0 Then Exit; + + 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; + End; + + Close (MBaseFile); +End; + +Function GenerateMBaseIndex : LongInt; +Var + MBaseFile : File of RecMessageBase; + MBase : RecMessageBase; +Begin + Assign (MBaseFile, bbsConfig.DataPath + 'mbases.dat'); + Reset (MBaseFile); + + Result := FileSize(MBaseFile); + + While Not Eof(MBaseFile) Do Begin + Read (MBaseFile, MBase); + + If MBase.Index = Result Then Begin + Inc (Result); + Reset (MBaseFile); + End; + End; + + Close (MBaseFile); +End; + +Procedure AddMessageBase (Var MBase: RecMessageBase); +Var + MBaseFile : File of RecMessageBase; +Begin + Assign (MBaseFile, bbsConfig.DataPath + 'mbases.dat'); + Reset (MBaseFile); + Seek (MBaseFile, FileSize(MBaseFile)); + Write (MBaseFile, MBase); + Close (MBaseFile); +End; + End. diff --git a/mystic/mutil_importna.pas b/mystic/mutil_importna.pas index a59cfe1..9dd3116 100644 --- a/mystic/mutil_importna.pas +++ b/mystic/mutil_importna.pas @@ -21,6 +21,9 @@ Var Buffer : Array[1..2048] of Byte; TagName : String; BaseName : String; + MBaseFile : File of RecMessageBase; + MBase : RecMessageBase; + Count : Byte; Begin ProcessName ('Import FIDONET.NA', True); ProcessResult (rWORKING, False); @@ -45,9 +48,62 @@ Begin If (Str[1] = ';') or (Str = '') Then Continue; TagName := strWordGet(1, Str, ' '); - BaseName := strStripB(strWordGet(2, Str, ' '), ' '); + BaseName := strStripB(Copy(Str, Pos(' ', Str), 255), ' '); ProcessStatus (BaseName); + + If Not IsDupeMBase(TagName) Then Begin + FillChar (MBase, SizeOf(MBase), #0); + Inc (CreatedBases); + + MBase.Index := GenerateMBaseIndex; + MBase.Name := BaseName; + MBase.QWKName := TagName; + MBase.NewsName := strReplace(BaseName, ' ', '.'); + MBase.FileName := TagName; + MBase.Path := bbsConfig.MsgsPath; + MBase.NetType := 1; + MBase.ColQuote := bbsConfig.ColorQuote; + MBase.ColText := bbsConfig.ColorText; + MBase.ColTear := bbsConfig.ColorTear; + MBase.ColOrigin := bbsConfig.ColorOrigin; + MBase.ColKludge := bbsConfig.ColorKludge; + MBase.Origin := bbsConfig.Origin; + MBase.BaseType := strS2I(INI.ReadString(Header_IMPORTNA, 'base_format', '0')); + MBase.ListACS := INI.ReadString(Header_IMPORTNA, 'acs_list', ''); + MBase.ReadACS := INI.ReadString(Header_IMPORTNA, 'acs_read', ''); + MBase.PostACS := INI.ReadString(Header_IMPORTNA, 'acs_post', ''); + MBase.NewsACS := INI.ReadString(Header_IMPORTNA, 'acs_news', ''); + MBase.SysopACS := INI.ReadString(Header_IMPORTNA, 'acs_sysop', 's255'); + MBase.Header := INI.ReadString(Header_IMPORTNA, 'header', 'msghead'); + MBase.RTemplate := INI.ReadString(Header_IMPORTNA, 'read_template', 'ansimrd'); + MBase.ITemplate := INI.ReadString(Header_IMPORTNA, 'index_template', 'ansimlst'); + MBase.MaxMsgs := strS2I(INI.ReadString(Header_IMPORTNA, 'max_msgs', '500')); + MBase.MaxAge := strS2I(INI.ReadString(Header_IMPORTNA, 'max_msgs_age', '365')); + MBase.DefNScan := strS2I(INI.ReadString(Header_IMPORTNA, 'new_scan', '1')); + MBase.DefQScan := strS2I(INI.ReadString(Header_IMPORTNA, 'qwk_scan', '1')); + MBase.NetAddr := 1; + + For Count := 1 to 30 Do + If strAddr2Str(bbsConfig.NetAddress[Count]) = INI.ReadString(Header_IMPORTNA, 'netaddress', '') Then Begin + MBase.NetAddr := Count; + Break; + End; + + If INI.ReadString(Header_IMPORTNA, 'use_autosig', '1') = '1' Then + MBase.Flags := MBase.Flags OR MBAutoSigs; + + If INI.ReadString(Header_IMPORTNA, 'use_realname', '0') = '1' Then + MBase.Flags := MBase.Flags OR MBRealNames; + + If INI.ReadString(Header_IMPORTNA, 'kill_kludge', '1') = '1' Then + MBase.Flags := MBase.Flags OR MBKillKludge; + + If INI.ReadString(Header_IMPORTNA, 'private_base', '0') = '1' Then + MBase.Flags := MBase.Flags OR MBPrivate; + + AddMessageBase(MBase); + End; End; Close (InFile); @@ -55,8 +111,8 @@ Begin ProcessStatus ('Created |15' + strI2S(CreatedBases) + ' |07base(s)'); ProcessResult (rDONE, True); - BarOne.Update(100, 100); - BarAll.Update(ProcessPos, ProcessTotal); + BarOne.Update (100, 100); + BarAll.Update (ProcessPos, ProcessTotal); End; End.