New IO class, internal Zmodem, lots of stuff

This commit is contained in:
mysticbbs 2012-08-11 14:58:58 -04:00
parent dbbd542fa2
commit 3725470afb
23 changed files with 412 additions and 184 deletions

View File

@ -4535,4 +4535,19 @@
+ Restructured some class code to reduce executable sizes in the Mystic + Restructured some class code to reduce executable sizes in the Mystic
binary. The result is about 120kb smaller executable size in Windows for binary. The result is about 120kb smaller executable size in Windows for
Mystic.exe. Mystic.exe. The other versions should see similar results.
! Mystic was not properly parsing long filenames with spaces in them during
external file transfer.
! Mystic was not properly setting the "Transfering files" node status when
executing transfer protocols.
+ Mystic now has internal Zmodem protocol. To enable it, just use the
@ZMODEM text for the send/receive commands in the Protocol editor, and
Mystic will do the rest. The Zmodem has been tested extensively with:
mTelnet
SyncTerm
SEXYZ
NetRunner

View File

@ -33,7 +33,7 @@ Begin
VerticalLine (22, 7, 13); VerticalLine (22, 7, 13);
Form.AddBol ('A', ' Active ' , 14, 7, 24, 7, 8, 3, @Prot.Active, ''); Form.AddBol ('A', ' Active ' , 14, 7, 24, 7, 8, 3, @Prot.Active, '');
Form.AddTog ('O', ' OS ' , 18, 8, 24, 8, 4, 7, 0, 2, 'Windows Linux OSX', @Prot.OSType, ''); Form.AddTog ('O', ' OS ' , 18, 8, 24, 8, 4, 7, 0, 3, 'Windows Linux OSX All', @Prot.OSType, '');
Form.AddBol ('B', ' Batch ' , 15, 9, 24, 9, 7, 3, @Prot.Batch, ''); Form.AddBol ('B', ' Batch ' , 15, 9, 24, 9, 7, 3, @Prot.Batch, '');
Form.AddChar ('K', ' Hot Key ' , 13, 10, 24, 10, 9, 1, 254, @Prot.Key, ''); Form.AddChar ('K', ' Hot Key ' , 13, 10, 24, 10, 9, 1, 254, @Prot.Key, '');
Form.AddStr ('D', ' Description ' , 9, 11, 24, 11, 13, 40, 40, @Prot.Desc, ''); Form.AddStr ('D', ' Description ' , 9, 11, 24, 11, 13, 40, 40, @Prot.Desc, '');
@ -71,6 +71,7 @@ Var
0 : OS := 'Windows'; 0 : OS := 'Windows';
1 : OS := 'Linux '; 1 : OS := 'Linux ';
2 : OS := 'OSX'; 2 : OS := 'OSX';
3 : OS := 'All';
End; End;
//'Active OSID Batch Key Description'); //'Active OSID Batch Key Description');

View File

@ -325,6 +325,8 @@ Procedure Configuration_LocalUserEdit;
Var Var
SavedLocal : Boolean; SavedLocal : Boolean;
Begin Begin
Session.io.BufFlush;
SavedLocal := Session.LocalMode; SavedLocal := Session.LocalMode;
Session.InUserEdit := True; Session.InUserEdit := True;

View File

@ -5,6 +5,10 @@ Unit bbs_Common;
Interface Interface
Uses Uses
{$IFDEF WINDOWS}
m_io_Base,
m_io_Sockets,
{$ENDIF}
{$IFDEF UNIX} {$IFDEF UNIX}
Unix, Unix,
{$ENDIF} {$ENDIF}
@ -13,8 +17,7 @@ Uses
m_Output, m_Output,
m_Input, m_Input,
m_DateTime, m_DateTime,
m_FileIO, m_FileIO;
m_Socket_Class;
{$I RECORDS.PAS} {$I RECORDS.PAS}

View File

@ -5,10 +5,13 @@ Unit BBS_Core;
Interface Interface
Uses Uses
m_io_Base,
{$IFNDEF UNIX}
m_io_Sockets,
{$ENDIF}
m_FileIO, m_FileIO,
m_Strings, m_Strings,
m_DateTime, m_DateTime,
m_Socket_Class,
BBS_Common, BBS_Common,
BBS_IO, BBS_IO,
BBS_MsgBase, BBS_MsgBase,
@ -22,12 +25,14 @@ Const
Type Type
TBBSCore = Class TBBSCore = Class
{$IFNDEF UNIX}
Client : TIOBase;
{$ENDIF}
User : TBBSUser; User : TBBSUser;
Msgs : TMsgBase; Msgs : TMsgBase;
FileBase : TFileBase; FileBase : TFileBase;
Menu : TMenuEngine; Menu : TMenuEngine;
IO : TBBSIO; IO : TBBSIO;
Client : TSocketClass;
EventFile : File of EventRec; EventFile : File of EventRec;
ThemeFile : File of RecTheme; ThemeFile : File of RecTheme;
VoteFile : File of VoteRec; VoteFile : File of VoteRec;
@ -122,9 +127,9 @@ Begin
InMessage := False; InMessage := False;
MessageCheck := mysMessageThreshold; MessageCheck := mysMessageThreshold;
{$IFDEF WINDOWS} {$IFNDEF UNIX}
Client := TSocketClass.Create; Client := TIOSocket.Create;
Client.FTelnetServer := True; TIOSocket(Client).FTelnetServer := True;
{$ENDIF} {$ENDIF}
User := TBBSUser.Create(Pointer(Self)); User := TBBSUser.Create(Pointer(Self));

View File

@ -11,6 +11,8 @@ Implementation
Uses Uses
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
Windows, Windows,
m_io_Base,
m_io_Sockets,
{$ENDIF} {$ENDIF}
m_Types, m_Types,
m_Strings, m_Strings,
@ -218,7 +220,7 @@ Begin
PassHandle := 0; PassHandle := 0;
If Not Session.LocalMode Then If Not Session.LocalMode Then
PassHandle := Session.Client.FSocketHandle; PassHandle := TIOSocket(Session.Client).FSocketHandle;
If Session.User.UserNum <> -1 Then Begin If Session.User.UserNum <> -1 Then Begin
Reset (Session.User.UserFile); Reset (Session.User.UserFile);
@ -297,7 +299,7 @@ Begin
{$IFDEF UNIX} {$IFDEF UNIX}
If Cmd[A] = '0' Then Temp := Temp + '1' Else If Cmd[A] = '0' Then Temp := Temp + '1' Else
{$ELSE} {$ELSE}
If Cmd[A] = '0' Then Temp := Temp + strI2S(Session.Client.FSocketHandle) Else If Cmd[A] = '0' Then Temp := Temp + strI2S(TIOSocket(Session.Client).FSocketHandle) Else
{$ENDIF} {$ENDIF}
If Cmd[A] = '1' Then Temp := Temp + '1' Else If Cmd[A] = '1' Then Temp := Temp + '1' Else
If Cmd[A] = '2' Then Temp := Temp + strI2S(Session.Baud) Else If Cmd[A] = '2' Then Temp := Temp + strI2S(Session.Baud) Else

View File

