Echomail patches and updates in main project. Keeping current with their changes.

This commit is contained in:
Azazel 2013-10-10 22:41:54 -07:00
parent 13c6aa345b
commit 6176f77107
8 changed files with 314 additions and 111 deletions

View File

@ -15,7 +15,8 @@ Function strComma (Num: LongInt) : String;
Function strI2S (Num: LongInt) : String;
Function strH2I (Str: String) : LongInt;
Function strI2H (Num: LongInt; Idx: Byte) : String;
Function strS2I (Str: String) : LongInt;
//Function strI2Base (Base: Byte; Num: Int64; Pad: Integer) : String;
Function strS2I (Str: String) : Int64;
Function strI2O (Num: LongInt) : String;
Function strR2S (Num: Real; Deci: Byte) : String;
Function strWordGet (Num: Byte; Str: String; Ch: Char) : String;
@ -170,6 +171,23 @@ Begin
End;
End;
(*
Function strI2Base (Base: Byte; Num: Int64; Pad: Integer) : String;
Const
B36Codes = '0123456789abcdefghijklmnopqrstuvwxyz';
Begin
Result := '';
Repeat
Result := B36Codes[Num MOD Base + 1] + Result;
Num := Num DIV Base;
Until Num = 0;
If Pad > 0 Then
Result := strPadL(Result, Pad, '0');
End;
*)
Function strI2H (Num: LongInt; Idx: Byte) : String;
Var
Ch : Char;
@ -218,12 +236,13 @@ Begin
Str (Num:0:Deci, Result);
End;
Function strS2I (Str: String) : LongInt;
Function strS2I (Str: String) : Int64;
Var
Res : LongInt;
Temp : LongInt;
Res : LongInt;
Temp : Int64;
Begin
Val (strStripB(Str, ' '), Temp, Res);
If Res = 0 Then
Result := Temp
Else

View File

@ -999,6 +999,7 @@ Begin
If Graphics = 0 Then Exit;
CurBG := (Console.TextAttr SHR 4) AND 7;
CurFG := Console.TextAttr AND $F;
Prefix := '';

View File

