From 6a4b0b47d35b3535ee1dd47ccf80b13448195af0 Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Sat, 30 Mar 2013 03:19:05 -0400 Subject: [PATCH] New event editor, etc. Finished configuration --- mystic/bbs_cfg_events.pas | 274 ++++++++++++++++++++++-------------- mystic/bbs_cfg_main.pas | 29 +--- mystic/bbs_cfg_menuedit.pas | 4 +- mystic/bbs_core.pas | 22 ++- mystic/bbs_edit_ansi.pas | 10 +- mystic/bbs_general.pas | 55 ++++++++ mystic/bbs_menus.pas | 7 +- mystic/bbs_msgbase.pas | 2 +- mystic/mbbsutil.pas | 64 ++++++++- mystic/mutil_echoexport.pas | 9 +- mystic/mystic.pas | 2 +- mystic/records.pas | 30 ++-- mystic/whatsnew.txt | 12 ++ 13 files changed, 343 insertions(+), 177 deletions(-) diff --git a/mystic/bbs_cfg_events.pas b/mystic/bbs_cfg_events.pas index 1d63509..3843ef6 100644 --- a/mystic/bbs_cfg_events.pas +++ b/mystic/bbs_cfg_events.pas @@ -1,127 +1,191 @@ -Unit bbs_cfg_Events; +Unit BBS_Cfg_Events; {$I M_OPS.PAS} Interface -Procedure Event_Editor; +Procedure Configuration_Events; Implementation Uses m_Strings, m_DateTime, - bbs_Core, + m_FileIO, bbs_Common, - bbs_User; + bbs_ansi_MenuBox, + bbs_ansi_MenuForm, + bbs_cfg_Common; -Procedure Event_Editor; +Procedure EditEvent (Var Event: RecEvent); Var - A, B : Integer; + Box : TAnsiMenuBox; + Form : TAnsiMenuForm; + Hour : Byte; + Min : Byte; + Count : Byte; Begin - Session.SystemLog ('*EVENT EDITOR*'); + Box := TAnsiMenuBox.Create; + Form := TAnsiMenuForm.Create; - Assign (Session.EventFile, Config.DataPath + 'events.dat'); - {$I-} Reset (Session.EventFile); {$I+} - If IoResult <> 0 Then ReWrite(Session.EventFile); + Form.HelpSize := 0; - Repeat - Session.io.OutFullLn ('|CL|14Event Editor|CR|CR|09### Name|CR--- ------------------------------ -----|14'); - Reset (Session.EventFile); - While Not Eof(Session.EventFile) do begin - read (Session.EventFile, session.event); - if session.event.active then Session.io.BufAddChar('+') else Session.io.BufAddChar('-'); - Session.io.OutFullLn ('|15' + strPadR(strI2S(filepos(Session.EventFile)), 4, ' ') + '|14' + strPadR(session.event.name, 32, ' ') + - strZero(session.event.exectime div 60) + ':' + strZero(session.event.exectime mod 60)); - end; - Session.io.OutFull ('|CR|09(I)nsert, (D)elete, (E)dit, (Q)uit? '); - case Session.io.OneKey ('DIEQ', True) of - 'D' : begin - Session.io.OutRaw ('Delete which? '); - a := strS2I(Session.io.GetInput(3, 3, 11, '')); - KillRecord (Session.EventFile, A, SizeOf(EventRec)); - end; - 'I' : begin - Session.io.OutRaw ('Insert before? (1-' + strI2S(filesize(Session.EventFile)+1) + '): '); - a := strS2I(Session.io.GetInput(3, 3, 11, '')); - if (a > 0) and (a <= filesize(Session.EventFile)+1) then begin - AddRecord (Session.EventFile, A, SizeOf(EventRec)); - session.event.active := false; - Session.Event.Name := 'New Event'; - Session.Event.errlevel := 0; - Session.Event.exectime := 0; - Session.Event.warning := 0; - Session.Event.lastran := 0; - Session.Event.offhook := false; - Session.Event.node := 0; - write (Session.EventFile, Session.event); - end; - end; - 'E' : begin - Session.io.OutRaw ('Edit which? '); - a := strS2I(Session.io.GetInput(3, 3, 11, '')); - if (a > 0) and (a <= filesize(Session.EventFile)) then begin - seek (Session.EventFile, a-1); - read (Session.EventFile, Session.event); - repeat - Session.io.OutFullLn ('|CL|14Event ' + strI2S(FilePos(Session.EventFile)) + ' of ' + strI2S(FileSize(Session.EventFile)) + '|CR|03'); - Session.io.OutRawln ('!. Active : ' + Session.io.OutYN(Session.Event.active)); - Session.io.OutRawln ('A. Description : ' + Session.Event.Name); - Session.io.OutRawln ('B. Forced : ' + Session.io.OutYN(Session.Event.forced)); - Session.io.OutRawln ('C. Errorlevel : ' + strI2S(Session.Event.ErrLevel)); - Session.io.OutRaw ('D. Execution Time : '); - a := Session.Event.exectime div 60; - b := Session.Event.exectime mod 60; - Session.io.OutRawln (strZero(a) + ':' + strZero(b)); - Session.io.OutRawln ('E. Busy Warning : ' + strI2S(Session.Event.Warning)); - Session.io.OutRawln ('F. Last Ran on : ' + DateDos2Str(Session.Event.LastRan, Session.User.ThisUser.DateType)); - Session.io.OutRawln ('G. Offhook Modem : ' + Session.io.OutYN(Session.Event.Offhook)); - Session.io.OutRaw ('H. Node Number : '); - If Session.Event.Node = 0 Then - Session.io.OutRawLn ('All') - Else - Session.io.OutRawLn (strI2S(Session.Event.Node)); - Session.io.OutFull ('|CR|09Command (Q/Quit): '); - case Session.io.OneKey('[]!ABCDEFGHQ', True) of - '[' : If FilePos(Session.EventFile) > 1 Then Begin - Seek (Session.EventFile, FilePos(Session.EventFile)-1); - Write (Session.EventFile, Session.Event); - Seek (Session.EventFile, FilePos(Session.EventFile)-2); - Read (Session.EventFile, Session.Event); - End; - ']' : If FilePos(Session.EventFile) < FileSize(Session.EventFile) Then Begin - Seek (Session.EventFile, FilePos(Session.EventFile)-1); - Write (Session.EventFile, Session.Event); - Read (Session.EventFile, Session.Event); - End; - '!' : Session.Event.active := not Session.Event.active; - 'A' : Session.Event.name := Session.io.InXY(21, 4, 30, 30, 11, Session.Event.name); - 'B' : Session.Event.forced := not Session.Event.forced; - 'C' : Session.Event.errlevel := strS2I(Session.io.InXY(21, 6, 3, 3, 12, strI2S(Session.Event.errlevel))); - 'D' : Begin - a := strS2I(Session.io.InXY(21, 7, 2, 2, 12, '')); - b := strS2I(Session.io.InXY(24, 7, 2, 2, 12, '')); - if (a > -1) and (a < 24) and (b >= 0) and (b < 60) then - Session.Event.exectime := (a * 60) + b; - end; - 'E' : Session.Event.Warning := strS2I(Session.io.InXY(21, 8, 2, 2, 12, strI2S(Session.Event.Warning))); - 'F' : Session.Event.LastRan := DateStr2Dos(Session.io.InXY(21, 9, 8, 8, 15, DateDos2Str(Session.Event.lastran, Session.User.ThisUser.DateType))); - 'G' : Session.Event.Offhook := Not Session.Event.Offhook; - 'H' : Session.Event.Node := strS2I(Session.io.InXY(21, 11, 3, 3, 12, strI2S(Session.Event.Node))); - 'Q' : Break; - end - until false; - seek (Session.EventFile, filepos(Session.EventFile)-1); - write (Session.EventFile, Session.Event); - end; - end; - 'Q' : break; - end; - until False; + Box.Open (11, 6, 69, 20); - Close (Session.EventFile); + VerticalLine (26, 8, 18); + VerticalLine (63, 9, 15); - Session.FindNextEvent; + Hour := Event.ExecTime DIV 60; + Min := Event.ExecTime MOD 60; + + Form.AddStr ('D', ' Description' , 13, 8, 28, 8, 13, 30, 40, @Event.Name, ''); + Form.AddBol ('A', ' Active' , 18, 9, 28, 9, 8, 3, @Event.Active, ''); + Form.AddTog ('Y', ' Exec Type' , 15, 10, 28, 10, 11, 9, 0, 2, 'BBS Semaphore Shell', @Event.ExecType, ''); + Form.AddByte ('E', ' Exec Hour' , 15, 11, 28, 11, 11, 2, 0, 23, @Hour, ''); + Form.AddByte ('M', ' Exec Min' , 16, 12, 28, 12, 10, 2, 0, 59, @Min, ''); + Form.AddStr ('H', ' Shell' , 19, 13, 28, 13, 7, 30, 80, @Event.Shell, ''); + Form.AddStr ('S', ' Semaphore' , 15, 14, 28, 14, 11, 30, 40, @Event.SemaFile, ''); + Form.AddBol ('F', ' Forced' , 18, 15, 28, 15, 8, 3, @Event.Forced, ''); + Form.AddByte ('N', ' Node' , 20, 16, 28, 16, 6, 3, 0, 250, @Event.Node, ''); + Form.AddByte ('W', ' Warning' , 17, 17, 28, 17, 9, 3, 0, 255, @Event.Warning, ''); + Form.AddByte ('X', ' Exit Level' , 14, 18, 28, 18, 12, 3, 0, 255, @Event.ExecLevel, ''); + + For Count := 0 to 6 Do + Form.AddBol ('0', ' ' + DayString[Count], 58, 9 + Count, 65, 9 + Count, 5, 3, @Event.ExecDays[Count], ''); + + Form.Execute; + + Event.ExecTime := (Hour * 60) + Min; + + Box.Close; + Form.Free; + Box.Free; +End; + +Procedure Configuration_Events; +Var + Box : TAnsiMenuBox; + List : TAnsiMenuList; + F : File of RecEvent; + Event : RecEvent; + Copied : RecEvent; + HasCopy : Boolean = False; + + Procedure MakeList; + Var + Count : Byte; + DL : String[7] = ''; + Hour : Byte; + Min : Byte; + TypeStr : String; + Begin + List.Clear; + + Reset(F); + + While Not Eof(F) Do Begin + Read (F, Event); + + For Count := 0 to 6 Do + If Event.ExecDays[Count] Then + DL := DL + DayString[Count][1] + Else + DL := DL + '-'; + + Hour := Event.ExecTime DIV 60; + Min := Event.ExecTime MOD 60; + + Case Event.ExecType of + 0 : TypeStr := 'BBS'; + 1 : TypeStr := 'Semaphore'; + 2 : TypeStr := 'Shell'; +// 3 : TypeStr := 'PollMail'; +// 4 : TypeStr := 'SendMail'; + End; + + List.Add (strPadR(strYN(Event.Active), 7, ' ') + ' ' + strPadR(TypeStr, 15, ' ') + ' ' + strPadR(Event.Name, 25, ' ') + ' ' + strZero(Hour) + ':' + strZero(Min) + ' ' + DL, 0); + End; + + List.Add ('', 2); + End; + +Begin + Assign (F, Config.DataPath + 'event.dat'); + + If Not ioReset(F, SizeOf(Event), fmRWDN) Then + ioReWrite (F, SizeOf(Event), fmRWDN); + + Box := TAnsiMenuBox.Create; + List := TAnsiMenuList.Create; + + Box.Header := ' Event Editor '; + List.NoWindow := True; + List.LoChars := #13#27#47; + List.SearchY := 20; + + Box.Open (6, 5, 75, 20); + + WriteXY (8, 7, 112, 'Active Type Description Time Days'); + WriteXY (8, 8, 112, strRep('Ä', 66)); + WriteXY (8, 18, 112, strRep('Ä', 66)); + WriteXY (29, 19, 112, cfgCommandList); + + Repeat + MakeList; + + List.Open (6, 8, 75, 18); + List.Close; + + Case List.ExitCode of + '/' : Case GetCommandOption(10, 'I-Insert|D-Delete|C-Copy|P-Paste|') of + 'I' : Begin + AddRecord (F, List.Picked, SizeOf(Event)); + + FillChar (Event, SizeOf(Event), 0); + + Event.Name := 'New Event'; + + Write (F, Event); + + MakeList; + End; + 'D' : If List.Picked < List.ListMax Then + If ShowMsgBox(1, 'Delete this entry?') Then Begin + KillRecord (F, List.Picked, SizeOf(Event)); + MakeList; + End; + 'C' : If List.Picked <> List.ListMax Then Begin + Seek (F, List.Picked - 1); + Read (F, Copied); + + HasCopy := True; + End; + 'P' : If HasCopy Then Begin + AddRecord (F, List.Picked, SizeOf(Event)); + Write (F, Copied); + + MakeList; + End; + + End; + #13 : If List.Picked <> List.ListMax Then Begin + Seek (F, List.Picked - 1); + Read (F, Event); + + EditEvent(Event); + + Seek (F, List.Picked - 1); + Write (F, Event); + End; + #27 : Break; + End; + Until False; + + Close(F); + + Box.Close; + List.Free; + Box.Free; End; End. diff --git a/mystic/bbs_cfg_main.pas b/mystic/bbs_cfg_main.pas index 946bffd..1321a7d 100644 --- a/mystic/bbs_cfg_main.pas +++ b/mystic/bbs_cfg_main.pas @@ -28,10 +28,7 @@ Uses bbs_cfg_UserEdit, bbs_cfg_EchoMail, bbs_cfg_MenuEdit, - - // old shit to rewrite - bbs_cfg_events, - bbs_cfg_vote; + bbs_cfg_Events; Procedure Configuration_ExecuteEditor (Mode: Char); Var @@ -114,23 +111,6 @@ Var Box.Free; End; - Procedure ExecuteOldConfiguration (Mode: Char); - Var - TmpImage : TConsoleImageRec; - Begin - Screen.GetScreenImage (1, 1, 79, 24, TmpImage); - - Session.io.AnsiColor(7); - Session.io.AnsiClear; - - Case Mode of - 'E' : Event_Editor; - 'V' : Vote_Editor; - End; - - Session.io.RemoteRestore(TmpImage); - End; - Begin Session.io.OutFile(Config.DataPath + 'cfgroot', False, 0); @@ -258,7 +238,7 @@ Begin End; End; 3 : Begin - BoxOpen (38, 4, 64, 17); + BoxOpen (38, 4, 64, 16); CoolBoxOpen (39, 'Editors'); Form.AddNone ('U', ' U User Editor', 39, 5, 39, 5, 25, ''); @@ -272,8 +252,6 @@ Begin Form.AddNone ('A', ' A Archive Editor', 39, 13, 39, 13, 25, ''); Form.AddNone ('P', ' P Protocol Editor', 39, 14, 39, 14, 25, ''); Form.AddNone ('E', ' E Event Editor', 39, 15, 39, 15, 25, ''); - Form.AddNone ('V', ' V Voting Editor', 39, 16, 39, 16, 25, ''); -// Form.AddNone ('L', ' L BBS List Editor', 39, 17, 39, 17, 25, ''); Res := Form.Execute; MenuPos[3] := Form.ItemPos; @@ -297,8 +275,7 @@ Begin 'S' : Configuration_SecurityEditor(True); 'T' : Configuration_ThemeEditor(False); 'U' : Configuration_UserEditor; - 'E', - 'V' : ExecuteOldConfiguration(Res); + 'E' : Configuration_Events; 'X' : Break; Else MenuPtr := 0; diff --git a/mystic/bbs_cfg_menuedit.pas b/mystic/bbs_cfg_menuedit.pas index 2c1eb35..63f214a 100644 --- a/mystic/bbs_cfg_menuedit.pas +++ b/mystic/bbs_cfg_menuedit.pas @@ -126,6 +126,7 @@ Const // VOTING BOOTH MENU COMMANDS ( Name: 'VA'; Desc: 'Create voting poll' ), + ( Name: 'VD'; Desc: 'Delete voting poll' ), ( Name: 'VN'; Desc: 'Vote on new polls' ), ( Name: 'VR'; Desc: 'See poll results' ), ( Name: 'VV'; Desc: 'Vote on a poll' ), @@ -159,8 +160,7 @@ Const ( Name: '*P'; Desc: '(SYS) Protocol editor' ), ( Name: '*R'; Desc: '(SYS) File group editor' ), ( Name: '*S'; Desc: '(SYS) System configuration' ), - ( Name: '*U'; Desc: '(SYS) User editor' ), - ( Name: '*V'; Desc: '(SYS) Voting booth editor' ) + ( Name: '*U'; Desc: '(SYS) User editor' ) ); {123456789012345678901234567890} Var diff --git a/mystic/bbs_core.pas b/mystic/bbs_core.pas index 981100f..8d2c3f4 100644 --- a/mystic/bbs_core.pas +++ b/mystic/bbs_core.pas @@ -35,15 +35,15 @@ Type Menu : TMenuEngine; IO : TBBSIO; Pipe : TPipe; - EventFile : File of EventRec; + EventFile : File of RecEvent; ThemeFile : File of RecTheme; VoteFile : File of VoteRec; Vote : VoteRec; CommHandle : LongInt; ShutDown : Boolean; TempPath : String; - Event : EventRec; - NextEvent : EventRec; + Event : RecEvent; + NextEvent : RecEvent; Theme : RecTheme; LocalMode : Boolean; Baud : LongInt; @@ -222,23 +222,19 @@ Begin MinCheck := -1; - Assign (EventFile, Config.DataPath + 'events.dat'); - ioReset (EventFile, SizeOf(EventRec), fmRWDN); + Assign (EventFile, Config.DataPath + 'event.dat'); - If IoResult <> 0 Then ioReWrite (EventFile, SizeOf(EventRec), fmRWDN); + If Not ioReset (EventFile, SizeOf(RecEvent), fmRWDN) Then + ioReWrite (EventFile, SizeOf(RecEvent), fmRWDN); While Not Eof(EventFile) Do Begin ioRead (EventFile, Event); - If MinCheck = -1 Then Begin - If Event.Active and ((Event.Node = 0) or (Event.Node = NodeNum)) Then begin + If (MinCheck = -1) or ((MinCheck <> -1) and (MinutesUntilEvent(Event.ExecTime) < MinCheck)) Then Begin + If Event.Active and (Event.ExecType = 0) and ((Event.Node = 0) or (Event.Node = NodeNum)) and (Event.ExecDays[DayOfWeek(CurDateDos)]) Then Begin MinCheck := MinutesUntilEvent(Event.ExecTime); NextEvent := Event; End; - End Else - If (Event.Active) and ((Event.Node = 0) or (Event.Node = NodeNum)) and (MinutesUntilEvent(Event.ExecTime) < MinCheck) Then Begin - MinCheck := MinutesUntilEvent(Event.ExecTime); - NextEvent := Event; End; End; @@ -320,7 +316,7 @@ Begin {exits if 0 mins} SystemLog('Event: ' + NextEvent.Name); - Halt (NextEvent.ErrLevel); + Halt (NextEvent.ExecLevel); End Else EventRunAfter := True; End; diff --git a/mystic/bbs_edit_ansi.pas b/mystic/bbs_edit_ansi.pas index 2854a9d..9dbcb15 100644 --- a/mystic/bbs_edit_ansi.pas +++ b/mystic/bbs_edit_ansi.pas @@ -494,7 +494,8 @@ Begin Dec (CurLine); Dec (CurY); - If CurX > GetLineLength(ANSI.Data[CurLine], 80) Then CurX := GetLineLength(ANSI.Data[CurLine], 80) + 1; + If CurX > GetLineLength(ANSI.Data[CurLine], 80) Then + CurX := GetLineLength(ANSI.Data[CurLine], 80) + 1; If CurY < 1 Then Begin ScrollUp; @@ -514,7 +515,8 @@ Begin If Reset Then CurX := 1; - If CurX > GetLineLength(ANSI.Data[CurLine], 80) Then CurX := GetLineLength(ANSI.Data[CurLine], 80) + 1; + If CurX > GetLineLength(ANSI.Data[CurLine], 80) Then + CurX := GetLineLength(ANSI.Data[CurLine], 80) + 1; If CurY > WinSize Then Begin Result := True; @@ -701,7 +703,7 @@ Begin CurY := CurLine - NewTop + 1; TopLine := NewTop; - DrawPage(1, WinSize, False); + DrawPage (1, WinSize, False); End; Procedure TEditorANSI.PageDown; @@ -732,7 +734,7 @@ Begin CurY := CurLine - NewTop + 1; TopLine := NewTop; - DrawPage(1, WinSize, False); + DrawPage (1, WinSize, False); End; Procedure TEditorANSI.DoEnter; diff --git a/mystic/bbs_general.pas b/mystic/bbs_general.pas index c243342..55cc243 100644 --- a/mystic/bbs_general.pas +++ b/mystic/bbs_general.pas @@ -39,6 +39,7 @@ Procedure Add_Booth; Procedure Voting_Booth (Forced: Boolean; Num: Integer); Procedure Voting_Result (Data: Integer); Procedure Voting_Booth_New; +Procedure Voting_Booth_Delete; Procedure View_Directory (Data: String; ViewType: Byte); Procedure AnsiViewer (Bar: RecPercent; Data: String); @@ -898,6 +899,60 @@ Begin If Session.io.GetYN (Session.GetPrompt(248), True) Then Voting_Result(VPos); End; +Procedure Voting_Booth_Delete; +Var + Max : LongInt; + A : LongInt; + C : LongInt; +Begin + Max := Voting_List; + + Session.io.OutFull('|CR|09Delete which question? '); + + A := strS2I(Session.io.GetInput(2, 2, 12, '')); + + If (A > 0) and (A <= Max) Then Begin + Max := 0; + + Reset (Session.VoteFile); + + Repeat + Read (Session.VoteFile, Session.Vote); + + If Session.User.Access(Session.Vote.ACS) Then Inc(Max); + Until Max = A; + + A := FilePos(Session.VoteFile); + + Session.io.OutFullLn ('|CR|12Deleting...'); + + KillRecord (Session.VoteFile, A, SizeOf(VoteRec)); + + Close (Session.VoteFile); + + Reset (Session.User.UserFile); + + While Not Eof(Session.User.UserFile) Do Begin + Read (Session.User.UserFile, Session.User.TempUser); + + For C := A To 19 Do + Session.User.TempUser.Vote[C] := Session.User.TempUser.Vote[C+1]; + + Session.User.TempUser.Vote[20] := 0; + + Seek (Session.User.UserFile, FilePos(Session.User.UserFile) - 1); + Write (Session.User.UserFile, Session.User.TempUser); + End; + + Close (Session.User.UserFile); + + For C := A to 19 Do + Session.User.ThisUser.Vote[C] := Session.User.ThisUser.Vote[C+1]; + + Session.User.ThisUser.Vote[20] := 0; + End; +End; + Procedure ShowBBSHistory (LastDays: Word); Var Temp : RecHistory; diff --git a/mystic/bbs_menus.pas b/mystic/bbs_menus.pas index f4b3709..21bbad5 100644 --- a/mystic/bbs_menus.pas +++ b/mystic/bbs_menus.pas @@ -60,8 +60,7 @@ Uses BBS_Ansi_Help, BBS_Cfg_Main, BBS_Cfg_Events, - BBS_Cfg_UserEdit, - BBS_Cfg_Vote; + BBS_Cfg_UserEdit; Constructor TMenuEngine.Create (O: Pointer); Begin @@ -300,6 +299,7 @@ Begin End; 'V' : Case Cmd[2] of 'A' : Add_Booth; + 'D' : Voting_Booth_Delete; 'N' : Voting_Booth_New; 'R' : Voting_Result (strS2I(CmdData)); 'V' : Voting_Booth (False, strS2I(CmdData)); @@ -340,7 +340,7 @@ Begin Result := True; End; 'A' : Configuration_ExecuteEditor('A'); - 'E' : Event_Editor; + 'E' : Configuration_Events; 'F' : Configuration_ExecuteEditor('F'); 'G' : Configuration_ExecuteEditor('G'); 'L' : Configuration_ExecuteEditor('L'); @@ -349,7 +349,6 @@ Begin 'R' : Configuration_ExecuteEditor('R'); 'S' : Configuration_MainMenu; 'U' : Configuration_UserEditor; - 'V' : Vote_Editor; End; End; End; diff --git a/mystic/bbs_msgbase.pas b/mystic/bbs_msgbase.pas index aa59277..fa1691a 100644 --- a/mystic/bbs_msgbase.pas +++ b/mystic/bbs_msgbase.pas @@ -4401,4 +4401,4 @@ Begin Session.io.OutFullLn(Session.GetPrompt(503)); End; -End. +End. \ No newline at end of file diff --git a/mystic/mbbsutil.pas b/mystic/mbbsutil.pas index f336311..18dd117 100644 --- a/mystic/mbbsutil.pas +++ b/mystic/mbbsutil.pas @@ -121,7 +121,7 @@ Begin WriteLn ('-BPACK Pack all BBS lists'); WriteLn ('-BSORT Sorts and packs BBS list by '); WriteLn ('-FCHECK Check filelist for correct size/status'); - WriteLn ('-FIXINDEX Fix broken permanent index for msg/file bases'); + WriteLn ('-FIXINDEX Fix wrong perm index for user/msg/file bases'); WriteLn ('-FPACK Pack file bases'); WriteLn ('-FSORT Sort file base entries by filename'); WriteLn ('-MTRASH Delete messages to/from users listed in '); @@ -910,9 +910,11 @@ Var ConfigFile : File of RecConfig; MBaseFile : File of RecMessageBase; FBaseFile : File of RecFileBase; + UserFile : File of RecUser; Config : RecConfig; MBase : RecMessageBase; FBase : RecFileBase; + User : RecUser; Function IsDupeMBaseIndex (SavedPos, Idx: LongInt) : Boolean; Var @@ -934,6 +936,28 @@ Var Seek (MBaseFile, SavedPos); End; + Function IsDupeUserIndex (SavedPos, Idx: LongInt) : Boolean; + Var + TempUser : RecUser; + Begin + Result := False; + +// Close (UserFile); + Reset (UserFile); + + While Not Eof(UserFile) Do Begin + Read (UserFile, TempUser); + + If (TempUser.PermIdx = Idx) and (FilePos(UserFile) <> SavedPos) Then Begin + Result := True; + Break; + End; + End; + +// Reset (UserFile); + Seek (UserFile, SavedPos); + End; + Function IsDupeFBaseIndex (SavedPos, Idx: LongInt) : Boolean; Var TempBase : RecFileBase; @@ -956,6 +980,7 @@ Var Var NewIndex : Cardinal; + MaxUser : Cardinal; Begin Write ('Fixing Indexes :'); @@ -1030,6 +1055,43 @@ Begin Close (FBaseFile); + Assign (UserFile, Config.DataPath + 'users.dat'); + Reset (UserFile); + + MaxUser := 0; + + While Not Eof(UserFile) Do Begin + Read (UserFile, User); + + If User.PermIdx > MaxUser Then MaxUser := User.PermIdx; + + Update_Bar (FilePos(UserFile), FileSize(UserFile)); + + If IsDupeUserIndex(FilePos(UserFile), User.PermIdx) Then Begin + NewIndex := 0; + + While IsDupeUserIndex(FilePos(UserFile), NewIndex) Do + Inc (NewIndex); + + User.PermIdx := NewIndex; + + If User.PermIdx > MaxUser Then MaxUser := User.PermIdx; + End; + + Seek (UserFile, FilePos(UserFile) - 1); + Write (UserFile, User); + End; + + Close (UserFile); + + If MaxUser <> Config.UserIdxPos Then Begin + Config.UserIdxPos := MaxUser + 1; + + Reset (ConfigFile); + Write (ConfigFile, Config); + Close (ConfigFile); + End; + Update_Bar(100, 100); Update_Status('Completed'); diff --git a/mystic/mutil_echoexport.pas b/mystic/mutil_echoexport.pas index a88e88b..13714e7 100644 --- a/mystic/mutil_echoexport.pas +++ b/mystic/mutil_echoexport.pas @@ -84,20 +84,21 @@ Begin OrigAddr.Net := PH.OrigNet; OrigAddr.Node := PH.OrigNode; + // TODO // if echonode.echomail.crash etc change char F in FLO extension FLOName := bbsConfig.OutboundPath + GetFTNFlowName(EchoNode.Address) + '.flo'; BundleName := bbsConfig.OutboundPath + GetFTNArchiveName(OrigAddr, EchoNode.Address) + '.' + DayString[DayOfWeek(CurDateDos)]; + // TODO // check for existance, packet size limitations, etc and increment // from 0-9 A-Z + BundleName[Length(BundleName)] := '0'; ExecuteArchive (BundleName, EchoNode.ArcType, TempPath + PKTName, 1); - - FileErase (TempPath + PKTName); - - AddToFLOQueue (FLOName, BundleName); + FileErase (TempPath + PKTName); + AddToFLOQueue (FLOName, BundleName); End; FindNext (DirInfo); diff --git a/mystic/mystic.pas b/mystic/mystic.pas index ed63e69..a7083c1 100644 --- a/mystic/mystic.pas +++ b/mystic/mystic.pas @@ -137,7 +137,7 @@ Begin End; If Session.ExitLevel <> 0 Then ExitCode := Session.ExitLevel; - If Session.EventRunAfter Then ExitCode := Session.NextEvent.ErrLevel; + If Session.EventRunAfter Then ExitCode := Session.NextEvent.ExecLevel; FileMode := 66; diff --git a/mystic/records.pas b/mystic/records.pas index a88064d..6d4a286 100644 --- a/mystic/records.pas +++ b/mystic/records.pas @@ -405,22 +405,20 @@ Type Reserved : Array[1..388] of Byte; End; - // day of week - // sema file - // event type [bbs exit/bbs exec/mis event] - // execcmd - // remove offhook - - EventRec = Record { EVENTS.DAT } - Active : Boolean; { Is event active? } - Name : String[30]; { Event Name } - Forced : Boolean; { Is this a forced event } - ErrLevel : Byte; { Errorlevel to Exit } - ExecTime : SmallInt; { Minutes after midnight } - Warning : Byte; { Warn user before the event } - Offhook : Boolean; { Offhook modem for event? } - Node : Byte; { Node number. 0 = all } - LastRan : LongInt; { Last time event was ran } + RecEvent = Record + Active : Boolean; + Name : String[40]; + ExecType : Byte; // 0=BBS, 1=Semaphore, 2=Shell, 3=Poll Nodes, 4=SendEcho + ExecTime : SmallInt; + ExecDays : Array[0..6] of Boolean; + ExecLevel : Byte; + Shell : String[80]; + SemaFile : String[80]; + Forced : Boolean; + Node : Byte; + Warning : Byte; + LastRan : LongInt; + Res : Array[1..34] of Byte; End; (* SECURITY.DAT in the data directory holds 255 records, one for each *) diff --git a/mystic/whatsnew.txt b/mystic/whatsnew.txt index 9eb11e6..bb05548 100644 --- a/mystic/whatsnew.txt +++ b/mystic/whatsnew.txt @@ -2987,3 +2987,15 @@ ! Fixed a bug that could cause the user editor to crash directly after a new install if you didn't create your SysOp account first. + + + The MBBSUTIL -fixindex function will now also check users for duplicate + perm index and attempt to fix them (along with the file/msg bases). + + + Added new event editor to replace the old crappy one. You should delete + event*.dat from your DATA directory. You will have to reconfigure your + events unfortunately (as if anyone even used them ever). + + + BBS events can now be executed on specific days of the week. + + + Old Voting booth editor has been replaced with the VD menu command used + to delete voting questions.