From d2ce4ec45c279920fbf492ed4e4e97d451cc3b0e Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Thu, 8 Mar 2012 16:38:44 -0500 Subject: [PATCH] Node message changes, and a few other minor things --- mystic/HISTORY.txt | 28 ++++++++++++- mystic/bbs_cfg_menuedit.pas | 2 + mystic/bbs_core.pas | 9 +++++ mystic/bbs_io.pas | 20 +++++++--- mystic/bbs_menus.pas | 4 +- mystic/bbs_msgbase.pas | 6 --- mystic/bbs_nodechat.pas | 3 +- mystic/bbs_nodeinfo.pas | 80 +++++++++++++++++++++++-------------- mystic/bbs_sysopchat.pas | 2 +- mystic/mystic.pas | 39 +++++++++--------- mystic/records.pas | 17 ++++---- mystic/todo.pas | 4 ++ 12 files changed, 141 insertions(+), 73 deletions(-) diff --git a/mystic/HISTORY.txt b/mystic/HISTORY.txt index 4c91697..c40c862 100644 --- a/mystic/HISTORY.txt +++ b/mystic/HISTORY.txt @@ -3953,7 +3953,7 @@ system. It of course is still possible to use the Theme system to create support for different languages as well. - Additionally, compile prompt files that used to have the .LNG file + Additionally, compiled prompt files that used to have the .LNG file extension have been renamed to .THM extension. The upgrade utility should take care of all this renaming for you. @@ -3999,3 +3999,29 @@ + Mystic now has 10 colors definable per theme, with 10 new MCI codes |T0 to |T9 to display them. + + + Mystic's internal Language editor has now been replaced with a theme + editor. This editor is full ANSI lightbar-capable like other newer + configurations. It can also edit all prompts and compile prompt files + all internally. It support at least the features of the old MCFG editor + including prompt text search, jumping, copy/paste, undo, etc. + + + Mystic now checks for messages between nodes every 3 seconds while waiting + for input. Previously Mystic would check based on situation (ie, before + menu prompt, in between messages, etc) but never while idle waiting on + input as it does now. + + ! Mystic was not allowing node messages within MPL programs. It is not clear + if this was introduced in the 1.10 alphas or if the problem existed in the + past. + + + Mystic now saves and restores the user's screen before and after showing a + node message. You can now place a clear screen comfortably in those + prompts to make a really clean look when users are interrupted with node + messages. + + + Mystic now has less chance of a "ghost" user situation occuring in Linux. + + + MIS Linux can now accept telnet connections and properly redirect STDIO + while spawning Mystic. This means it can entirely replace a Linux + telnet daemon if desired. It has had little testing though at the moment. diff --git a/mystic/bbs_cfg_menuedit.pas b/mystic/bbs_cfg_menuedit.pas index 2d26057..45cc7a9 100644 --- a/mystic/bbs_cfg_menuedit.pas +++ b/mystic/bbs_cfg_menuedit.pas @@ -231,6 +231,8 @@ Var DirInfo: SearchRec; A : Byte; {format dir output} Begin + If session.lang.filename = '' then exit; + Old := Session.Menu.MenuName; OldLang := Session.Lang; Session.SystemLog ('*MENU EDITOR*'); diff --git a/mystic/bbs_core.pas b/mystic/bbs_core.pas index c5e38d4..6645501 100644 --- a/mystic/bbs_core.pas +++ b/mystic/bbs_core.pas @@ -17,6 +17,9 @@ Uses BBS_Menus, MPL_Execute; +Const + mysMessageThreshold = 3; + Type TBBSCore = Class User : TBBSUser; @@ -53,6 +56,9 @@ Type TimeChecked : Boolean; ConfigMode : Boolean; InUserEdit : Boolean; + AllowMessages : Boolean; + InMessage : Boolean; + MessageCheck : Byte; HistoryFile : File of RecHistory; HistoryEmails : Word; HistoryPosts : Word; @@ -110,6 +116,9 @@ Begin TimeChecked := False; ConfigMode := False; InUserEdit := False; + AllowMessages := True; + InMessage := False; + MessageCheck := mysMessageThreshold; {$IFDEF WINDOWS} Client := TSocketClass.Create; diff --git a/mystic/bbs_io.pas b/mystic/bbs_io.pas index c71c7c0..6369992 100644 --- a/mystic/bbs_io.pas +++ b/mystic/bbs_io.pas @@ -109,7 +109,8 @@ Implementation Uses DOS, bbs_Core, - bbs_General; + bbs_General, + bbs_NodeInfo; Constructor TBBSIO.Create (Var Owner: Pointer); Begin @@ -261,8 +262,6 @@ Begin OutFull (TBBSCore(Core).GetPrompt(132)); - PurgeInputBuffer; - Ch := OneKey('YNC' + #13, False); OutBS (Screen.CursorX, True); @@ -1251,6 +1250,16 @@ Begin Halt(0); End; + If Session.AllowMessages And Not Session.InMessage Then Begin + Dec (Session.MessageCheck); + + If Session.MessageCheck = 0 Then Begin + CheckNodeMessages; + + Session.MessageCheck := mysMessageThreshold; + End; + End; + TimeCount := TBBSCore(Core).TimeLeft; If TimeCount <> Session.LastTimeLeft Then Begin @@ -1743,8 +1752,9 @@ Begin Percent := Round(Part / Whole * 100); End; - DrawPercent := Attr2Ansi(Bar.HiAttr) + strRep(Bar.HiChar, FillSize) + - Attr2Ansi(Bar.LoAttr) + strRep(Bar.LoChar, Bar.BarLength - FillSize); + Result := Attr2Ansi(Bar.HiAttr) + strRep(Bar.HiChar, FillSize) + + Attr2Ansi(Bar.LoAttr) + strRep(Bar.LoChar, Bar.BarLength - FillSize) + + Attr2Ansi(7); End; {$IFDEF UNIX} diff --git a/mystic/bbs_menus.pas b/mystic/bbs_menus.pas index a67f4d6..0bfd1e5 100644 --- a/mystic/bbs_menus.pas +++ b/mystic/bbs_menus.pas @@ -41,6 +41,7 @@ Uses bbs_User, bbs_NodeChat, bbs_NodeInfo, + bbs_UserChat, bbs_ansi_Help, MPL_Execute, bbs_cfg_MenuEdit, @@ -258,6 +259,7 @@ Begin 'N' : Case Cmd[2] of 'A' : Set_Node_Action (Data); 'C' : Node_Chat; + 'P' : PageUserForChat; 'S' : Send_Node_Message (3, Data, 0); 'W' : Show_Whos_Online; End; @@ -794,8 +796,6 @@ Begin Set_Node_Action (Session.GetPrompt(346)); - CheckNodeMessages; - Keys := #13; ExtKeys := ''; diff --git a/mystic/bbs_msgbase.pas b/mystic/bbs_msgbase.pas index a4aec11..78cfa0b 100644 --- a/mystic/bbs_msgbase.pas +++ b/mystic/bbs_msgbase.pas @@ -1429,8 +1429,6 @@ Var Ansi_View_Message := False; Repeat - CheckNodeMessages; - Set_Node_Action (Session.GetPrompt(348)); Set_Message_Security; @@ -1733,8 +1731,6 @@ Var Procedure FullReDraw; Begin - CheckNodeMessages; - Session.io.OutFile (MBase.ITemplate, True, 0); PageSize := Session.io.ScreenInfo[2].Y - Session.io.ScreenInfo[1].Y + 1; @@ -2064,8 +2060,6 @@ Var Session.io.AllowPause := False; Repeat - CheckNodeMessages; - Session.io.PromptInfo[1] := strI2S(MsgBase^.GetMsgNum); Session.io.PromptInfo[2] := strI2S(MsgBase^.GetHighMsgNum); diff --git a/mystic/bbs_nodechat.pas b/mystic/bbs_nodechat.pas index c7d349d..88a0635 100644 --- a/mystic/bbs_nodechat.pas +++ b/mystic/bbs_nodechat.pas @@ -86,7 +86,7 @@ Begin Session.io.OutRaw (strPadR(Room.Name, 40, ' ')); End; -Function GetKeyNodeChatFunc (Forced : Boolean) : Boolean; +Function GetKeyNodeChatFunc (Forced: Boolean) : Boolean; { 1 = node chat broadcast message (if room = 0) node chat regular text (if room = room user is in) 4 = node chat private message @@ -361,6 +361,7 @@ Procedure Node_Chat; Until False; TopPage := TopSave; + FullReDraw; End; diff --git a/mystic/bbs_nodeinfo.pas b/mystic/bbs_nodeinfo.pas index f873318..7b69e12 100644 --- a/mystic/bbs_nodeinfo.pas +++ b/mystic/bbs_nodeinfo.pas @@ -13,11 +13,14 @@ Procedure Set_Node_Action (Action: String); Implementation Uses + m_Types, m_DateTime, m_Strings, + m_FileIO, bbs_Common, bbs_Core, - bbs_User; + bbs_User, + bbs_UserChat; Function Is_User_Online (Name: String) : Word; Var @@ -197,9 +200,8 @@ Begin Assign (NodeMsgFile, Config.SystemPath + 'temp' + strI2S(A) + PathChar + 'chat.tmp'); - {$I-} Reset (NodeMsgFile); {$I+} - - If IoResult <> 0 Then ReWrite(NodeMsgFile); + If Not ioReset (NodeMsgFile, SizeOf(NodeMsg), fmReadWrite + fmDenyAll) Then + ioReWrite(NodeMsgFile, SizeOf(NodeMsg), fmReadWrite + fmDenyAll); Seek (NodeMsgFile, FileSize(NodeMsgFile)); Write (NodeMsgFile, NodeMsg); @@ -211,42 +213,54 @@ End; Function CheckNodeMessages : Boolean; Var - Str : String; + Str : String; + Image : TConsoleImageRec; Begin Result := False; FileMode := 66; Assign (NodeMsgFile, Session.TempPath + 'chat.tmp'); - {$I-} Reset (NodeMsgFile); {$I+} + If Not ioReset(NodeMsgFile, SizeOf(NodeMsg), fmReadWrite + fmDenyAll) Then + Exit; - If IoResult <> 0 Then Exit; - - // 2 = system broadcast message (ie, not from user, from mystic) - // 3 = user to user node message - - While Not Eof(NodeMsgFile) Do Begin - Result := True; - - Read (NodeMsgFile, NodeMsg); - - Session.io.PromptInfo[1] := NodeMsg.FromWho; - Session.io.PromptInfo[2] := strI2S(NodeMsg.FromNode); - - Case NodeMsg.MsgType of - 2 : Begin - Session.io.OutFullLn (Session.GetPrompt(179) + NodeMsg.Message); - Session.io.OutFullLn (Session.GetPrompt(180)); - End; - 3 : Begin - Session.io.OutFullLn (Session.GetPrompt(144) + '|CR' + NodeMsg.Message); - Session.io.OutFull (Session.GetPrompt(145)); - End; - End; + If FileSize(NodeMsgFile) = 0 Then Begin + Close (NodeMsgFile); + Exit; End; - Close (NodeMsgFile); - Erase (NodeMsgFile); + Session.InMessage := True; + CheckNodeMessages := True; + + Read (NodeMsgFile, NodeMsg); + KillRecord (NodeMsgFile, 1, SizeOf(NodeMsg)); + Close (NodeMsgFile); + + Screen.GetScreenImage (1, 1, 79, 24, Image); + + Session.io.PromptInfo[1] := NodeMsg.FromWho; + Session.io.PromptInfo[2] := strI2S(NodeMsg.FromNode); + Session.io.PromptInfo[3] := NodeMsg.Message; + + Case NodeMsg.MsgType of + 2 : Begin + Session.io.OutFullLn (Session.GetPrompt(179) + NodeMsg.Message); + Session.io.OutFullLn (Session.GetPrompt(180)); + End; + 3 : Begin + Session.io.OutFullLn (Session.GetPrompt(144) + '|CR' + NodeMsg.Message); + Session.io.OutFull (Session.GetPrompt(145)); + End; + 8 : If Session.io.GetYN('|CL|15|&1 is requesting user to user chat. Accept? |11', True) Then Begin + Send_Node_Message (10, strI2S(NodeMsg.FromNode) + ';C', 0); + OpenUserChat(False, NodeMsg.FromNode); + End; + 9 : Begin + Send_Node_Message (10, strI2S(NodeMsg.FromNode) + ';C', 0); + OpenUserChat(True, NodeMsg.FromNode); + End; + 10: OpenUserChat(False, NodeMsg.FromNode); + End; If Result And (NodeMsg.MsgType = 3) Then If Session.io.OneKey(#13 + 'R', True) = 'R' Then Begin @@ -256,6 +270,10 @@ Begin If Str <> '' Then Send_Node_Message(3, Session.io.PromptInfo[2] + ';' + Str, 0); End; + + Session.io.RemoteRestore(Image); + + Session.InMessage := False; End; End. diff --git a/mystic/bbs_sysopchat.pas b/mystic/bbs_sysopchat.pas index aba0d09..54c1be7 100644 --- a/mystic/bbs_sysopchat.pas +++ b/mystic/bbs_sysopchat.pas @@ -289,4 +289,4 @@ Begin UpdateStatusLine (StatusPtr, ''); End; -End. +End. \ No newline at end of file diff --git a/mystic/mystic.pas b/mystic/mystic.pas index 43ce150..1f84862 100644 --- a/mystic/mystic.pas +++ b/mystic/mystic.pas @@ -119,7 +119,8 @@ Begin If Session.ExitLevel <> 0 Then ExitCode := Session.ExitLevel; If Session.EventRunAfter Then ExitCode := Session.NextEvent.ErrLevel; - DirClean (Session.TempPath, ''); + DirClean (Session.TempPath, ''); + FileErase (Config.DataPath + 'chat' + strI2S(Session.NodeNum) + '.dat'); {$IFNDEF LOGGING} {$IFNDEF UNIX} @@ -208,7 +209,7 @@ Var Begin Randomize; - Session.TempPath := Config.SystemPath + 'temp' + strI2S(Session.NodeNum) + PathChar; + Session.TempPath := Config.SystemPath + 'temp' + strI2S(Session.NodeNum) + PathChar; {$I-} MkDir (Config.SystemPath + 'temp' + strI2S(Session.NodeNum)); @@ -218,23 +219,6 @@ Begin DirClean(Session.TempPath, ''); - Assign (Session.LangFile, Config.DataPath + 'theme.dat'); - {$I-} Reset (Session.LangFile); {$I+} - If IoResult <> 0 Then Begin - Screen.WriteLine ('ERROR: No theme configuration. Use MYSTIC -CFG'); - DisposeClasses; - Halt(1); - End; - Close (Session.LangFile); - - If Not Session.LoadThemeData(Config.DefThemeFile) Then Begin - If Not Session.ConfigMode Then Begin - Screen.WriteLine ('ERROR: Default theme prompts not found [' + Config.DefThemeFile + '.thm]'); - DisposeClasses; - Halt(1); - End; - End; - Assign (Session.User.UserFile, Config.DataPath + 'users.dat'); {$I-} Reset (Session.User.UserFile); {$I+} If IoResult <> 0 Then Begin @@ -253,6 +237,23 @@ Begin If IoResult <> 0 Then ReWrite (VoteFile); Close (VoteFile); + Assign (Session.LangFile, Config.DataPath + 'theme.dat'); + {$I-} Reset (Session.LangFile); {$I+} + If IoResult <> 0 Then Begin + Screen.WriteLine ('ERROR: No theme configuration.'); + DisposeClasses; + Halt(1); + End; + Close (Session.LangFile); + + If Not Session.LoadThemeData(Config.DefThemeFile) Then Begin + If Not Session.ConfigMode Then Begin + Screen.WriteLine ('ERROR: Default theme prompts not found [' + Config.DefThemeFile + '.thm]'); + DisposeClasses; + Halt(1); + End; + End; + If Session.ConfigMode Then Exit; CheckDIR (Config.SystemPath); diff --git a/mystic/records.pas b/mystic/records.pas index 9c75f6b..29a00f5 100644 --- a/mystic/records.pas +++ b/mystic/records.pas @@ -725,12 +725,15 @@ Type ToWho : String[30]; Message : String[250]; MsgType : Byte; - { 1 = Chat Pub and broadcast } - { 2 = System message } - { 3 = User message } - { 4 = Chat Private } - { 5 = chat status note } - { 6 = chat action } - { 7 = chat topic update } + { 1 = Chat Pub and broadcast } + { 2 = System message } + { 3 = User message } + { 4 = Chat Private } + { 5 = chat status note } + { 6 = chat action } + { 7 = chat topic update } + { 8 = user 2 user page } + { 9 = user 2 user forced } + { 10 = chat accepted } Room : Byte; { Chat room number. 0 = chat broadcast } End; diff --git a/mystic/todo.pas b/mystic/todo.pas index fcf53be..251276b 100644 --- a/mystic/todo.pas +++ b/mystic/todo.pas @@ -103,6 +103,10 @@ FUTURE / IDEAS / WORK IN PROGRESS / NOTES - LastOn revamp make sure its not global and new stuff is populated - ANSI online help that can execute menu commands/restore screen - MPL fAppend? Why didnt I add that? +- MCI code to save and restore user screen? +- BBS email forward to e-mail address +- Email pasword resets +- Email verification RANDOM DRUNKEN BRAINDUMP AKA DESIGN DETAILS ===========================================