MIS nodenumber fix, Mystic auto generates node in Windows

This commit is contained in:
mysticbbs 2012-09-02 21:14:10 -04:00
parent 4b3c767f86
commit 6562c7a510
8 changed files with 101 additions and 58 deletions

View File

@ -4708,3 +4708,18 @@
! Fixed a bug which could sometimes cause a node to get disconnected just ! Fixed a bug which could sometimes cause a node to get disconnected just
after MIS answered the all in Windows. after MIS answered the all in Windows.
+ If the user has zero downloads and uploads, Mystic will now allow them to
transfer one file for "free" (either a download or an upload) before the
ratio tracking comes into play.
! Sysop chat hours now function as expected. This was broken somewhere
around the 1.09 era.
! Fixed bugs with MIS calculating the wrong node number if a user was
logged in locally in Windows.
+ Mystic in non-Unix will not assign an available node number automatically
similar to how it works in a Unix environment. This will help prevent
a person from accidentally logging into a node that is being used during
a local login.

View File

@ -112,12 +112,12 @@ Begin
ShutDown := False; ShutDown := False;
CommHandle := -1; CommHandle := -1;
LocalMode := False; LocalMode := False;
Baud := -1; Baud := 38400;
ExitLevel := 0; ExitLevel := 0;
EventWarn := False; EventWarn := False;
EventExit := False; EventExit := False;
EventRunAfter := False; EventRunAfter := False;
NodeNum := 1; NodeNum := 0;
UserHostInfo := ''; UserHostInfo := '';
UserIPInfo := ''; UserIPInfo := '';
CheckTimeOut := True; CheckTimeOut := True;

View File

@ -1203,7 +1203,7 @@ Var
Addr : RecEchoMailAddr; Addr : RecEchoMailAddr;
Begin Begin
Result := False; Result := False;
Session.User.IgnoreGroup := True; Session.User.IgnoreGroup := True;
Repeat Repeat
If IsCopy Then If IsCopy Then

View File