@ -1,19 +1,31 @@
Unit bbs_FileBase; Unit bbs_FileBase;
{$I M_OPS.PAS} {$I M_OPS.PAS}
{$MODESWITCH NESTEDPROCVARS-} {$MODESWITCH NESTEDPROCVARS-}
Interface Interface
Uses Uses
m_io_Base,
{$IFDEF WINDOWS}
m_io_Sockets,
{$ENDIF}
{$IFDEF UNIX}
m_io_STDIO,
{$ENDIF}
DOS, DOS,
mkCrap, mkCrap,
m_Strings, m_Strings,
m_FileIO, m_FileIO,
m_DateTime, m_DateTime,
m_Protocol_Queue,
m_Protocol_Base,
m_Protocol_Zmodem,
bbs_Common, bbs_Common,
bbs_General, bbs_General,
bbs_NodeInfo, bbs_NodeInfo,
bbs_Ansi_MenuBox,
AView; AView;
Type Type
@ -46,7 +58,7 @@ Type
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 (Mode: Byte; FName: String);
Function SelectArchive : Boolean; Function SelectArchive : Boolean;
Function ListFileAreas (Compress: Boolean) : Integer; Function ListFileAreas (Compress: Boolean) : Integer;
Procedure ChangeFileArea (Data: String); Procedure ChangeFileArea (Data: String);
@ -103,14 +115,11 @@ Begin
Inherited Destroy; Inherited Destroy;
End; End;
Procedure TFileBase.dszGetFile (Var LogFile: Text; Var FName: String; Var Res: Boolean); Procedure TFileBase.DszGetFile (Var LogFile: Text; Var FName: String; Var Res: Boolean);
Type Type
TLineBuf = Array[0..1024] of Char; TLineBuf = Array[0..1024] of Char;
Var Var
LineBuf : TLineBuf; LineBuf : TLineBuf;
TempStr1 : DirStr;
TempStr2 : NameStr;
TempStr3 : ExtStr;
WordPos : Integer; WordPos : Integer;
Count : Integer; Count : Integer;
Begin Begin
@ -132,6 +141,7 @@ Begin
While WordPos < 11 Do Begin While WordPos < 11 Do Begin
If LineBuf[Count] = #32 Then Begin If LineBuf[Count] = #32 Then Begin
Inc (WordPos); Inc (WordPos);
Repeat Repeat
Inc (Count); Inc (Count);
Until LineBuf[Count] <> #32; Until LineBuf[Count] <> #32;
@ -142,14 +152,17 @@ Begin
Repeat Repeat
FName := FName + LineBuf[Count]; FName := FName + LineBuf[Count];
Inc (Count); Inc (Count);
Until (LineBuf[Count] = #32) or (LineBuf[Count] = #0) or (Count = 1024); Until (LineBuf[Count] = #0) or (Count = 1024);
FSplit(FName, TempStr1, TempStr2, TempStr3); While FName[Length(FName)] <> #32 Do
Dec(FName[0]);
FName := TempStr2 + TempStr3; Dec(FName[0]);
FName := JustFile(FName);
End; End;
Function TFileBase.dszSearch (FName: String) : Boolean; Function TFileBase.DszSearch (FName: String) : Boolean;
Var Var
LogFile : Text; LogFile : Text;
FileName : String; FileName : String;
@ -159,13 +172,14 @@ Begin
Assign (LogFile, Session.TempPath + 'xfer.log'); Assign (LogFile, Session.TempPath + 'xfer.log');
{$I-} Reset(LogFile); {$I+} {$I-} Reset(LogFile); {$I+}
If IoResult <> 0 Then Begin If IoResult <> 0 Then Begin
Session.SystemLog('ERROR: Can''t find xfer.log'); Session.SystemLog('ERROR: Can''t find xfer.log');
Exit; Exit;
End; End;
While Not Eof(LogFile) Do Begin While Not Eof(LogFile) Do Begin
dszGetFile(LogFile, FileName, Status); DszGetFile(LogFile, FileName, Status);
{$IFDEF FS_SENSITIVE} {$IFDEF FS_SENSITIVE}
If FileName = FName Then Begin If FileName = FName Then Begin
@ -173,6 +187,7 @@ Begin
If strUpper(FileName) = strUpper(FName) Then Begin If strUpper(FileName) = strUpper(FName) Then Begin
{$ENDIF} {$ENDIF}
Result := Status; Result := Status;
Break; Break;
End; End;
End; End;
@ -180,70 +195,214 @@ Begin
Close (LogFile); Close (LogFile);
End; End;
Procedure TFileBase.ExecuteProtocol (Send: Boolean; FName: String); {$IFNDEF UNIX}
Procedure ProtocolStatus (Start, Finish: Boolean; Status: RecProtocolStatus);
Var Var
T : Text; KBRate : LongInt;
Cmd : String;
Count : Byte;
Res : String;
Path : String;
Begin Begin
If Send Then Screen.WriteXY (19, 10, 113, strPadR(Status.FileName, 56, ' '));
Cmd := Protocol.SendCmd Screen.WriteXY (19, 11, 113, strPadR(strComma(Status.FileSize), 15, ' '));
Else Screen.WriteXY (19, 12, 113, strPadR(strComma(Status.Position), 15, ' '));
Cmd := Protocol.RecvCmd; Screen.WriteXY (64, 11, 113, strPadR(strI2S(Status.Errors), 3, ' '));
Res := ''; KBRate := 0;
Path := '';
Count := 1;
While Count <= Length(Cmd) Do Begin If (TimerSeconds - Status.StartTime > 0) and (Status.Position > 0) Then
If Cmd[Count] = '%' Then Begin KBRate := Round((Status.Position / (TimerSeconds - Status.StartTime)) / 1024);
Inc(Count);
{$IFNDEF UNIX} Screen.WriteXY (64, 12, 113, strPadR(strI2S(KBRate) + ' k/sec', 12, ' '));
If Cmd[Count] = '0' Then Res := Res + strI2S(Session.Client.FSocketHandle) Else End;
{$ENDIF}
Procedure TFileBase.ExecuteProtocol (Mode: Byte; FName: String);
// mode: 0=recv batch, 1=recv file, 2=send file, 3= send batch
Var
Command : String;
T : Text;
Res : String;
{$IFNDEF UNIX}
Box : TAnsiMenuBox;
SavedL : Boolean;
SavedA : Boolean;
{$ENDIF}
Procedure ExecInternal;
Var
Protocol : TProtocolBase;
Queue : TProtocolQueue;
Count : Word;
Client : TIOBase;
Begin
{$IFDEF UNIX}
Client := TSTDIO.Create;
{$ELSE}
Client := Session.Client;
{$ENDIF}
Command := strStripB(strUpper(Command), ' ');
Queue := TProtocolQueue.Create;
If Command = '@ZMODEM' Then
Protocol := TProtocolZmodem.Create(Client, Queue)
Else Begin
{$IFDEF UNIX}
Client.Free;
{$ENDIF} {$ENDIF}
If Cmd[Count] = '1' Then Res := Res + '1' Else Queue.Free;
If Cmd[Count] = '2' Then Res := Res + strI2S(Session.Baud) Else Exit;
If Cmd[Count] = '3' Then Res := Res + FName Else End;
If Cmd[Count] = '4' Then Res := Res + Session.UserIPInfo Else
If Cmd[Count] = '5' Then Res := Res + Session.UserHostInfo Else
If Cmd[Count] = '6' Then Res := Res + strReplace(Session.User.ThisUser.Handle, ' ', '_') Else
If Cmd[Count] = '7' Then Res := Res + strI2S(Session.NodeNum);
End Else
Res := Res + Cmd[Count];
Inc (Count); Case Mode of
0,
1 : Protocol.ReceivePath := DirSlash(FName);
2 : Queue.Add(JustPath(FName), JustFile(FName));
3 : Begin
Assign (T, Session.TempPath + 'file.lst');
Reset (T);
While Not Eof(T) Do Begin
ReadLn (T, Res);
Queue.Add(JustPath(Res), JustFile(Res));
End;
Close (T);
End;
End;
Session.io.BufFlush;
{$IFNDEF UNIX}
SavedL := Session.LocalMode;
SavedA := Screen.Active;
Session.LocalMode := True;
Protocol.StatusProc := ProtocolStatus;
Session.io.LocalScreenEnable;
Box := TAnsiMenuBox.Create;
Case Mode of
0..1 : Box.Header := ' ' + Protocol.Status.Protocol + ' Upload ';
2..3 : Box.Header := ' ' + Protocol.Status.Protocol + ' Download ';
End;
Box.Open (6, 8, 76, 14);
Screen.WriteXY ( 8, 10, 112, 'File Name:');
Screen.WriteXY (13, 11, 112, 'Size:');
Screen.WriteXY ( 9, 12, 112, 'Position:');
Screen.WriteXY (56, 11, 112, 'Errors:');
Screen.WriteXY (58, 12, 112, 'Rate:');
{$ENDIF}
Case Mode of
0..1 : Protocol.QueueReceive;
2..3 : Protocol.QueueSend;
End;
{$IFNDEF UNIX}
Box.Free;
Session.io.BufFlush;
If Not SavedA Then
Session.io.LocalScreenDisable;
Session.LocalMode := SavedL;
{$ENDIF}
Assign (T, Session.TempPath + 'xfer.log');
ReWrite (T);
For Count := 1 to Queue.QSize Do Begin
Res[1] := 'E';
If Queue.QData[Count]^.Status = QueueSuccess Then Res[1] := 'Z';
WriteLn(T, Res[1] + ' 0 0 0 0 0 0 0 0 0 ' + Queue.QData[Count]^.FileName + ' -1');
End;
Close (T);
Protocol.Free;
Queue.Free;
{$IFDEF UNIX}
Client.Free;
{$ENDIF}
End; End;
{$IFDEF UNIX} Procedure ExecExternal;
Assign (T, Session.TempPath + 'xfer.sh'); Var
ReWrite (T); Path : String;
WriteLn (T, 'export DSZLOG=' + Session.TempPath + 'xfer.log'); Count : Byte;
WriteLn (T, Res); Begin
Close (T); Res := '';
{$ELSE} Path := '';
Assign (T, Session.TempPath + 'xfer.bat'); Count := 1;
ReWrite (T);
WriteLn (T, 'SET DSZLOG=' + Session.TempPath + 'xfer.log');
WriteLn (T, Res);
Close (T);
{$ENDIF}
{ If uploading and batch, switch to upload directory via shelldos } While Count <= Length(Command) Do Begin
If Not Send And Protocol.Batch Then Path := FName; If Command[Count] = '%' Then Begin
Inc(Count);
{$IFNDEF UNIX}
If Command[Count] = '0' Then Res := Res + strI2S(TIOSocket(Session.Client).FSocketHandle) Else
{$ENDIF}
If Command[Count] = '1' Then Res := Res + '1' Else
If Command[Count] = '2' Then Res := Res + strI2S(Session.Baud) Else
If Command[Count] = '3' Then Res := Res + FName Else
If Command[Count] = '4' Then Res := Res + Session.UserIPInfo Else
If Command[Count] = '5' Then Res := Res + Session.UserHostInfo Else
If Command[Count] = '6' Then Res := Res + strReplace(Session.User.ThisUser.Handle, ' ', '_') Else
If Command[Count] = '7' Then Res := Res + strI2S(Session.NodeNum);
End Else
Res := Res + Command[Count];
If Res[1] = '!' Then Begin Inc (Count);
Delete (Res, 1, 1); End;
ExecuteMPL (NIL, Res);
End Else
{$IFDEF UNIX}
ShellDOS (Path, 'sh ' + Session.TempPath + 'xfer.sh');
{$ELSE}
ShellDOS (Path, Session.TempPath + 'xfer.bat');
{$ENDIF}
DirChange (Config.SystemPath); {$IFDEF UNIX}
Assign (T, Session.TempPath + 'xfer.sh');
ReWrite (T);
WriteLn (T, 'export DSZLOG=' + Session.TempPath + 'xfer.log');
WriteLn (T, Res);
Close (T);
{$ELSE}
Assign (T, Session.TempPath + 'xfer.bat');
ReWrite (T);
WriteLn (T, 'SET DSZLOG=' + Session.TempPath + 'xfer.log');
WriteLn (T, Res);
Close (T);
{$ENDIF}
// If uploading and batch, switch to upload directory via shelldos
If (Mode < 2) And Protocol.Batch Then Path := FName;
If Res[1] = '!' Then Begin
Delete (Res, 1, 1);
ExecuteMPL (NIL, Res);
End Else
{$IFDEF UNIX}
ShellDOS (Path, 'sh ' + Session.TempPath + 'xfer.sh');
{$ELSE}
ShellDOS (Path, Session.TempPath + 'xfer.bat');
{$ENDIF}
DirChange (Config.SystemPath);
End;
Begin
Set_Node_Action(Session.GetPrompt(351));
If Mode > 1 Then
Command := Protocol.SendCmd
Else
Command := Protocol.RecvCmd;
If Command[1] = '@' Then
ExecInternal
Else
ExecExternal;
End; End;
Procedure TFileBase.GetTransferTime (Size: Longint; Var Mins : Integer; Var Secs: Byte); Procedure TFileBase.GetTransferTime (Size: Longint; Var Mins : Integer; Var Secs: Byte);
@ -324,6 +483,7 @@ Begin
If FileSize(FScanFile) < Session.User.UserNum - 1 Then Begin If FileSize(FScanFile) < Session.User.UserNum - 1 Then Begin
Seek (FScanFile, FileSize(FScanFile)); Seek (FScanFile, FileSize(FScanFile));
For A := FileSize(FScanFile) to Session.User.UserNum - 1 Do For A := FileSize(FScanFile) to Session.User.UserNum - 1 Do
Write (FScanFile, Temp); Write (FScanFile, Temp);
End; End;
@ -408,7 +568,7 @@ Begin
If SelectProtocol(True, False) = 'Q' Then Exit; If SelectProtocol(True, False) = 'Q' Then Exit;
ExecuteProtocol(True, Data); ExecuteProtocol(2, Data);
Session.io.OutRawLn (''); Session.io.OutRawLn ('');
@ -511,6 +671,7 @@ Begin
While Not Eof(FDirFile) Do Begin While Not Eof(FDirFile) Do Begin
Read (FDirFile, FDir); Read (FDirFile, FDir);
If (NewFiles and (FDir.DateTime > FScan.LastNew)) or Not NewFiles Then If (NewFiles and (FDir.DateTime > FScan.LastNew)) or Not NewFiles Then
If FDir.Flags And FDirDeleted = 0 Then Begin If FDir.Flags And FDirDeleted = 0 Then Begin
Inc (TotalFiles); Inc (TotalFiles);
@ -557,7 +718,7 @@ Begin
Session.io.OutFullLn (Session.GetPrompt(225)); Session.io.OutFullLn (Session.GetPrompt(225));
Result := (TotalFiles = 0); Result := (TotalFiles > 0);
If Not Result Then Session.io.OutFullLn(Session.GetPrompt(425)); If Not Result Then Session.io.OutFullLn(Session.GetPrompt(425));
End; End;
@ -947,7 +1108,7 @@ Function TFileBase.SelectProtocol (UseDefault, Batch: Boolean) : Char;
While Not Eof(ProtocolFile) Do Begin While Not Eof(ProtocolFile) Do Begin
Read (ProtocolFile, Protocol); Read (ProtocolFile, Protocol);
If ((Protocol.Active) And (Key = Protocol.Key) And (Protocol.Batch = Batch) And (Protocol.OSType = OSType)) Then Begin If ((Protocol.Active) And (Key = Protocol.Key) And (Protocol.Batch = Batch) And ((Protocol.OSType = OSType) or (Protocol.OSType = 3))) Then Begin
Result := True; Result := True;
Break; Break;
End; End;
@ -1528,6 +1689,7 @@ Begin
If Total = 0 Then Begin If Total = 0 Then Begin
Session.io.OutFullLn (Session.GetPrompt(37)); Session.io.OutFullLn (Session.GetPrompt(37));
FBase := Old; FBase := Old;
End Else Begin End Else Begin
Repeat Repeat
@ -2580,7 +2742,7 @@ Begin
Exit; Exit;
End; End;
ExecuteProtocol(False, FBase.Path); ExecuteProtocol(0, FBase.Path);
{ ++lang ADD: update node status to transferring file? } { ++lang ADD: update node status to transferring file? }
@ -2649,7 +2811,7 @@ Begin
{$IFDEF UNIX} {$IFDEF UNIX}
If Config.TestCmdLine[A] = '0' Then Temp := Temp + '1' Else If Config.TestCmdLine[A] = '0' Then Temp := Temp + '1' Else
{$ELSE} {$ELSE}
If Config.TestCmdLine[A] = '0' Then Temp := Temp + strI2S(Session.Client.FSocketHandle) Else If Config.TestCmdLine[A] = '0' Then Temp := Temp + strI2S(TIOSocket(Session.Client).FSocketHandle) Else
{$ENDIF} {$ENDIF}
If Config.TestCmdLine[A] = '1' Then Temp := Temp + '1' Else If Config.TestCmdLine[A] = '1' Then Temp := Temp + '1' Else
If Config.TestCmdLine[A] = '2' Then Temp := Temp + '38400' Else If Config.TestCmdLine[A] = '2' Then Temp := Temp + '38400' Else
@ -2893,7 +3055,7 @@ Begin
Close (FBaseFile); Close (FBaseFile);
Close (FL); Close (FL);
ExecuteProtocol(True, Session.TempPath + 'file.lst'); ExecuteProtocol(3, Session.TempPath + 'file.lst');
Reset (FBaseFile); Reset (FBaseFile);

View File

@ -206,7 +206,7 @@ Begin
Close (TF); Close (TF);
End; End;
Function SearchBBS (Str : String; Temp : BBSListRec) : Boolean; Function SearchBBS (Str: String; Temp: BBSListRec) : Boolean;
Begin Begin
Str := strUpper(Str); Str := strUpper(Str);

View File

@ -8,6 +8,8 @@ Uses
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
Windows, Windows,
WinSock2, WinSock2,
m_io_Base,
m_io_Sockets,
{$ENDIF} {$ENDIF}
m_Types, m_Types,
m_DateTime, m_DateTime,
@ -98,7 +100,7 @@ Type
Function DoInputEvents (Var Ch: Char) : Boolean; Function DoInputEvents (Var Ch: Char) : Boolean;
Function GetKey : Char; Function GetKey : Char;
Function GetYN (Str: String; Yes: Boolean) : Boolean; Function GetYN (Str: String; Yes: Boolean) : Boolean;
Function GetPW (Str : String; BadStr : String; PW : String) : Boolean; Function GetPW (Str: String; BadStr: String; PW: String) : Boolean;
Function OneKey (Str: String; Echo: Boolean) : Char; Function OneKey (Str: String; Echo: Boolean) : Char;
Procedure RemoteRestore (Var Image: TConsoleImageRec); Procedure RemoteRestore (Var Image: TConsoleImageRec);
Procedure PurgeInputBuffer; Procedure PurgeInputBuffer;
@ -914,7 +916,7 @@ Begin
If O Then OutON := 'On' Else OutON := 'Off'; {++lang} If O Then OutON := 'On' Else OutON := 'Off'; {++lang}
End; End;
Function TBBSIO.OutFile (FName : String; DoPause: Boolean; Speed: Byte) : Boolean; Function TBBSIO.OutFile (FName: String; DoPause: Boolean; Speed: Byte) : Boolean;
Var Var
Buffer : Array[1..4096] of Char; Buffer : Array[1..4096] of Char;
BufPos : LongInt; BufPos : LongInt;
@ -943,6 +945,11 @@ Var
Ext := '.asc'; Ext := '.asc';
FName := Temp; FName := Temp;
Result := True; Result := True;
End Else
If FileExist(Temp) Then Begin
Ext := '.' + JustFileExt(FName);
FName := Path + JustFileName(FName);
Result := True;
End; End;
End; End;
@ -968,7 +975,7 @@ Begin
Result := False; Result := False;
NoFile := True; NoFile := True;
If (Pos(PathSep, FName) > 0) or (Pos('.', FName) > 0) Then Begin If (Pos(PathSep, FName) > 0) Then Begin
If Not FileExist(FName) Then If Not FileExist(FName) Then
If Not CheckFileInPath('') Then Exit; If Not CheckFileInPath('') Then Exit;
End Else Begin End Else Begin
@ -979,7 +986,7 @@ Begin
Exit; Exit;
End; End;
If Pos('.', FName) = 0 Then If (Pos('.', FName) = 0) Then
If FileExist(FName + Copy(Ext, 1, 3) + '1') Then Begin If FileExist(FName + Copy(Ext, 1, 3) + '1') Then Begin
Repeat Repeat
BufPos := Random(9); BufPos := Random(9);
@ -1175,7 +1182,7 @@ Begin
Handles[1] := SocketEvent; Handles[1] := SocketEvent;
WSAResetEvent (Handles[1]); WSAResetEvent (Handles[1]);
WSAEventSelect (TBBSCore(Core).Client.FSocketHandle, Handles[1], FD_READ OR FD_CLOSE); WSAEventSelect (TIOSocket(TBBSCore(Core).Client).FSocketHandle, Handles[1], FD_READ OR FD_CLOSE);
Case WaitForMultipleObjects(2, @Handles, False, Wait) of Case WaitForMultipleObjects(2, @Handles, False, Wait) of
WAIT_OBJECT_0 : InType := 1; WAIT_OBJECT_0 : InType := 1;

View File

@ -596,6 +596,8 @@ Begin
If SpecialKey(Data.Item[Count]^.HotKey) Then Continue; If SpecialKey(Data.Item[Count]^.HotKey) Then Continue;
// check command acs for validkey?
Found := Data.Item[Count]^.HotKey = Temp + UpCase(Ch); Found := Data.Item[Count]^.HotKey = Temp + UpCase(Ch);
If Not ValidKey Then If Not ValidKey Then

View File

@ -1114,7 +1114,7 @@ Begin
If Session.FileBase.SelectProtocol(True, False) = 'Q' Then Exit; If Session.FileBase.SelectProtocol(True, False) = 'Q' Then Exit;
Session.FileBase.ExecuteProtocol(False, FN); Session.FileBase.ExecuteProtocol(1, FN);
OK := Session.FileBase.dszSearch(JustFile(FN)); OK := Session.FileBase.dszSearch(JustFile(FN));
End; End;
@ -3276,7 +3276,7 @@ Begin
Else Begin Else Begin
If Session.FileBase.SelectProtocol(True, False) = 'Q' Then Exit; If Session.FileBase.SelectProtocol(True, False) = 'Q' Then Exit;
Session.FileBase.ExecuteProtocol(False, Session.TempPath + Config.qwkBBSID + '.rep'); Session.FileBase.ExecuteProtocol(1, Session.TempPath + Config.qwkBBSID + '.rep');
If Not Session.FileBase.dszSearch(Config.qwkBBSID + '.rep') Then Begin If Not Session.FileBase.dszSearch(Config.qwkBBSID + '.rep') Then Begin
Session.io.PromptInfo[1] := Config.qwkBBSID + '.rep'; Session.io.PromptInfo[1] := Config.qwkBBSID + '.rep';

View File

@ -248,7 +248,7 @@
132 |01[|10þ|01] |09More: |01(|07Y|01)|09es, |01(|07N|01)|09o, |01(|07C|01)|09ontinueous? 132 |01[|10þ|01] |09More: |01(|07Y|01)|09es, |01(|07N|01)|09o, |01(|07C|01)|09ontinueous?
133 |CR|12WARNING: |14System event approaching in |15|NE |14minutes!|CR|PA 133 |CR|12WARNING: |14System event approaching in |15|NE |14minutes!|CR|PA
134 |CR|12WARNING: You only have |TL minutes remaining! 134 |CR|12WARNING: You only have |TL minutes remaining!
135 |CR|12Sorry, you have no time left for today.|CR|CR|PA 135 |CR|12Sorry, you have no time left for today.|CR
136 |CR|CR|14Inactivity timeout. Hanging up! 136 |CR|CR|14Inactivity timeout. Hanging up!
137 |CR|14System Event: Disconnecting. 137 |CR|14System Event: Disconnecting.
; Who's online list header ; Who's online list header
@ -729,9 +729,9 @@
; View text file filename prompt ; View text file filename prompt
384 |CR|09File name|CR: 384 |CR|09File name|CR:
; Download OK &1 = filename ; Download OK &1 = filename
385 |CR|03- Transfer of |11|&1|03: OK 385 |03- Transfer of |11|&1|03: OK
; Download failed &1 = filename ; Download failed &1 = filename
386 |CR|03- Transfer of |11|&1|03: |12Failed! 386 |03- Transfer of |11|&1|03: |12Failed!
; Mass mail prompt ; Mass mail prompt
387 |CL|09Send mass mail by|09:|CR|CR|11(|031|08) |09ACS level|CR|11(|032|08)|09 List of users|CR|11(|033|08)|09 All users|CR|11(|03Q|08)|09 Quit|CR|CRCommand |08-> |07 387 |CL|09Send mass mail by|09:|CR|CR|11(|031|08) |09ACS level|CR|11(|032|08)|09 List of users|CR|11(|033|08)|09 All users|CR|11(|03Q|08)|09 Quit|CR|CRCommand |08-> |07
; Mass mail ACS prompt ; Mass mail ACS prompt

View File

@ -25,6 +25,7 @@ Program Install;
{$MODESWITCH NESTEDPROCVARS-} {$MODESWITCH NESTEDPROCVARS-}
Uses Uses
m_FileIO,
m_Strings, m_Strings,
m_Input, m_Input,
m_Output, m_Output,
@ -119,20 +120,23 @@ Begin
IsDir := ((wAttr And Directory) = Directory); IsDir := ((wAttr And Directory) = Directory);
End; End;
Procedure MakeDir (Str: String); Function MakeDir (Str: String) : Boolean;
Var Var
A : Byte; PathPos : Byte;
CurDIR : String; CurDIR : String;
Prefix : String; Prefix : String;
Begin Begin
Prefix := ''; Result := True;
A := Pos(PathChar, Str); If DirExists(Str) Then Exit;
While (A > 0) Do Begin Prefix := '';
CurDIR := Copy(Str, 1, A); PathPos := Pos(PathChar, Str);
Delete (Str, 1, A); While (PathPos > 0) Do Begin
CurDIR := Copy(Str, 1, PathPos);
Delete (Str, 1, PathPos);
Prefix := Prefix + CurDIR; Prefix := Prefix + CurDIR;
@ -143,7 +147,7 @@ Begin
End; End;
End; End;
A := Pos(PathChar, Str); PathPos := Pos(PathChar, Str);
End; End;
End; End;
@ -633,7 +637,7 @@ Begin
End; End;
#60 : Begin #60 : Begin
GetPaths := True; GetPaths := True;
Break; Break;
End; End;
#72 : If Pos > 1 Then Dec(Pos) Else Pos := 9; #72 : If Pos > 1 Then Dec(Pos) Else Pos := 9;
#80 : If Pos < 9 Then Inc(Pos) Else Pos := 1; #80 : If Pos < 9 Then Inc(Pos) Else Pos := 1;

View File

@ -36,7 +36,8 @@ Uses
m_Output, m_Output,
m_Input, m_Input,
m_DateTime, m_DateTime,
m_Socket_Class, m_io_Base,
m_io_Sockets,
m_FileIO, m_FileIO,
m_Strings, m_Strings,
m_Term_Ansi, m_Term_Ansi,
@ -264,16 +265,17 @@ Procedure LocalLogin;
Const Const
BufferSize = 1024 * 4; BufferSize = 1024 * 4;
Var Var
Client : TSocketClass; Client : TIOSocket;
Res : LongInt; Res : LongInt;
Buffer : Array[1..BufferSize] of Char; Buffer : Array[1..BufferSize] of Char;
Done : Boolean; Done : Boolean;
Ch : Char; Ch : Char;
Begin Begin
Console.TextAttr := 7;
Console.ClearScreen; Console.ClearScreen;
Console.WriteStr ('Connecting to 127.0.0.1... '); Console.WriteStr ('Connecting to 127.0.0.1... ');
Client := TSocketClass.Create; Client := TIOSocket.Create;
If Not Client.Connect('127.0.0.1', bbsConfig.InetTNPort) Then If Not Client.Connect('127.0.0.1', bbsConfig.InetTNPort) Then
Console.WriteLine('Unable to connect') Console.WriteLine('Unable to connect')
@ -284,7 +286,7 @@ Begin
Console.SetWindow (1, 1, 80, 24, True); Console.SetWindow (1, 1, 80, 24, True);
Console.WriteXY (1, 25, 112, strPadC('Local TELNET: ALT-X to Quit', 80, ' ')); Console.WriteXY (1, 25, 112, strPadC('Local TELNET: ALT-X to Quit', 80, ' '));
Term.SetReplyClient(Client); Term.SetReplyClient(TIOBase(Client));
Repeat Repeat
If Client.WaitForData(0) > 0 Then Begin If Client.WaitForData(0) > 0 Then Begin

View File

@ -10,15 +10,16 @@ Interface
Uses Uses
SysUtils, SysUtils,
m_io_Base,
m_io_Sockets,
m_Strings, m_Strings,
m_FileIO, m_FileIO,
m_Socket_Class,
m_DateTime, m_DateTime,
MIS_Server, MIS_Server,
MIS_NodeData, MIS_NodeData,
MIS_Common; MIS_Common;
Function CreateFTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TSocketClass) : TServerClient; Function CreateFTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TIOSocket) : TServerClient;
Type Type
TFTPServer = Class(TServerClient) TFTPServer = Class(TServerClient)
@ -33,7 +34,7 @@ Type
Data : String; Data : String;
DataPort : Word; DataPort : Word;
DataIP : String; DataIP : String;
DataSocket : TSocketClass; DataSocket : TIOSocket;
User : RecUser; User : RecUser;
UserPos : LongInt; UserPos : LongInt;
FBasePos : LongInt; FBasePos : LongInt;
@ -41,7 +42,7 @@ Type
SecLevel : RecSecurity; SecLevel : RecSecurity;
FileMask : String; FileMask : String;
Constructor Create (Owner: TServerManager; CliSock: TSocketClass); Constructor Create (Owner: TServerManager; CliSock: TIOSocket);
Procedure Execute; Override; Procedure Execute; Override;
Destructor Destroy; Override; Destructor Destroy; Override;
@ -101,12 +102,12 @@ Const
re_DLLimit = '550 Download limit would be exceeded'; re_DLLimit = '550 Download limit would be exceeded';
re_DLRatio = '550 Download/upload ratio would be exceeded'; re_DLRatio = '550 Download/upload ratio would be exceeded';
Function CreateFTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TSocketClass) : TServerClient; Function CreateFTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TIOSocket) : TServerClient;
Begin Begin
Result := TFTPServer.Create(Owner, CliSock); Result := TFTPServer.Create(Owner, CliSock);
End; End;
Constructor TFTPServer.Create (Owner: TServerManager; CliSock: TSocketClass); Constructor TFTPServer.Create (Owner: TServerManager; CliSock: TIOSocket);
Begin Begin
Inherited Create(Owner, CliSock); Inherited Create(Owner, CliSock);
@ -245,7 +246,7 @@ End;
Function TFTPServer.OpenDataSession : Boolean; Function TFTPServer.OpenDataSession : Boolean;
Var Var
WaitSock : TSocketClass; WaitSock : TIOSocket;
Begin Begin
Result := False; Result := False;
@ -258,7 +259,7 @@ Begin
Client.WriteLine(re_DataOpening); Client.WriteLine(re_DataOpening);
If IsPassive Then Begin If IsPassive Then Begin
WaitSock := TSocketClass.Create; WaitSock := TIOSocket.Create;
WaitSock.WaitInit(DataPort); WaitSock.WaitInit(DataPort);
@ -272,7 +273,7 @@ Begin
WaitSock.Free; WaitSock.Free;
End Else Begin End Else Begin
DataSocket := TSocketClass.Create; DataSocket := TIOSocket.Create;
If Not DataSocket.Connect(DataIP, DataPort) Then Begin If Not DataSocket.Connect(DataIP, DataPort) Then Begin
Client.WriteLine(re_NoData); Client.WriteLine(re_NoData);
@ -415,7 +416,7 @@ End;
Procedure TFTPServer.cmdPASV; Procedure TFTPServer.cmdPASV;
Var Var
WaitSock : TSocketClass; WaitSock : TIOSocket;
Begin Begin
If LoggedIn Then Begin If LoggedIn Then Begin
DataPort := Random(bbsConfig.inetFTPPortMax - bbsConfig.inetFTPPortMin) + bbsConfig.inetFTPPortMin; DataPort := Random(bbsConfig.inetFTPPortMax - bbsConfig.inetFTPPortMin) + bbsConfig.inetFTPPortMin;
@ -424,7 +425,7 @@ Begin
IsPassive := True; IsPassive := True;
WaitSock := TSocketClass.Create; WaitSock := TIOSocket.Create;
WaitSock.WaitInit(DataPort); WaitSock.WaitInit(DataPort);
@ -708,7 +709,7 @@ End;
Procedure TFTPServer.cmdEPSV; Procedure TFTPServer.cmdEPSV;
Var Var
WaitSock : TSocketClass; WaitSock : TIOSocket;
Begin Begin
If LoggedIn Then Begin If LoggedIn Then Begin
If Data = '' Then Begin If Data = '' Then Begin
@ -717,7 +718,7 @@ Begin
Client.WriteLine('229 Entering Extended Passive Mode (|||' + strI2S(DataPort) + '|)'); Client.WriteLine('229 Entering Extended Passive Mode (|||' + strI2S(DataPort) + '|)');
WaitSock := TSocketClass.Create; WaitSock := TIOSocket.Create;
WaitSock.WaitInit(DataPort); WaitSock.WaitInit(DataPort);

