More QWK net updates

This commit is contained in:
mysticbbs 2013-09-07 23:02:25 -04:00
parent 228e261c93
commit bb924941ec
3 changed files with 118 additions and 27 deletions

View File

@ -634,7 +634,7 @@ Var
S : String;
A : SmallInt;
Begin
If (MBase.NetType > 0) and (MBase.NetType <> 3) Then Begin
If (MBase.NetType > 0) and (MBase.NetType <> 3) and (MBase.QwkNetID = 0) Then Begin
Msg^.DoStringLn (#1 + 'MSGID: ' + strAddr2Str(bbsCfg.NetAddress[MBase.NetAddr]) + ' ' + strI2H(CurDateDos, 8));
If ReplyID <> '' Then
@ -663,7 +663,13 @@ Begin
If MBase.NetType > 0 Then Begin
Msg^.DoStringLn (#13 + '--- ' + mysSoftwareID + ' v' + mysVersion + ' (' + OSID + ')');
Msg^.DoStringLn (' * Origin: ' + ResolveOrigin(MBase) + ' (' + strAddr2Str(Msg^.GetOrigAddr) + ')');
S := ' * Origin: ' + ResolveOrigin(MBase);
If MBase.QwkNetID = 0 Then
S := S + ' (' + strAddr2Str(Msg^.GetOrigAddr) + ')';
Msg^.DoStringLn (S);
End;
End;

View File

@ -471,7 +471,7 @@ Begin
Else
Temp := 'messages.dat';
DataFile := TFileBuffer.Create(4 * 1024);
DataFile := TFileBuffer.Create(16 * 1024);
DataFile.OpenStream (WorkPath + Temp, 1, fmCreate, fmRWDN);
@ -565,7 +565,7 @@ Begin
Else
Line := PacketID + '.msg';
DataFile := TFileBuffer.Create(4 * 1024);
DataFile := TFileBuffer.Create(16 * 1024);
If Not DataFile.OpenStream (FileFind(WorkPath + Line), 1, fmOpen, fmRWDN) Then Begin
DataFile.Free;
@ -588,6 +588,8 @@ Begin
Exit;
End;
MsgBase := NIL;
While Not DataFile.EOF Do Begin
DataFile.ReadBlock(QwkHeader, SizeOf(QwkHeader));
@ -596,14 +598,36 @@ Begin
Chunks := strS2I(QwkBlock) - 1;
If IsNetworked Then
BaseFound := GetMBaseByQwkID (UserRecord.QwkNetwork, QwkHeader.ConfNum, MBase)
// when polling userrecord.qwknetwork needs to be set to qwknetwork ID
Else
BaseFound := GetMBaseByIndex (QwkHeader.ConfNum, MBase);
If IsNetworked Then Begin
If (MBase.QwkNetID = UserRecord.QwkNetwork) And (MBase.QwkConfID = QwkHeader.ConfNum) Then
BaseFound := True
Else Begin
BaseFound := GetMBaseByQwkID (UserRecord.QwkNetwork, QwkHeader.ConfNum, MBase);
If BaseFound and (MsgBase <> NIL) Then Begin
MsgBase^.CloseMsgBase;
Dispose (MsgBase, Done);
MsgBase := NIL;
End;
End;
End Else Begin
If MBase.Index = QwkHeader.ConfNum Then
BaseFound := True
Else Begin
BaseFound := GetMBaseByIndex (QwkHeader.ConfNum, MBase);
If BaseFound and (MsgBase <> NIL) Then Begin
MsgBase^.CloseMsgBase;
Dispose (MsgBase, Done);
MsgBase := NIL;
End;
End;
End;
If MsgBase = NIL Then
BaseFound := MBaseOpenCreate(MsgBase, MBase, WorkPath);
If BaseFound Then Begin
If MBaseOpenCreate(MsgBase, MBase, WorkPath) Then Begin
MBaseAssignData(UserRecord, MsgBase, MBase);
@ -624,10 +648,10 @@ Begin
Move (QwkHeader.Subject, QwkBlock[1], 25);
MsgBase^.SetSubj(strStripR(QwkBlock, ' '));
Move (QwkHeader.ReferNum, QwkBlock[1], 6);
QwkBlock[0] := #6;
// Move (QwkHeader.ReferNum, QwkBlock[1], 6);
// QwkBlock[0] := #6;
MsgBase^.SetRefer(strS2I(strStripR(QwkBlock, ' ')));
// MsgBase^.SetRefer(strS2I(strStripR(QwkBlock, ' ')));
Line := '';
LineCount := 0;
@ -686,17 +710,19 @@ Begin
If Not IsNetworked Then
If MBase.NetType > 0 Then Begin
MsgBase^.DoStringLn (#13 + '--- ' + mysSoftwareID + '/QWK v' + mysVersion + ' (' + OSID + ')');
MsgBase^.DoStringLn (' * Origin: ' + GetOriginLine(MBase) + ' (' + Addr2Str(MsgBase^.GetOrigAddr) + ')');
MsgBase^.DoStringLn (' * Origin: ' + GetOriginLine(MBase) + ' (' + Addr2Str(MsgBase^.GetOrigAddr) + ')');
End;
If Not IsControl Then Begin
// ISQWK = a node importing from HUB
If ((IsQwk) or (HasAccess(Self, MBase.PostACS))) and
((IsNetworked And (UserRecord.QwkNetwork = MBase.QwkNetID)) or (Not IsNetworked)) Then Begin
If (IsQwk) or (HasAccess(Self, MBase.PostACS)) Then Begin
// If ((IsQwk) or (HasAccess(Self, MBase.PostACS))) and
// ((IsNetworked And (UserRecord.QwkNetwork = MBase.QwkNetID)) or (Not IsNetworked)) Then Begin
If IsNetworked And Not IsQWK Then
MsgBase^.DoStringLn (#1'QSRC ' + PacketID);
// ^^ needs to change to UserRecord.Handle
MsgBase^.WriteMsg;
@ -704,16 +730,6 @@ Begin
End Else
Inc (RepFailed);
End;
MsgBase^.CloseMsgBase;
Dispose (MsgBase, Done);
End Else Begin
Inc (RepFailed);
For Count1 := 1 to Chunks Do
DataFile.ReadBlock (QwkBlock[1], 128);
End;
End Else Begin
Inc (RepFailed);
@ -724,6 +740,11 @@ Begin
DataFile.Free;
If MsgBase <> NIL Then Begin
MsgBase^.CloseMsgBase;
Dispose (MsgBase, Done);
End;
Assign (ExtFile, FileFind(WorkPath + 'todoor.ext'));
{$I-} Reset (ExtFile); {$I+}

View File

@ -3,6 +3,10 @@ Program QwkPoll;
{$I M_OPS.PAS}
Uses
{$IFDEF DEBUG}
HeapTrc,
LineInfo,
{$ENDIF}
m_DateTime,
m_Strings,
m_FileIO,
@ -28,6 +32,8 @@ Begin
WriteLn ('- Exchanging Mail for ' + QwkNet.Description);
DirClean (TempPath, '');
User.Handle := QwkNet.PacketID;
User.QwkNetwork := QwkNet.Index;
@ -43,6 +49,9 @@ Begin
WriteLn (' - Exported @' + QwkNet.PacketID + '.rep -> ', QWK.TotalMessages, ' msgs ');
WriteLn (' - Connecting via FTP to ' + QWkNet.HostName);
If QWK.TotalMessages = 0 Then
DirClean (TempPath, '');
FTP := TFTPClient.Create(bbsCfg.inetInterface);
If FTP.OpenConnection(QwkNet.HostName) Then Begin
@ -78,6 +87,57 @@ Begin
WriteLn;
End;
Procedure ImportPacket (QwkNet: RecQwkNetwork; Path: String);
Var
QWK : TQwkEngine;
User : RecUser;
Begin
WriteLn ('- Importing ' + Path + QwkNet.PacketID + '.qwk');
ExecuteArchive (TempPath, Path + QwkNet.PacketID + '.qwk', QwkNet.ArcType, '*', 2);
User.Handle := QwkNet.PacketID;
User.QwkNetwork := QwkNet.Index;
QWK := TQwkEngine.Create (TempPath, QwkNet.PacketID, 1, User);
QWK.IsNetworked := True;
QWK.IsExtended := QwkNet.UseQWKE;
QWK.ImportPacket(True);
WriteLn (' - Imported ', QWK.RepOK, ' messages (', QWK.RepFailed, ' failed)');
QWK.Free;
End;
Procedure ExportPacket (QwkNet: RecQwkNetwork; Path: String);
Var
QWK : TQwkEngine;
User : RecUser;
Begin
WriteLn ('- Exporting ' + Path + QwkNet.PacketID + '.rep');
User.Handle := QwkNet.PacketID;
User.QwkNetwork := QwkNet.Index;
QWK := TQwkEngine.Create (TempPath, QwkNet.PacketID, 1, User);
QWK.IsNetworked := True;
QWK.IsExtended := QwkNet.UseQWKE;
QWK.ExportPacket(True);
If QWK.TotalMessages > 0 Then
ExecuteArchive (TempPath, Path + QwkNet.PacketID + '.rep', QwkNet.ArcType, TempPath + '*', 1);
DirClean (TempPath, '');
WriteLn (' - Exported ', QWK.TotalMessages, ' messages');
QWK.Free;
End;
Var
Str : String;
F : File;
@ -123,6 +183,8 @@ Begin
Case Mode of
0 : If PollByQwkNet(QwkNet) Then
Inc (Count);
1 : ExportPacket(QwkNet, DirSlash(ParamStr(3)));
2 : ImportPacket(QwkNet, DirSlash(ParamStr(3)));
End;
End;
@ -134,6 +196,8 @@ Begin
Case Mode of
0 : If PollByQwkNet(QwkNet) Then
Inc (Count);
1 : ExportPacket(QwkNet, DirSlash(ParamStr(3)));
2 : ImportPacket(QwkNet, DirSlash(ParamStr(3)));
End;
End Else Begin
WriteLn ('Invalid command line.');