diff --git a/src/cometbinkp.pas b/src/cometbinkp.pas index fdbe1b3..53b0b03 100644 --- a/src/cometbinkp.pas +++ b/src/cometbinkp.pas @@ -295,9 +295,11 @@ var CmdID: Byte; Arg, Pwd, AddrStr: string; Parts, FParts: TStringList; - I, AtPos, AKAIdx: Integer; + I, J, AtPos, AKAIdx: Integer; Addr: TCometAddress; - FinalPath: string; + Flav: TCometFlavour; + PktPath, FloPath, FinalPath: string; + FloEntries: TCometFloEntryArray; TF: file; Challenge: TBytes; CRAMResponse: string; @@ -479,6 +481,57 @@ begin LogInfo('BinkP remote: %s (%s)', [CometAddrToStr(S.RemoteAddrs[0]), S.RemoteSysName]); + { Answerer: scan BSO outbound for files to send to the caller. + Same pattern as Comet inbound — scan all remote AKAs. } + if (not S.IsOriginator) and (Length(S.RemoteAddrs) > 0) and + (S.SendQueueLen = 0) then + begin + for I := 0 to High(S.RemoteAddrs) do + begin + if S.RemoteAddrs[I].Net = 0 then Continue; + for Flav := Low(TCometFlavour) to High(TCometFlavour) do + begin + if Flav = cfHold then Continue; + PktPath := BSONodeFile(S.Cfg.Outbound, + S.RemoteAddrs[I], S.Cfg.Addresses[0].Zone, + BSOPktExt(Flav)); + if CometFileExists(PktPath) then + begin + if S.SendQueueLen >= Length(S.SendQueue) then + SetLength(S.SendQueue, S.SendQueueLen + 16); + FillChar(S.SendQueue[S.SendQueueLen], SizeOf(TBinkpSendEntry), 0); + S.SendQueue[S.SendQueueLen].FilePath := PktPath; + S.SendQueue[S.SendQueueLen].Action := csaDelete; + Inc(S.SendQueueLen); + end; + FloPath := BSONodeFile(S.Cfg.Outbound, + S.RemoteAddrs[I], S.Cfg.Addresses[0].Zone, + BSOFloExt(Flav)); + if CometFileExists(FloPath) then + begin + FloEntries := BSOReadFlo(FloPath); + for J := 0 to High(FloEntries) do + begin + if FloEntries[J].Sent then Continue; + if (FloEntries[J].FilePath = '') or + not FileExists(FloEntries[J].FilePath) then Continue; + if S.SendQueueLen >= Length(S.SendQueue) then + SetLength(S.SendQueue, S.SendQueueLen + 16); + FillChar(S.SendQueue[S.SendQueueLen], SizeOf(TBinkpSendEntry), 0); + S.SendQueue[S.SendQueueLen].FilePath := FloEntries[J].FilePath; + S.SendQueue[S.SendQueueLen].FloPath := FloPath; + S.SendQueue[S.SendQueueLen].FloLine := FloEntries[J].OrigPath; + S.SendQueue[S.SendQueueLen].Action := FloEntries[J].Action; + Inc(S.SendQueueLen); + end; + end; + end; + end; + if S.SendQueueLen > 0 then + LogInfo('BinkP inbound: queued %d files for %s', + [S.SendQueueLen, CometAddrToStr(S.RemoteAddrs[0])]); + end; + { Originator: send password after receiving ADR. Use CRAM-MD5 if remote offered a challenge in OPT, otherwise send plain password per FTS-1026. }