Default protocol support

This commit is contained in:
mysticbbs 2012-08-08 02:32:31 -04:00
parent 2f6fc90ab4
commit a0f902afb4
1 changed files with 67 additions and 40 deletions

View File

@ -42,8 +42,8 @@ Type
Constructor Create (Var Owner: Pointer); Constructor Create (Var Owner: Pointer);
Destructor Destroy; Override; Destructor Destroy; Override;
Procedure dszGetFile (Var LogFile: Text; Var FName: String; Var Res: Boolean); Procedure DszGetFile (Var LogFile: Text; Var FName: String; Var Res: Boolean);
Function dszSearch (FName: String) : Boolean; Function DszSearch (FName: String) : Boolean;
Procedure GetTransferTime (Size: Longint; Var Mins : Integer; Var Secs: Byte); Procedure GetTransferTime (Size: Longint; Var Mins : Integer; Var Secs: Byte);
Procedure ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte); Procedure ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte);
Procedure ExecuteProtocol (Send: Boolean; FName: String); Procedure ExecuteProtocol (Send: Boolean; FName: String);
@ -57,7 +57,7 @@ Type
Procedure BatchDelete; Procedure BatchDelete;
Procedure SetFileScan; Procedure SetFileScan;
Procedure GetFileScan; Procedure GetFileScan;
Function SelectProtocol (Batch : Boolean) : Char; Function SelectProtocol (UseDefault, Batch: Boolean) : Char;
Function WildcardMatch (Wildcard, FName: String) : Boolean; Function WildcardMatch (Wildcard, FName: String) : Boolean;
Procedure CheckFileNameLength (FPath : String; Var FName : String); Procedure CheckFileNameLength (FPath : String; Var FName : String);
Procedure GetFileDescription (FN: String); Procedure GetFileDescription (FN: String);
@ -406,7 +406,7 @@ Begin
If Not FileExist(Data) Then Exit; If Not FileExist(Data) Then Exit;
If SelectProtocol(False) = 'Q' Then Exit; If SelectProtocol(True, False) = 'Q' Then Exit;
ExecuteProtocol(True, Data); ExecuteProtocol(True, Data);
@ -934,14 +934,38 @@ Begin
Result := True; Result := True;
End; End;
Function TFileBase.SelectProtocol (Batch: Boolean) : Char; Function TFileBase.SelectProtocol (UseDefault, Batch: Boolean) : Char;
Function LoadByKey (Key: Char) : Boolean;
Begin
Result := False;
If Key = 'Q' Then Exit;
Reset (ProtocolFile);
While Not Eof(ProtocolFile) Do Begin
Read (ProtocolFile, Protocol);
If ((Protocol.Active) And (Key = Protocol.Key) And (Protocol.Batch = Batch) And (Protocol.OSType = OSType)) Then Begin
Result := True;
Break;
End;
End;
Close(ProtocolFile);
End;
Var Var
SavedP1 : String;
SavedP2 : String;
Keys : String; Keys : String;
OldP1 : String;
Ch : Char;
Begin Begin
OldP1 := Session.io.PromptInfo[1]; SavedP1 := Session.io.PromptInfo[1];
Result := 'Q'; SavedP2 := Session.io.PromptInfo[2];
Result := Session.User.ThisUser.Protocol;
If Not LoadByKey(Result) Then Begin
Keys := 'Q'; Keys := 'Q';
Session.io.OutFullLn(Session.GetPrompt(359)); Session.io.OutFullLn(Session.GetPrompt(359));
@ -950,6 +974,7 @@ Begin
While Not Eof(ProtocolFile) Do Begin While Not Eof(ProtocolFile) Do Begin
Read (ProtocolFile, Protocol); Read (ProtocolFile, Protocol);
If Protocol.Active And (Protocol.Batch = Batch) And (Protocol.OSType = OSTYpe) Then Begin If Protocol.Active And (Protocol.Batch = Batch) And (Protocol.OSType = OSTYpe) Then Begin
Keys := Keys + Protocol.Key; Keys := Keys + Protocol.Key;
@ -964,22 +989,23 @@ Begin
Session.io.OutFull (Session.GetPrompt(62)); Session.io.OutFull (Session.GetPrompt(62));
Session.io.PromptInfo[1] := OldP1; Result := Session.io.OneKey(Keys, True);
Ch := Session.io.OneKey(Keys, True); If Result = 'Q' Then Begin
Session.io.PromptInfo[1] := SavedP1;
Session.io.PromptInfo[2] := SavedP2;
If Ch = 'Q' Then Exit; Exit;
Reset (ProtocolFile);
While Not Eof(ProtocolFile) Do Begin
Read(ProtocolFile, Protocol);
If ((Protocol.Active) And (Ch = Protocol.Key) And (Protocol.Batch = Batch) And (Protocol.OSType = OSType)) Then Break;
End; End;
Close(ProtocolFile); End;
LoadByKey(Result);
Session.io.PromptInfo[1] := Protocol.Desc;
Session.io.OutFullLn (Session.GetPrompt(65)); Session.io.OutFullLn (Session.GetPrompt(65));
Result := Ch; Session.io.PromptInfo[1] := SavedP1;
End; End;
Procedure TFileBase.ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte); Procedure TFileBase.ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte);
@ -1133,6 +1159,7 @@ Begin
End; End;
Session.io.OutFull (Session.GetPrompt(47)); Session.io.OutFull (Session.GetPrompt(47));
FName := Session.io.GetInput(70, 70, 11, ''); FName := Session.io.GetInput(70, 70, 11, '');
If FName = '' Then Exit; If FName = '' Then Exit;
@ -2548,7 +2575,7 @@ Begin
FileName := FBase.Path + FileName; FileName := FBase.Path + FileName;
End; End;
If SelectProtocol(Blind) = 'Q' Then Begin If SelectProtocol(True, Blind) = 'Q' Then Begin
FBase := OLD; FBase := OLD;
Exit; Exit;
End; End;
@ -2842,7 +2869,7 @@ Begin
Session.io.OutFullLn (Session.GetPrompt(79)); Session.io.OutFullLn (Session.GetPrompt(79));
If SelectProtocol(True) = 'Q' Then Exit; If SelectProtocol(True, True) = 'Q' Then Exit;
Assign (FL, Session.TempPath + 'file.lst'); Assign (FL, Session.TempPath + 'file.lst');
ReWrite (FL); ReWrite (FL);
@ -2874,7 +2901,7 @@ Begin
For A := 1 to BatchNum Do Begin For A := 1 to BatchNum Do Begin
Session.io.PromptInfo[1] := JustFile(Batch[A].FileName); Session.io.PromptInfo[1] := JustFile(Batch[A].FileName);
If dszSearch (Batch[A].FileName) Then Begin If DszSearch (Batch[A].FileName) Then Begin
Session.SystemLog ('Download: ' + Batch[A].FileName); Session.SystemLog ('Download: ' + Batch[A].FileName);
Session.io.OutFullLn (Session.GetPrompt(385)); Session.io.OutFullLn (Session.GetPrompt(385));