View File

@ -8,15 +8,16 @@ Interface
Uses Uses
SysUtils, SysUtils,
m_io_Base,
m_io_Sockets,
m_Strings, m_Strings,
m_FileIO, m_FileIO,
m_Socket_Class,
m_DateTime, m_DateTime,
MIS_Server, MIS_Server,
MIS_NodeData, MIS_NodeData,
MIS_Common; MIS_Common;
Function CreateNNTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TSocketClass) : TServerClient; Function CreateNNTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TIOSocket) : TServerClient;
Type Type
TNNTPServer = Class(TServerClient) TNNTPServer = Class(TServerClient)
@ -32,7 +33,7 @@ Type
CurArticle : LongInt; CurArticle : LongInt;
EndSession : Boolean; EndSession : Boolean;
Constructor Create (Owner: TServerManager; CliSock: TSocketClass); Constructor Create (Owner: TServerManager; CliSock: TIOSocket);
Procedure Execute; Override; Procedure Execute; Override;
Destructor Destroy; Override; Destructor Destroy; Override;
@ -70,12 +71,12 @@ Const
re_Unknown = '500 Unknown command'; re_Unknown = '500 Unknown command';
re_UnknownOption = '501 Unknown option'; re_UnknownOption = '501 Unknown option';
Function CreateNNTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TSocketClass) : TServerClient; Function CreateNNTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TIOSocket) : TServerClient;
Begin Begin
Result := TNNTPServer.Create(Owner, CliSock); Result := TNNTPServer.Create(Owner, CliSock);
End; End;
Constructor TNNTPServer.Create (Owner: TServerManager; CliSock: TSocketClass); Constructor TNNTPServer.Create (Owner: TServerManager; CliSock: TIOSocket);
Begin Begin
Inherited Create(Owner, CliSock); Inherited Create(Owner, CliSock);

