diff --git a/mystic/mis.pas b/mystic/mis.pas index 1a328e5..819fc43 100644 --- a/mystic/mis.pas +++ b/mystic/mis.pas @@ -58,7 +58,6 @@ Const FocusMax = 4; Var - Console : TOutput; Keyboard : TInput; TelnetServer : TServerManager; FTPServer : TServerManager; @@ -265,7 +264,6 @@ Procedure LocalLogin; Const BufferSize = 1024 * 4; Var - Term : TTermAnsi; Client : TSocketClass; Res : LongInt; Buffer : Array[1..BufferSize] of Char; @@ -338,6 +336,38 @@ Begin End; {$IFDEF UNIX} +Procedure Snoop; +Begin + If FocusCurrent <> FocusTelnet Then Exit; + + If FocusPtr.ClientList[BarPos - 1] <> NIL Then Begin + Term := TTermAnsi.Create(Console); + + Console.TextAttr := 7; + + Console.ClearScreen; + + Console.SetWindow (1, 1, 80, 24, True); + Console.WriteXY (1, 25, 112, strPadC('Snooping : Press [ESC] to Quit', 80, ' ')); + + TTelnetServer(FocusPtr.ClientList[BarPos - 1]).Snooping := True; + + Repeat Until Keyboard.ReadKey = #27; + + If TTelnetServer(FocusPtr.ClientList[BarPos - 1]) <> NIL Then + TTelnetServer(FocusPtr.ClientList[BarPos - 1]).Snooping := False; + + Term.Free; + + Console.TextAttr := 7; + Console.SetWindow (1, 1, 80, 25, True); + + FocusCurrent := FocusMax; + DrawStatusScreen; + SwitchFocus; + End; +End; + Procedure ExecuteDaemon; Var PID : TPID; @@ -468,7 +498,7 @@ Begin {$ENDIF} Repeat - If Keyboard.KeyWait(1000) Then + If Keyboard.KeyWait(500) Then Case Keyboard.ReadKey of #00 : Case Keyboard.ReadKey of #72 : If BarPos > TopPage Then Begin @@ -511,6 +541,7 @@ Begin End; End; #09 : SwitchFocus; + #13 : {$IFDEF UNIX}Snoop{$ENDIF}; #27 : Break; #32 : LocalLogin; End; diff --git a/mystic/mis_ansiwfc.pas b/mystic/mis_ansiwfc.pas index 3c9906e..08e12c8 100644 --- a/mystic/mis_ansiwfc.pas +++ b/mystic/mis_ansiwfc.pas @@ -37,6 +37,12 @@ Const 'u','t','d','o','w','n',' ',#24); Begin Console.LoadScreenImage(ImageData, ImageData_Length, ImageData_Width, 1, 1); - Console.WriteXY (1, 25, 113, strPadC('SPACE/Local TELNET TAB/Switch ESC/Shutdown', 79, ' ')); -// Console.WriteXY (25, 1, 113, strPadC(mysVersionText, 30, ' ')); + + //Console.WriteXY (25, 1, 113, strPadC(mysVersionText, 30, ' ')); + + {$IFDEF UNIX} + Console.WriteXY (1, 25, 113, strPadC('ENTER/Snoop SPACE/Local TELNET TAB/Switch ESC/Shutdown', 79, ' ')); + {$ELSE} + Console.WriteXY (1, 25, 113, strPadC('SPACE/Local TELNET TAB/Switch ESC/Shutdown', 79, ' ')); + {$ENDIF} End; diff --git a/mystic/mis_client_telnet.pas b/mystic/mis_client_telnet.pas index a5bb58d..aabd7fa 100644 --- a/mystic/mis_client_telnet.pas +++ b/mystic/mis_client_telnet.pas @@ -26,7 +26,8 @@ Function CreateTelnet (Owner: TServerManager; Config: RecConfig; ND: TNodeData; Type TTelnetServer = Class(TServerClient) - ND : TNodeData; + ND : TNodeData; + Snooping : Boolean; Constructor Create (Owner: TServerManager; ND: TNodeData; CliSock: TSocketClass); Procedure Execute; Override; Destructor Destroy; Override; @@ -43,7 +44,8 @@ Constructor TTelnetServer.Create (Owner: TServerManager; ND: TNodeData; CliSock: Begin Inherited Create(Owner, CliSock); - Self.ND := ND; + Self.ND := ND; + Snooping := False; End; {$IFDEF WINDOWS} @@ -133,6 +135,9 @@ Begin While Proc.Output.NumBytesAvailable > 0 Do Begin bRead := Proc.Output.Read(Buffer, BufferSize); Client.WriteBuf (Buffer, bRead); + + If Snooping Then + Term.ProcessBuf(Buffer[1], bRead); End; End Else If Client.DataWaiting Then Begin @@ -140,8 +145,9 @@ Begin If bWrite < 0 Then Break; - If bWrite > 0 Then + If bWrite > 0 Then Begin Proc.Input.Write(Buffer, bWrite); + End; End Else Sleep(10); End; diff --git a/mystic/mis_common.pas b/mystic/mis_common.pas index abfd639..1b0b33d 100644 --- a/mystic/mis_common.pas +++ b/mystic/mis_common.pas @@ -4,10 +4,16 @@ Unit MIS_Common; Interface +Uses + m_Output, + m_Term_Ansi; + {$I RECORDS.PAS} Var bbsConfig : RecConfig; + Console : TOutput; + Term : TTermAnsi; Function SearchForUser (UN: String; Var Rec: RecUser; Var RecPos: LongInt) : Boolean; Function CheckAccess (User: RecUser; IgnoreGroup: Boolean; Str: String) : Boolean;