mysticbbs/mystic/mutil_importna.pas

124 lines
4.1 KiB
ObjectPascal
Raw Normal View History

2012-02-29 17:45:16 -08:00
Unit MUTIL_ImportNA;
{$I M_OPS.PAS}
Interface
Procedure uImportNA;
Implementation
Uses
m_Strings,
2012-09-26 13:51:07 -07:00
mUtil_Common,
mUtil_Status,
BBS_Records,
BBS_DataBase;
2012-02-29 17:45:16 -08:00
Procedure uImportNA;
Var
CreatedBases : LongInt = 0;
InFile : Text;
Str : String;
Buffer : Array[1..2048] of Byte;
TagName : String;
BaseName : String;
2012-02-29 19:27:06 -08:00
MBase : RecMessageBase;
Count : Byte;
2012-02-29 17:45:16 -08:00
Begin
ProcessName ('Import FIDONET.NA', True);
ProcessResult (rWORKING, False);
Assign (InFile, INI.ReadString(Header_IMPORTNA, 'filename', 'fidonet.na'));
SetTextBuf (InFile, Buffer);
{$I-} Reset(InFile); {$I+}
If IoResult <> 0 Then Begin
2012-09-24 20:57:45 -07:00
ProcessStatus ('Cannot find NA file', True);
2012-02-29 17:45:16 -08:00
ProcessResult (rWARN, True);
Exit;
End;
While Not Eof(InFile) Do Begin
ReadLn(InFile, Str);
Str := strReplace(strStripB(Str, ' '), #9, ' ');
2012-02-29 17:45:16 -08:00
If (Str[1] = ';') or (Str = '') Then Continue;
TagName := strStripLow(strWordGet(1, Str, ' '));
BaseName := strStripLow(strStripB(Copy(Str, Pos(' ', Str), 255), ' '));
2012-02-29 17:45:16 -08:00
2012-09-24 20:57:45 -07:00
ProcessStatus (BaseName, False);
2012-02-29 19:27:06 -08:00
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, ' ', '.');
2013-03-24 02:47:36 -07:00
MBase.EchoTag := TagName;
2012-02-29 19:27:06 -08:00
MBase.FileName := TagName;
MBase.Path := bbsCfg.MsgsPath;
2012-02-29 19:27:06 -08:00
MBase.NetType := 1;
MBase.ColQuote := bbsCfg.ColorQuote;
MBase.ColText := bbsCfg.ColorText;
MBase.ColTear := bbsCfg.ColorTear;
MBase.ColOrigin := bbsCfg.ColorOrigin;
MBase.ColKludge := bbsCfg.ColorKludge;
MBase.Origin := bbsCfg.Origin;
2012-02-29 19:27:06 -08:00
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;
2013-09-21 22:32:42 -07:00
MBase.FileName := strReplace(MBase.FileName, '/', '_');
MBase.FileName := strReplace(MBase.FileName, '\', '_');
2012-02-29 19:27:06 -08:00
For Count := 1 to 30 Do
2013-09-29 17:25:56 -07:00
If Addr2Str(bbsCfg.NetAddress[Count]) = INI.ReadString(Header_IMPORTNA, 'netaddress', '') Then Begin
2012-02-29 19:27:06 -08:00
MBase.NetAddr := Count;
Break;
End;
2012-03-01 15:21:16 -08:00
If INI.ReadString(Header_IMPORTNA, 'lowercase_filename', '1') = '1' Then
MBase.FileName := strLower(MBase.FileName);
2012-02-29 19:27:06 -08:00
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;
2012-02-29 17:45:16 -08:00
End;
Close (InFile);
2012-09-24 20:57:45 -07:00
ProcessStatus ('Created |15' + strI2S(CreatedBases) + ' |07base(s)', True);
2012-02-29 17:45:16 -08:00
ProcessResult (rDONE, True);
End;
End.