View File

@ -12,9 +12,10 @@ Uses
MD5, MD5,
Classes, Classes,
SysUtils, SysUtils,
m_io_Base,
m_io_Sockets,
m_Strings, m_Strings,
m_FileIO, m_FileIO,
m_Socket_Class,
m_DateTime, m_DateTime,
MIS_Server, MIS_Server,
MIS_NodeData, MIS_NodeData,
@ -23,7 +24,7 @@ Uses
BBS_MsgBase_JAM, BBS_MsgBase_JAM,
BBS_MsgBase_Squish; BBS_MsgBase_Squish;
Function CreatePOP3 (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TSocketClass) : TServerClient; Function CreatePOP3 (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TIOSocket) : TServerClient;
Const Const
MaxMailBoxSize = 1000; MaxMailBoxSize = 1000;
@ -50,7 +51,7 @@ Type
MailInfo : Array[1..MaxMailBoxSize] of PMailMessageRec; MailInfo : Array[1..MaxMailBoxSize] of PMailMessageRec;
MailSize : LongInt; MailSize : LongInt;
Constructor Create (Owner: TServerManager; CliSock: TSocketClass); Constructor Create (Owner: TServerManager; CliSock: TIOSocket);
Procedure Execute; Override; Procedure Execute; Override;
Destructor Destroy; Override; Destructor Destroy; Override;
@ -91,12 +92,12 @@ Const
re_ResetOK = re_OK + 'Messages reset'; re_ResetOK = re_OK + 'Messages reset';
re_MsgDeleted = re_OK + 'Message deleted'; re_MsgDeleted = re_OK + 'Message deleted';
Function CreatePOP3 (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TSocketClass) : TServerClient; Function CreatePOP3 (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TIOSocket) : TServerClient;
Begin Begin
Result := TPOP3Server.Create(Owner, CliSock); Result := TPOP3Server.Create(Owner, CliSock);
End; End;
Constructor TPOP3Server.Create (Owner: TServerManager; CliSock: TSocketClass); Constructor TPOP3Server.Create (Owner: TServerManager; CliSock: TIOSocket);
Begin Begin
Inherited Create(Owner, CliSock); Inherited Create(Owner, CliSock);

