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
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;
CommHandle := -1;
LocalMode := False;
Baud := -1;
Baud := 38400;
ExitLevel := 0;
EventWarn := False;
EventExit := False;
EventRunAfter := False;
NodeNum := 1;
NodeNum := 0;
UserHostInfo := '';
UserIPInfo := '';
CheckTimeOut := True;

View File

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

View File

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

View File

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

View File

@ -25,6 +25,8 @@ Type
Constructor Create (Nodes: Byte);
Destructor Destroy; Override;
Procedure SynchronizeNodeData;
Function GetNodeTotal : LongInt;
Function GetNodeInfo (Num: Byte; Var NI: TNodeInfoRec): Boolean;
Procedure SetNodeInfo (Num: Byte; NI: TNodeInfoRec);
@ -37,6 +39,32 @@ Uses
m_FileIO,
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;
Var
Count : LongInt;
@ -103,6 +131,8 @@ Begin
For Count := 1 to NodeTotal Do
NodeInfo[Count].Num := Count;
SynchronizeNodeData;
End;
Destructor TNodeData.Destroy;

View File

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

View File

@ -21,10 +21,12 @@ BUGS AND POSSIBLE ISSUES
! Test MIS blocking features or just rewrite MIS completely.
! Test midnight rollovers for time (flag for user to be immune to timecheck)
! 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
=========================================
- Add better MIS logging per server (connect, refuse, blocked, etc)
- 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