@ -110,6 +110,7 @@ Begin
DirChange(bbsConfig.SystemPath); DirChange(bbsConfig.SystemPath);
End; End;
(*
Procedure ReadChatData; Procedure ReadChatData;
Var Var
ChatFile : File of ChatRec; ChatFile : File of ChatRec;
@ -137,6 +138,7 @@ Begin
End; End;
End; End;
End; End;
*)
Function GetFocusPtr : TServerManager; Function GetFocusPtr : TServerManager;
Begin Begin
@ -160,7 +162,7 @@ Var
Begin Begin
If FocusPtr = NIL Then Exit; If FocusPtr = NIL Then Exit;
ReadChatData; NodeData.SynchronizeNodeData;
PosY := 0; PosY := 0;
@ -172,7 +174,7 @@ Begin
If Count = BarPos Then Attr := 31 Else Attr := 7; If Count = BarPos Then Attr := 31 Else Attr := 7;
Case FocusCurrent of Case FocusCurrent of
0 : If (Count <= FocusPtr.ClientList.Count) And (FocusPtr.ClientList[Count - 1] <> NIL) Then Begin 0 : If NI.Busy Then Begin
Console.WriteXY (3, 3 + PosY, Attr, Console.WriteXY (3, 3 + PosY, Attr,
strPadL(strI2S(NI.Num), 3, '0') + ' ' + strPadL(strI2S(NI.Num), 3, '0') + ' ' +
strPadR(NI.User, 12, ' ') + ' ' + strPadR(NI.User, 12, ' ') + ' ' +

View File

@ -106,14 +106,11 @@ End;
{$IFDEF UNIX} {$IFDEF UNIX}
Procedure TTelnetServer.Execute; Procedure TTelnetServer.Execute;
Const
BufferSize = 4096;
Var Var
Cmd : String; Cmd : String;
Num : LongInt; Num : LongInt;
NI : TNodeInfoRec; NI : TNodeInfoRec;
Proc : TProcess; Proc : TProcess;
// Buffer : Array[1..BufferSize] of Char;
Buffer : TIOBuffer; Buffer : TIOBuffer;
bRead : LongInt; bRead : LongInt;
bWrite : LongInt; bWrite : LongInt;
@ -141,15 +138,12 @@ Begin
While Proc.Running Do Begin While Proc.Running Do Begin
If Proc.Output.NumBytesAvailable > 0 Then Begin If Proc.Output.NumBytesAvailable > 0 Then Begin
While Proc.Output.NumBytesAvailable > 0 Do Begin While Proc.Output.NumBytesAvailable > 0 Do Begin
bRead := Proc.Output.Read(Buffer, BufferSize); bRead := Proc.Output.Read(Buffer, TIOBufferSize);
Client.WriteBufEscaped (Buffer, bRead); Client.WriteBufEscaped (Buffer, bRead);
// If Snooping Then
// Term.ProcessBuf(Buffer[0], bRead);
End; End;
End Else End Else
If Client.DataWaiting Then Begin If Client.DataWaiting Then Begin
bWrite := Client.ReadBuf(Buffer, BufferSize); bWrite := Client.ReadBuf(Buffer, TIOBufferSize);
If bWrite < 0 Then Break; If bWrite < 0 Then Break;

View File

@ -25,6 +25,8 @@ Type
Constructor Create (Nodes: Byte); Constructor Create (Nodes: Byte);
Destructor Destroy; Override; Destructor Destroy; Override;
Procedure SynchronizeNodeData;
Function GetNodeTotal : LongInt; Function GetNodeTotal : LongInt;
Function GetNodeInfo (Num: Byte; Var NI: TNodeInfoRec): Boolean; Function GetNodeInfo (Num: Byte; Var NI: TNodeInfoRec): Boolean;
Procedure SetNodeInfo (Num: Byte; NI: TNodeInfoRec); Procedure SetNodeInfo (Num: Byte; NI: TNodeInfoRec);
@ -37,6 +39,32 @@ Uses
m_FileIO, m_FileIO,
m_Strings; m_Strings;
Procedure TNodeData.SynchronizeNodeData;
Var
ChatFile : File of ChatRec;
Chat : ChatRec;
Count : LongInt;
NI : TNodeInfoRec;
Begin
For Count := 1 to NodeTotal Do Begin
GetNodeInfo(Count, NI);
Assign (ChatFile, bbsConfig.DataPath + 'chat' + strI2S(NI.Num) + '.dat');
If ioReset(ChatFile, SizeOf(ChatRec), fmRWDN) Then Begin
ioRead (ChatFile, Chat);
Close (ChatFile);
NI.Busy := Chat.Active;
NI.User := Chat.Name;
NI.Action := Chat.Action;
End Else
NI.Busy := False;
SetNodeInfo(NI.Num, NI);
End;
End;
Function TNodeData.GetFreeNode : LongInt; Function TNodeData.GetFreeNode : LongInt;
Var Var
Count : LongInt; Count : LongInt;
@ -103,6 +131,8 @@ Begin
For Count := 1 to NodeTotal Do For Count := 1 to NodeTotal Do
NodeInfo[Count].Num := Count; NodeInfo[Count].Num := Count;
SynchronizeNodeData;
End; End;
Destructor TNodeData.Destroy; Destructor TNodeData.Destroy;

View File

@ -155,6 +155,33 @@ Begin
End; End;
End; End;
Procedure CalculateNodeNumber;
Var
Count : Word;
TChat : ChatRec;
Begin
Session.NodeNum := 0;
For Count := 1 to Config.INetTNNodes Do Begin
Assign (ChatFile, Config.DataPath + 'chat' + strI2S(Count) + '.dat');
If Not ioReset (ChatFile, Sizeof(ChatRec), fmRWDN) Then Begin
Session.NodeNum := Count;
Break;
End Else Begin
ioRead (ChatFile, TChat);
Close (ChatFile);
If Not TChat.Active Then Begin
Session.NodeNum := Count;
Break;
End;
End;
End;
End;
{$IFDEF UNIX} {$IFDEF UNIX}
Procedure LinuxEventSignal (Sig : LongInt); cdecl; Procedure LinuxEventSignal (Sig : LongInt); cdecl;
Begin Begin
@ -179,10 +206,9 @@ Begin
End; End;
End; End;
Procedure Linux_Init; Procedure InitializeUnix;
Var Var
Count : Word; Count : Word;
TChat : ChatRec;
Info : Stat; Info : Stat;
Begin Begin
If fpStat('mystic', Info) = 0 Then Begin If fpStat('mystic', Info) = 0 Then Begin
@ -190,35 +216,6 @@ Begin
fpSetUID (Info.st_UID); fpSetUID (Info.st_UID);
End; End;
Session.NodeNum := 0;
For Count := 1 to Config.INetTNNodes Do Begin
Assign (ChatFile, Config.DataPath + 'chat' + strI2S(Count) + '.dat');
{$I-} Reset(ChatFile); {$I+}
If IoResult <> 0 Then Begin
Session.NodeNum := Count;
Break;
End;
Read (ChatFile, TChat);
Close (ChatFile);
If Not TChat.Active Then Begin
Session.NodeNum := Count;
Break;
End;
End;
If Session.NodeNum = 0 Then Begin
WriteLn ('BUSY'); {++lang}
DisposeClasses;
Halt;
End;
fpSignal (SIGTERM, LinuxEventSignal); fpSignal (SIGTERM, LinuxEventSignal);
fpSignal (SIGHUP, LinuxEventSignal); fpSignal (SIGHUP, LinuxEventSignal);
@ -371,14 +368,12 @@ Begin
For Count := 1 to ParamCount Do Begin For Count := 1 to ParamCount Do Begin
Temp := strUpper(ParamStr(Count)); Temp := strUpper(ParamStr(Count));
If Copy(Temp, 1, 4) = '-TID' Then Begin If Copy(Temp, 1, 4) = '-TID' Then
Session.CommHandle := strS2I(Copy(Temp, 5, Length(Temp))); Session.CommHandle := strS2I(Copy(Temp, 5, Length(Temp)))
Session.Baud := 38400; Else
End Else If Copy(Temp, 1, 2) = '-B' Then
If Copy(Temp, 1, 2) = '-B' Then Begin Session.Baud := strS2I(Copy(Temp, 3, Length(Temp)))
Session.Baud := strS2I(Copy(Temp, 3, Length(Temp))); Else
If Session.Baud = 0 Then Session.LocalMode := True;
End Else
If Copy(Temp, 1, 2) = '-T' Then If Copy(Temp, 1, 2) = '-T' Then
Session.TimeOffset := strS2I(Copy(Temp, 3, Length(Temp))) Session.TimeOffset := strS2I(Copy(Temp, 3, Length(Temp)))
Else Else
@ -411,13 +406,20 @@ Begin
If Temp = '-L' Then Session.LocalMode := True; If Temp = '-L' Then Session.LocalMode := True;
End; End;
FileMode := 66;
{$IFDEF UNIX} {$IFDEF UNIX}
Linux_Init; InitializeUnix;
Session.Baud := 38400;
{$ENDIF} {$ENDIF}
If Session.NodeNum = 0 Then CalculateNodeNumber;
If Session.NodeNum = 0 Then Begin
WriteLn ('BUSY');
DisposeClasses;
Halt;
End;
CheckPathsAndDataFiles; CheckPathsAndDataFiles;
{$IFNDEF UNIX} {$IFNDEF UNIX}
@ -450,8 +452,6 @@ Begin
Else Else
Session.SetTimeLeft(Config.LoginTime); Session.SetTimeLeft(Config.LoginTime);
If Session.Baud = -1 Then Session.Baud := 0;
{$IFNDEF UNIX} {$IFNDEF UNIX}
Screen.TextAttr := 7; Screen.TextAttr := 7;
Screen.ClearScreen; Screen.ClearScreen;

View File

@ -21,10 +21,12 @@ BUGS AND POSSIBLE ISSUES
! Test MIS blocking features or just rewrite MIS completely. ! Test MIS blocking features or just rewrite MIS completely.
! Test midnight rollovers for time (flag for user to be immune to timecheck) ! Test midnight rollovers for time (flag for user to be immune to timecheck)
! Elasped time will need to be recalculated based on flag above ^^ ! Elasped time will need to be recalculated based on flag above ^^
! Validate that "groupX.ans" and "fgroupX.ans" actually work.
FUTURE / IDEAS / WORK IN PROGRESS / NOTES FUTURE / IDEAS / WORK IN PROGRESS / NOTES
========================================= =========================================
- Add better MIS logging per server (connect, refuse, blocked, etc)
- BBS email autoforwarded to Internet email - BBS email autoforwarded to Internet email
- Ability to send internet email to people from within the BBS. - 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