View File

@ -10,9 +10,10 @@ Interface
Uses Uses
Classes, Classes,
SysUtils, SysUtils,
m_io_Base,
m_io_Sockets,
m_Strings, m_Strings,
m_FileIO, m_FileIO,
m_Socket_Class,
m_DateTime, m_DateTime,
bbs_MsgBase_ABS, bbs_MsgBase_ABS,
bbs_MsgBase_JAM, bbs_MsgBase_JAM,
@ -21,7 +22,7 @@ Uses
MIS_NodeData, MIS_NodeData,
MIS_Common; MIS_Common;
Function CreateSMTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TSocketClass) : TServerClient; Function CreateSMTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TIOSocket) : TServerClient;
Type Type
TSMTPServer = Class(TServerClient) TSMTPServer = Class(TServerClient)
@ -35,7 +36,7 @@ Type
FromPos : LongInt; FromPos : LongInt;
ToList : TStringList; ToList : TStringList;
Constructor Create (Owner: TServerManager; CliSock: TSocketClass); Constructor Create (Owner: TServerManager; CliSock: TIOSocket);
Procedure Execute; Override; Procedure Execute; Override;
Destructor Destroy; Override; Destructor Destroy; Override;
@ -62,12 +63,12 @@ Const
re_NeedRcpt = '503 Must send RCPT TO: first'; re_NeedRcpt = '503 Must send RCPT TO: first';
re_ErrorSending = '550 Mailbox not found'; re_ErrorSending = '550 Mailbox not found';
Function CreateSMTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TSocketClass) : TServerClient; Function CreateSMTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TIOSocket) : TServerClient;
Begin Begin
Result := TSMTPServer.Create(Owner, CliSock); Result := TSMTPServer.Create(Owner, CliSock);
End; End;
Constructor TSMTPServer.Create (Owner: TServerManager; CliSock: TSocketClass); Constructor TSMTPServer.Create (Owner: TServerManager; CliSock: TIOSocket);
Begin Begin
Inherited Create(Owner, CliSock); Inherited Create(Owner, CliSock);