@ -35,12 +35,11 @@ Type
Destructor Destroy; Override;
Function IsQuotedText (Str: String) : Boolean;
// Function OpenCreateBase (Var Msg: PMsgBaseABS; Var Area: RecMessageBase) : Boolean;
Procedure ExportQuoteData (Var Msg: PMsgBaseABS);
Procedure AppendMessageText (Var Msg: PMsgBaseABS; Lines: Integer; ReplyID: String);
Procedure AssignMessageData (Var Msg: PMsgBaseABS; Var TempBase: RecMessageBase);
Function GetBaseByNum (Num: LongInt; Var TempBase: RecMessageBase) : Boolean;
Function GetBaseCompressed (Num: LongInt; Var TempBase: RecMessageBase) : Boolean;
// Function GetBaseByIndex (Num: LongInt; Var TempBase: RecMessageBase) : Boolean;
Function GetMessageStats (List, ShowPrompt, ShowYou: Boolean; Var ListPtr: LongInt; Var TempBase: RecMessageBase; NoFrom, NoRead: Boolean; Var Total, New, Yours: LongInt) : Boolean;
Procedure GetMailStats (Var Total, UnRead: LongInt);
Function GetMatchedAddress (Orig, Dest: RecEchoMailAddr) : RecEchoMailAddr;
@ -80,8 +79,6 @@ Implementation
Uses
m_Strings,
// BBS_Records,
// BBS_Common,
BBS_DataBase,
BBS_Core,
BBS_User,
@ -133,6 +130,66 @@ Begin
Inherited Destroy;
End;
Procedure TMsgBase.ExportQuoteData (Var Msg: PMsgBaseABS);
Var
QuoteFile : Text;
Initials : String[4];
TempStr : String;
WrapData : String;
DoWrap : Boolean = True;
Begin
Assign (QuoteFile, Session.TempPath + 'msgtmp');
{$I-} ReWrite (QuoteFile); {$I+}
If IoResult = 0 Then Begin
Initials := strInitials(MsgBase^.GetFrom) + '> ';
TempStr := Session.GetPrompt(464);
TempStr := strReplace(TempStr, '|&1', MsgBase^.GetDate);
TempStr := strReplace(TempStr, '|&2', MsgBase^.GetFrom);
TempStr := strReplace(TempStr, '|&3', Initials);
WriteLn (QuoteFile, TempStr);
WriteLn (QuoteFile, ' ');
MsgBase^.MsgTxtStartUp;
WrapData := '';
While Not MsgBase^.EOM Do Begin
TempStr := MsgBase^.GetString(79);
If TempStr[1] = #1 Then Continue;
DoWrap := Not IsQuotedText(TempStr);
If DoWrap Then Begin
If WrapData <> '' Then Begin
If TempStr = '' Then Begin
WriteLn (QuoteFile, ' ' + Initials + strStripB(WrapData, ' '));
WriteLn (QuoteFile, ' ' + Initials);
WrapData := '';
Continue;
End;
TempStr := strStripB(WrapData, ' ') + ' ' + strStripL(TempStr, ' ');
End;
strWrap (TempStr, WrapData, 74);
WriteLn (QuoteFile, ' ' + Initials + Copy(TempStr, 1, 75));
End Else
WriteLn (QuoteFile, ' ' + Initials + Copy(TempStr, 1, 75));
End;
Close (QuoteFile);
End;
End;
Function TMsgBase.GetMatchedAddress (Orig, Dest: RecEchoMailAddr) : RecEchoMailAddr;
Var
Count : Byte;
@ -1248,10 +1305,6 @@ Var
Addr : RecEchomailAddr;
MsgNew : PMsgBaseABS;
TempStr : String;
Initials : String[4];
WrapData : String;
DoWrap : Boolean = True;
QuoteFile : Text;
Lines : SmallInt;
Total : LongInt;
ReplyBase : RecMessageBase;
@ -1372,54 +1425,7 @@ Begin
If Subj = '' Then Exit;
Assign (QuoteFile, Session.TempPath + 'msgtmp');
{$I-} ReWrite (QuoteFile); {$I+}
If IoResult = 0 Then Begin
Initials := strInitials(MsgBase^.GetFrom) + '> ';
TempStr := Session.GetPrompt(464);
TempStr := strReplace(TempStr, '|&1', MsgBase^.GetDate);
TempStr := strReplace(TempStr, '|&2', MsgBase^.GetFrom);
TempStr := strReplace(TempStr, '|&3', Initials);
WriteLn (QuoteFile, TempStr);
WriteLn (QuoteFile, ' ');
MsgBase^.MsgTxtStartUp;
WrapData := '';
While Not MsgBase^.EOM Do Begin
TempStr := MsgBase^.GetString(79);
If TempStr[1] = #1 Then Continue;
DoWrap := Not IsQuotedText(TempStr);
If DoWrap Then Begin
If WrapData <> '' Then Begin
If TempStr = '' Then Begin
WriteLn (QuoteFile, ' ' + Initials + strStripB(WrapData, ' '));
WriteLn (QuoteFile, ' ' + Initials);
WrapData := '';
Continue;
End;
TempStr := strStripB(WrapData, ' ') + ' ' + strStripL(TempStr, ' ');
End;
strWrap (TempStr, WrapData, 74);
WriteLn (QuoteFile, ' ' + Initials + Copy(TempStr, 1, 75));
End Else
WriteLn (QuoteFile, ' ' + Initials + Copy(TempStr, 1, 75));
End;
Close (QuoteFile);
End;
ExportQuoteData(MsgBase);
Lines := 0;
@ -1484,10 +1490,7 @@ End;
Procedure TMsgBase.EditMessage;
Var
A : Integer;
Lines : Integer;
Temp1 : String;
DestAddr : RecEchoMailAddr;
Lines : Integer;
Procedure ReadText;
Begin
@ -1508,7 +1511,26 @@ Var
End;
End;
Var
Count : LongInt;
TempStr : String;
DestAddr : RecEchoMailAddr;
Begin
If MsgBase^.GetRefer > 0 Then Begin
Count := MsgBase^.GetMsgNum;
MsgBase^.SeekFirst(MsgBase^.GetRefer);
If MsgBase^.SeekFound Then Begin
MsgBase^.MsgStartUp;
ExportQuoteData(MsgBase);
End;
MsgBase^.SeekFirst(Count);
MsgBase^.MsgStartUp;
End;
ReadText;
Repeat
@ -1529,20 +1551,20 @@ Begin
Session.io.OutFull (Session.GetPrompt(297));
If MBase.NetType = 3 Then Begin
Temp1 := Session.io.GetInput(30, 30, 11, MsgBase^.GetTo);
TempStr := Session.io.GetInput(30, 30, 11, MsgBase^.GetTo);
Session.io.OutFull (Session.GetPrompt(298));
If Str2Addr(Session.io.GetInput(20, 20, 12, Addr2Str(DestAddr)), DestAddr) Then Begin
MsgBase^.SetTo(Temp1);
MsgBase^.SetTo(TempStr);
MsgBase^.SetDest(DestAddr)
End;
End Else
If MBase.Flags And MBPrivate <> 0 Then Begin
Temp1 := Session.io.GetInput (30, 30, 11, MsgBase^.GetTo);
TempStr := Session.io.GetInput (30, 30, 11, MsgBase^.GetTo);
If Session.User.SearchUser(Temp1, MBase.Flags and MBRealNames <> 0) Then
MsgBase^.SetTo(Temp1);
If Session.User.SearchUser(TempStr, MBase.Flags and MBRealNames <> 0) Then
MsgBase^.SetTo(TempStr);
End Else
MsgBase^.SetTo(Session.io.GetInput(30, 30, 11, MsgBase^.GetTo));
End;
@ -1553,10 +1575,10 @@ Begin
End;
'C' : MsgBase^.SetSent(NOT MsgBase^.IsSent);
'!' : Begin
Temp1 := MsgBase^.GetSubj;
TempStr := MsgBase^.GetSubj;
If Editor(Lines, ColumnValue[Session.Theme.ColumnSize] - 2, mysMaxMsgLines, False, fn_tplMsgEdit, Temp1) Then
MsgBase^.SetSubj(Temp1)
If Editor(Lines, ColumnValue[Session.Theme.ColumnSize] - 2, mysMaxMsgLines, False, fn_tplMsgEdit, TempStr) Then
MsgBase^.SetSubj(TempStr)
Else
ReadText;
End;
@ -1564,8 +1586,8 @@ Begin
If Session.io.GetYN(Session.GetPrompt(300), True) Then Begin
MsgBase^.EditMsgInit;
For A := 1 to Lines Do
MsgBase^.DoStringLn(MsgText[A]);
For Count := 1 to Lines Do
MsgBase^.DoStringLn(MsgText[Count]);
MsgBase^.EditMsgSave;
End;
@ -1574,6 +1596,8 @@ Begin
End;
Until False;
DirClean (Session.TempPath, '');
End;
(*

View File

@ -74,10 +74,10 @@ Var
Begin
Result := False;
writeln ('debug checking exists ', str, ' files:', ftp.responsedata.count);
// writeln ('debug checking exists ', str, ' files:', ftp.responsedata.count);
For Count := 1 to FTP.ResponseData.Count Do Begin
writeln('debug remote: ', FTP.ResponseData.Strings[Count - 1]);
// writeln('debug remote: ', FTP.ResponseData.Strings[Count - 1]);
If strUpper(JustFile(Str)) = strUpper(FTP.ResponseData.Strings[Count - 1]) Then Begin
Result := True;

View File

@ -969,6 +969,7 @@ Begin
BinkP := TBinkP.Create (Server, Client, Queue, False, bbsCfg.inetBINKPTimeOut);
BinkP.StatusUpdate := @Status;
BinkP.ForceMD5 := bbsCfg.inetBINKPCram5;
If BinkP.DoAuthentication Then Begin
@ -983,8 +984,8 @@ Begin
Server.Status (ProcessID, 'Queued ' + strI2S(Queue.QSize - Before) + ' files for ' + Addr2Str(BinkP.EchoNode.Address));
BinkP.SetBlockSize := BinkP.EchoNode.binkBlock;
BinkP.UseMD5 := BinkP.EchoNode.binkMD5 > 0;
BinkP.ForceMD5 := BinkP.EchoNode.binkMD5 = 2;
// BinkP.UseMD5 := BinkP.EchoNode.binkMD5 > 0;
// BinkP.ForceMD5 := BinkP.EchoNode.binkMD5 = 2;
End;
End;

View File

@ -68,7 +68,7 @@ Type
Cost : System.Word;
DateTime : String[19];
End;
(*
RecPKTHeader = Record
OrigNode : System.Word;
DestNode : System.Word;
@ -88,6 +88,36 @@ Type
DestZone : System.Word;
Filler : Array[1..20] of Char;
End;
*)
RecPKTHeader = Record
OrigNode : System.Word;
DestNode : System.Word;
Year : System.Word;
Month : System.Word;
Day : System.Word;
Hour : System.Word;
Minute : System.Word;
Second : System.Word;
Baud : System.Word;
PKTType : System.Word;
OrigNet : System.Word;
DestNet : System.Word;
ProdCode : Byte;
ProdRev : Byte;
Password : Array[1..8] of Char;
OrigZone : System.Word;
DestZone : System.Word;
Filler : Array[1..4] of Char;
ProdCode2 : Byte;
ProdRev2 : Byte;
Compat : System.Word;
OrigZone2 : System.Word;
DestZone2 : System.Word;
OrigPoint : System.Word;
DestPoint : System.Word;
ProdData : LongInt;
End;
RecMsgLine = String[79];
@ -121,8 +151,29 @@ Type
Function GetMessage : Boolean;
End;
TPKTWriter = Class
MsgFile : TFileBuffer;
Constructor Create;
Destructor Destroy; Override;
End;
Implementation
Constructor TPKTWriter.Create;
Begin
Inherited Create;
MsgFile := TFileBuffer.Create(8 * 1024);
End;
Destructor TPKTWriter.Destroy;
Begin
MsgFile.Free;
Inherited Destroy;
End;
Constructor TPKTDupe.Create (Max: Cardinal);
Var
F : File;
@ -240,14 +291,16 @@ Begin
Opened := False;
End Else Begin
PKTOrig.Zone := PKTHeader.OrigZone;
PKTOrig.Net := PKTHeader.OrigNet;
PKTOrig.Node := PKTHeader.OrigNode;
PKTDest.Zone := PKTHeader.DestZone;
PKTDest.Net := PKTHeader.DestNet;
PKTDest.Node := PKTHeader.DestNode;
Result := True;
Opened := True;
PKTOrig.Zone := PKTHeader.OrigZone;
PKTOrig.Net := PKTHeader.OrigNet;
PKTOrig.Node := PKTHeader.OrigNode;
PKTOrig.Point := PKTHeader.OrigPoint; //V2+
PKTDest.Zone := PKTHeader.DestZone;
PKTDest.Net := PKTHeader.DestNet;
PKTDest.Node := PKTHeader.DestNode;
PKTDest.Point := PKTHeader.DestPoint; //V2+
Result := True;
Opened := True;
End;
End;
@ -302,7 +355,6 @@ Begin
DisposeText;
First := True;
// IsNetmail := False;
MsgSize := 0;
Result := True;
MsgLines := 1;

View File

@ -52,6 +52,7 @@ Begin
Close (T);
End;
(*
Procedure BundleMessages;
Var
F : File;
@ -130,6 +131,90 @@ Begin
FindClose (DirInfo);
End;
*)
Procedure BundleMessages;
Var
F : File;
PH : RecPKTHeader;
DirInfo : SearchRec;
NodeIndex : LongInt;
EchoNode : RecEchoMailNode;
PKTName : String;
BundleName : String;
BundlePath : String;
BundleSize : Cardinal;
Temp : String;
FLOName : String;
OrigAddr : RecEchoMailAddr;
CheckInc : Boolean;
Begin
FindFirst (TempPath + '*', AnyFile, DirInfo);
While DosError = 0 Do Begin
If DirInfo.Attr AND Directory = 0 Then Begin
NodeIndex := strS2I(JustFileExt(DirInfo.Name));
PKTName := JustFileName(DirInfo.Name) + '.pkt';
GetNodeByIndex (NodeIndex, EchoNode);
FileReName (TempPath + DirInfo.Name, TempPath + PKTName);
Assign (F, TempPath + PKTName);
Reset (F, 1);
BlockRead (F, PH, SizeOf(PH));
Close (F);
OrigAddr.Zone := PH.OrigZone;
OrigAddr.Net := PH.OrigNet;
OrigAddr.Node := PH.OrigNode;
BundlePath := GetFTNOutPath(EchoNode);
FLOName := BundlePath + GetFTNFlowName(EchoNode.Address);
CheckInc := False;
DirCreate (BundlePath);
Case EchoNode.MailType of
0 : FLOName := FLOName + '.flo';
1 : FLOName := FLOName + '.clo';
2 : FLOName := FLOName + '.dlo';
3 : FLOName := FLOName + '.hlo';
End;
If EchoNode.ArcType = '' Then Begin
FileReName (TempPath + PKTName, BundlePath + PKTName);
AddToFLOQueue (FLOName, BundlePath + PKTName);
End Else Begin
If Not (EchoNode.LPKTPtr in [48..57, 97..122]) Then
EchoNode.LPKTPtr := 48;
If EchoNode.LPKTDay <> DayOfWeek(CurDateDos) Then Begin
EchoNode.LPKTDay := DayOfWeek(CurDateDos);
EchoNode.LPKTPtr := 48;
End Else
CheckInc := True;
BundleName := BundlePath + GetFTNArchiveName(OrigAddr, EchoNode.Address) + '.' + Copy(strLower(DayString[DayOfWeek(CurDateDos)]), 1, 2) + Char(EchoNode.LPKTPtr);
If CheckInc And Not FileExist(BundleName) Then Begin
BundleName := GetFTNBundleExt(True, BundleName);
EchoNode.LPKTPtr := Byte(BundleName[Length(BundleName)]);
End;
SaveEchoMailNode(EchoNode);
ExecuteArchive (TempPath, BundleName, EchoNode.ArcType, TempPath + PKTName, 1);
FileErase (TempPath + PKTName);
AddToFLOQueue (FLOName, BundleName);
End;
End;
FindNext (DirInfo);
End;
FindClose (DirInfo);
End;
Procedure uEchoExport;
Var
@ -231,22 +316,29 @@ Var
FillChar (PH, SizeOf(PH), 0);
PH.OrigZone := MsgBase^.GetOrigAddr.Zone;
PH.OrigNet := MsgBase^.GetOrigAddr.Net;
PH.OrigNode := MsgBase^.GetOrigAddr.Node;
PH.DestZone := EchoNode.Address.Zone;
PH.DestNet := EchoNode.Address.Net;
PH.DestNode := EchoNode.Address.Node;
// ^^ does this need to change for netmail too?
PH.Year := DT.Year;
PH.Month := DT.Month;
PH.Day := DT.Day;
PH.Hour := DT.Hour;
PH.Minute := DT.Min;
PH.Second := DT.Sec;
PH.PKTType := 2;
PH.ProdCode := 254; // RESEARCH THIS
//Password : Array[1..8] of Char; // RESEARCH THIS
PH.OrigZone := MsgBase^.GetOrigAddr.Zone;
PH.OrigNet := MsgBase^.GetOrigAddr.Net;
PH.OrigNode := MsgBase^.GetOrigAddr.Node;
PH.OrigPoint := MsgBase^.GetOrigAddr.Point;
PH.DestZone := EchoNode.Address.Zone;
PH.DestNet := EchoNode.Address.Net;
PH.DestNode := EchoNode.Address.Node;
PH.DestPoint := EchoNode.Address.Point;
PH.Year := DT.Year;
PH.Month := DT.Month;
PH.Day := DT.Day;
PH.Hour := DT.Hour;
PH.Minute := DT.Min;
PH.Second := DT.Sec;
PH.PKTType := 2;
PH.ProdCode := 254;
// Map current V2 values to V2+ values
PH.ProdCode2 := PH.ProdCode;
PH.OrigZone2 := PH.OrigZone;
PH.DestZone2 := PH.DestZone;
PH.Compat := $0000000000000001;
BlockWrite (F, PH, SizeOf(PH));
End;

View File

@ -79,6 +79,8 @@ Var
Status : LongInt;
ForwardList : Array[1..50] of String[35];
ForwardSize : Byte = 0;
//TwitList : Array[1..50] of String[35];
//TwitSize : Byte = 0;
Procedure ImportPacketFile (PktFN: String);
Var
@ -285,16 +287,13 @@ Var
Procedure ImportPacketBundle (PktBundle: String);
Var
PKTMatched : Boolean;
DirInfo : SearchRec;
NodeFile : File of RecEchoMailNode;
EchoNode : RecEchoMailNode;
ArcType : String[4];
ArcType : String[4] = '';
Count : LongInt;
BundleList : TStringList;
Begin
PKTMatched := False;
Assign (NodeFile, bbsCfg.DataPath + 'echonode.dat');
If ioReset(NodeFile, Sizeof(RecEchoMailNode), fmRWDN) Then Begin
@ -303,8 +302,7 @@ Var
For Count := 1 to 30 Do Begin
If strUpper(JustFileName(PktBundle)) = strUpper(GetFTNArchiveName(EchoNode.Address, bbsCfg.NetAddress[Count])) Then Begin
PKTMatched := True;
ArcType := EchoNode.ArcType;
ArcType := EchoNode.ArcType;
Break;
End;
@ -314,7 +312,7 @@ Var
Close (NodeFile);
End;
If Not PKTMatched Then Begin
If ArcType = '' Then Begin
Case GetArchiveType(bbsCfg.InboundPath + PktBundle) of
'A' : ArcType := 'ARJ';
'R' : ArcType := 'RAR';
@ -405,6 +403,22 @@ Begin
ForwardList[ForwardSize] := strStripB(FileExt, ' ');
Until ForwardSize = 50;
(* global blacklist.txt and/or revamp of -mtrash and trashcan.txt
FillChar (TwitList, SizeOf(TwitList), #0);
Ini.SetSequential(True);
Repeat
FileExt := INI.ReadString(Header_ECHOIMPORT, 'twit', '');
If FileExt = '' Then Break;
Inc (TwitSize);
TwitList[TwitSize] := strStripB(FileExt, ' ');
Until TwitSize = 50;
*)
INI.SetSequential(False);
Dupes := TPKTDupe.Create(Count);