View File

@ -15,32 +15,33 @@ Uses
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
Windows, Windows,
{$ENDIF} {$ENDIF}
m_io_Base,
m_io_Sockets,
m_Strings, m_Strings,
m_Socket_Class,
MIS_Common, MIS_Common,
MIS_NodeData, MIS_NodeData,
MIS_Server; MIS_Server;
Function CreateTelnet (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TSocketClass) : TServerClient; Function CreateTelnet (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TIOSocket) : TServerClient;
{ must match server create or there will be access violations } { must match server create or there will be access violations }
Type Type
TTelnetServer = Class(TServerClient) TTelnetServer = Class(TServerClient)
ND : TNodeData; ND : TNodeData;
Snooping : Boolean; Snooping : Boolean;
Constructor Create (Owner: TServerManager; ND: TNodeData; CliSock: TSocketClass); Constructor Create (Owner: TServerManager; ND: TNodeData; CliSock: TIOSocket);
Procedure Execute; Override; Procedure Execute; Override;
Destructor Destroy; Override; Destructor Destroy; Override;
End; End;
Implementation Implementation
Function CreateTelnet (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TSocketClass) : TServerClient; Function CreateTelnet (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TIOSocket) : TServerClient;
Begin Begin
Result := TTelnetServer.Create(Owner, ND, CliSock); Result := TTelnetServer.Create(Owner, ND, CliSock);
End; End;
Constructor TTelnetServer.Create (Owner: TServerManager; ND: TNodeData; CliSock: TSocketClass); Constructor TTelnetServer.Create (Owner: TServerManager; ND: TNodeData; CliSock: TIOSocket);
Begin Begin
Inherited Create(Owner, CliSock); Inherited Create(Owner, CliSock);

View File

@ -6,7 +6,8 @@ Interface
Uses Uses
Classes, Classes,
m_Socket_Class, m_io_Base,
m_io_Sockets,
MIS_Common, MIS_Common,
MIS_NodeData; MIS_NodeData;
@ -16,12 +17,12 @@ Const
Type Type
TServerManager = Class; TServerManager = Class;
TServerClient = Class; TServerClient = Class;
TServerCreateProc = Function (Manager: TServerManager; Config: RecConfig; ND: TNodeData; Client: TSocketClass): TServerClient; TServerCreateProc = Function (Manager: TServerManager; Config: RecConfig; ND: TNodeData; Client: TIOSocket): TServerClient;
TServerManager = Class(TThread) TServerManager = Class(TThread)
Critical : TRTLCriticalSection; Critical : TRTLCriticalSection;
NodeInfo : TNodeData; NodeInfo : TNodeData;
Server : TSocketClass; Server : TIOSocket;
ServerStatus : TStringList; ServerStatus : TStringList;
StatusUpdated : Boolean; StatusUpdated : Boolean;
ClientList : TList; ClientList : TList;
@ -41,15 +42,15 @@ Type
Procedure Execute; Override; Procedure Execute; Override;
Procedure Status (Str: String); Procedure Status (Str: String);
Function CheckIP (IP, Mask: String) : Boolean; Function CheckIP (IP, Mask: String) : Boolean;
Function IsBlockedIP (Var Client: TSocketClass) : Boolean; Function IsBlockedIP (Var Client: TIOSocket) : Boolean;
Function DuplicateIPs (Var Client: TSocketClass) : Byte; Function DuplicateIPs (Var Client: TIOSocket) : Byte;
End; End;
TServerClient = Class(TThread) TServerClient = Class(TThread)
Client : TSocketClass; Client : TIOSocket;
Manager : TServerManager; Manager : TServerManager;
Constructor Create (Owner: TServerManager; CliSock: TSocketClass); Constructor Create (Owner: TServerManager; CliSock: TIOSocket);
Destructor Destroy; Override; Destructor Destroy; Override;
End; End;
@ -75,7 +76,7 @@ Begin
ClientActive := 0; ClientActive := 0;
ClientMaxIPs := 1; ClientMaxIPs := 1;
NewClientProc := CreateProc; NewClientProc := CreateProc;
Server := TSocketClass.Create; Server := TIOSocket.Create;
ServerStatus := TStringList.Create; ServerStatus := TStringList.Create;
StatusUpdated := False; StatusUpdated := False;
ClientList := TList.Create; ClientList := TList.Create;
@ -122,7 +123,7 @@ Begin
End; End;
End; End;
Function TServerManager.IsBlockedIP (Var Client: TSocketClass) : Boolean; Function TServerManager.IsBlockedIP (Var Client: TIOSocket) : Boolean;
Var Var
TF : Text; TF : Text;
Str : String; Str : String;
@ -146,16 +147,26 @@ Begin
End; End;
End; End;
Function TServerManager.DuplicateIPs (Var Client: TSocketClass) : Byte; Function TServerManager.DuplicateIPs (Var Client: TIOSocket) : Byte;
Var Var
Count : Byte; Count : Byte;
Begin Begin
Result := 0; Result := 0;
(*
For Count := 0 to ClientMax - 1 Do For Count := 0 to ClientMax - 1 Do
If ClientList[Count] <> NIL Then // use Assigned? If ClientList[Count] <> NIL Then // use Assigned?
If Client.PeerIP = TSocketClass(ClientList[Count]).PeerIP Then If Client.PeerIP = TIOSocket(ClientList[Count]).PeerIP Then
Inc(Result);*)
For Count := 0 to ClientMax - 1 Do
If Assigned(ClientList[Count]) Then Begin
// writeln('client ip:', client.peerip);
// writeln('comp ip :', TIOSocket(clientlist[count]).fpeerip);
// waitms(3000);
If Client.PeerIP = TIOSocket(ClientList[Count]).PeerIP Then
Inc(Result); Inc(Result);
End;
End; End;
Procedure TServerManager.Status (Str: String); Procedure TServerManager.Status (Str: String);
@ -193,7 +204,7 @@ End;
Procedure TServerManager.Execute; Procedure TServerManager.Execute;
Var Var
NewClient : TSocketClass; NewClient : TIOSocket;
Begin Begin
Repeat Until Server <> NIL; // Synchronize with server class Repeat Until Server <> NIL; // Synchronize with server class
Repeat Until ServerStatus <> NIL; // Syncronize with status class Repeat Until ServerStatus <> NIL; // Syncronize with status class
@ -224,7 +235,7 @@ Begin
If Not NewClient.WriteFile(TextPath + 'blocked.txt') Then NewClient.WriteLine('BLOCKED'); If Not NewClient.WriteFile(TextPath + 'blocked.txt') Then NewClient.WriteLine('BLOCKED');
NewClient.Free; NewClient.Free;
End Else End Else
If (ClientMaxIPs > 0) and (DuplicateIPs(NewClient) > ClientMaxIPs) Then Begin If (ClientMaxIPs > 0) and (DuplicateIPs(NewClient) >= ClientMaxIPs) Then Begin
Inc (ClientRefused); Inc (ClientRefused);
Status('MULTI: ' + NewClient.PeerIP + ' (' + NewClient.PeerName + ')'); Status('MULTI: ' + NewClient.PeerIP + ' (' + NewClient.PeerName + ')');
If Not NewClient.WriteFile(TextPath + 'dupeip.txt') Then NewClient.WriteLine('Only ' + strI2S(ClientMaxIPs) + ' connection(s) per user'); If Not NewClient.WriteFile(TextPath + 'dupeip.txt') Then NewClient.WriteLine('Only ' + strI2S(ClientMaxIPs) + ' connection(s) per user');
@ -273,7 +284,7 @@ Begin
Inherited Destroy; Inherited Destroy;
End; End;
Constructor TServerClient.Create (Owner: TServerManager; CliSock: TSocketClass); Constructor TServerClient.Create (Owner: TServerManager; CliSock: TIOSocket);
Var Var
Count : Byte; Count : Byte;
Begin Begin

View File

@ -43,9 +43,11 @@ Var
SecsPast, DaysPast: LongInt; SecsPast, DaysPast: LongInt;
Begin Begin
DateG2J (DT.Year, DT.Month, DT.Day, DaysPast); DateG2J (DT.Year, DT.Month, DT.Day, DaysPast);
DaysPast := DaysPast - DATEc1970; DaysPast := DaysPast - DATEc1970;
SecsPast := DaysPast * 86400; SecsPast := DaysPast * 86400;
SecsPast := SecsPast + (LongInt(DT.Hour) * 3600) + (DT.Min * 60) + (DT.Sec); SecsPast := SecsPast + (LongInt(DT.Hour) * 3600) + (DT.Min * 60) + (DT.Sec);
DTToUnixDate := SecsPast; DTToUnixDate := SecsPast;
End; End;
@ -114,40 +116,36 @@ Function SaveFile(FN: String; Var Rec; FS: Word): Word;
Procedure Str2Az(Str: String; MaxLen: Byte; Var AZStr); {Convert string to asciiz} Procedure Str2Az(Str: String; MaxLen: Byte; Var AZStr); {Convert string to asciiz}
Begin Begin
If Length(Str) >= MaxLen Then If Length(Str) >= MaxLen Then Begin
Begin Str[MaxLen] := #0;
Str[MaxLen] := #0; Move(Str[1], AZStr, MaxLen);
Move(Str[1], AZStr, MaxLen); End Else Begin
End Str[Length(Str) + 1] := #0;
Else Move(Str[1], AZStr, Length(Str) + 1);
Begin End;
Str[Length(Str) + 1] := #0; End;
Move(Str[1], AZStr, Length(Str) + 1);
End;
End;
Function MonthStr(MonthNo: Word): String; Function MonthStr(MonthNo: Word): String;
Begin Begin
Case MonthNo of Case MonthNo of
01: MonthStr := 'Jan'; 01: MonthStr := 'Jan';
02: MonthStr := 'Feb'; 02: MonthStr := 'Feb';
03: MonthStr := 'Mar'; 03: MonthStr := 'Mar';
04: MonthStr := 'Apr'; 04: MonthStr := 'Apr';
05: MonthStr := 'May'; 05: MonthStr := 'May';
06: MonthStr := 'Jun'; 06: MonthStr := 'Jun';
07: MonthStr := 'Jul'; 07: MonthStr := 'Jul';
08: MonthStr := 'Aug'; 08: MonthStr := 'Aug';
09: MonthStr := 'Sep'; 09: MonthStr := 'Sep';
10: MonthStr := 'Oct'; 10: MonthStr := 'Oct';
11: MonthStr := 'Nov'; 11: MonthStr := 'Nov';
12: MonthStr := 'Dec'; 12: MonthStr := 'Dec';
Else Else
MonthStr := '???'; MonthStr := '???';
End; End;
End; End;
Function FormattedDate(DT: DateTime; Mask: String): String; Function FormattedDate(DT: DateTime; Mask: String): String;
Var Var
DStr : String[2]; DStr : String[2];

View File

@ -28,6 +28,10 @@ Uses
HeapTrc, HeapTrc,
LineInfo, LineInfo,
{$ENDIF} {$ENDIF}
{$IFDEF WINDOWS}
m_io_Base,
m_io_Sockets,
{$ENDIF}
{$IFDEF UNIX} {$IFDEF UNIX}
BaseUnix, BaseUnix,
{$ENDIF} {$ENDIF}
@ -411,7 +415,7 @@ Begin
Session.LocalMode := Session.CommHandle = -1; Session.LocalMode := Session.CommHandle = -1;
If Not Session.LocalMode Then Begin If Not Session.LocalMode Then Begin
Session.Client.FSocketHandle := Session.CommHandle; TIOSocket(Session.Client).FSocketHandle := Session.CommHandle;
Session.io.LocalScreenDisable; Session.io.LocalScreenDisable;
End; End;

View File

@ -19,10 +19,15 @@ BUGS AND POSSIBLE ISSUES
FPC BUG? DirAttr is suspect in MPL is it 1 byte or 4 in size? FPC BUG? DirAttr is suspect in MPL is it 1 byte or 4 in size?
! View archive not working if its external view? [Griffin] ! View archive not working if its external view? [Griffin]
! Message header does not ackknowledge user's date format. ! Message header does not ackknowledge user's date format.
! Test MIS blocking features or just rewrite MIS completely.
! AllFiles/NewFiles not properly prompting to zip and download.
! Check multiple BBS list functionality.
FUTURE / IDEAS / WORK IN PROGRESS / NOTES FUTURE / IDEAS / WORK IN PROGRESS / NOTES
========================================= =========================================
- BBS email autoforwarded to Internet email
- Ability to send internet email to people from within the BBS.
- ANSI post-processor for message uploads via FSE - ANSI post-processor for message uploads via FSE
- ANSI reading support in fullscreen reader - ANSI reading support in fullscreen reader
- Ability to override read-type per message base (usersetting/normal/lightbar) - Ability to override read-type per message base (usersetting/normal/lightbar)