diff --git a/mystic/HISTORY.txt b/mystic/HISTORY.txt index 480b733..5c2a98e 100644 --- a/mystic/HISTORY.txt +++ b/mystic/HISTORY.txt @@ -4886,3 +4886,17 @@ + 09/24/12 23:11 Add: SPOT1_3B.LHA To: New File Base + 09/24/12 23:11 Result: Uploaded 2 file(s) + 09/24/12 23:11 Shutdown + + + MUTIL now has a message purge function. This function will go through + all of the messages in all message bases and delete any messages that do + not meet the "Age" or "Max Messages" settings for each message base. + + To use this function simply add the following into your [GENERAL] header + of your mUtil .INI configuration file(s): + + PurgeMessageBases = true + + ! MBBSUTIL -UKILL was not working properly. + + ! MBBSUTIL BBS list packer was not working properly when checking + verification days. diff --git a/mystic/bbs_doors.pas b/mystic/bbs_doors.pas index 46282f7..bf16b0f 100644 --- a/mystic/bbs_doors.pas +++ b/mystic/bbs_doors.pas @@ -111,7 +111,7 @@ Begin Write (tFile, Session.User.ThisUser.Handle + Ending); Write (tFile, Session.User.ThisUser.RealName + Ending); Write (tFile, '' + Ending); - Write (tFile, DaysAgo(Session.User.ThisUser.Birthday) DIV 365, Ending); { User's AGE } + Write (tFile, DaysAgo(Session.User.ThisUser.Birthday, 1) DIV 365, Ending); { User's AGE } Write (tFile, Session.User.ThisUser.Gender + Ending); Write (tFile, '0' + Ending); { User's gold } Write (tFile, DateDos2Str(Session.User.ThisUser.LastOn, 1) + Ending); diff --git a/mystic/bbs_general.pas b/mystic/bbs_general.pas index 1162194..380f319 100644 --- a/mystic/bbs_general.pas +++ b/mystic/bbs_general.pas @@ -432,7 +432,7 @@ Begin Session.io.PromptInfo[4] := TempUser.Gender; Session.io.PromptInfo[5] := strI2S(TempUser.Security); Session.io.PromptInfo[6] := TempUser.Address; - Session.io.PromptInfo[7] := strI2S(DaysAgo(TempUser.Birthday) DIV 365); + Session.io.PromptInfo[7] := strI2S(DaysAgo(TempUser.Birthday, 1) DIV 365); Session.io.PromptInfo[8] := TempUser.Email; Session.io.PromptInfo[9] := TempUser.UserInfo; Session.io.PromptInfo[10] := TempUser.OptionData[1]; diff --git a/mystic/bbs_io.pas b/mystic/bbs_io.pas index 789a938..03eea49 100644 --- a/mystic/bbs_io.pas +++ b/mystic/bbs_io.pas @@ -463,7 +463,7 @@ Begin '3' : LastMCIValue := Pipe2Ansi(23); End; 'A' : Case Code[2] of - 'G' : LastMCIValue := strI2S(DaysAgo(TBBSCore(Core).User.ThisUser.Birthday) DIV 365); + 'G' : LastMCIValue := strI2S(DaysAgo(TBBSCore(Core).User.ThisUser.Birthday, 1) DIV 365); 'O' : AllowAbort := False; 'S' : LastMCIValue := OutON(TBBSCore(Core).User.ThisUser.SigUse); 'V' : LastMCIValue := OutYN(Chat.Available); diff --git a/mystic/bbs_nodeinfo.pas b/mystic/bbs_nodeinfo.pas index 4e4d92f..fb5fe09 100644 --- a/mystic/bbs_nodeinfo.pas +++ b/mystic/bbs_nodeinfo.pas @@ -66,7 +66,7 @@ Begin Chat.Location := Session.User.ThisUser.City; Chat.Action := Action; Chat.Gender := Session.User.ThisUser.Gender; - Chat.Age := DaysAgo(Session.User.ThisUser.Birthday) DIV 365; + Chat.Age := DaysAgo(Session.User.ThisUser.Birthday, 1) DIV 365; If Session.LocalMode Then Chat.Baud := 'LOCAL' {++lang} Else diff --git a/mystic/bbs_user.pas b/mystic/bbs_user.pas index 97854d0..bb6e517 100644 --- a/mystic/bbs_user.pas +++ b/mystic/bbs_user.pas @@ -141,7 +141,7 @@ Var Res := False; Case Key of - 'A' : Res := DaysAgo(ThisUser.Birthday) DIV 365 >= strS2I(Data); + 'A' : Res := DaysAgo(ThisUser.Birthday, 1) DIV 365 >= strS2I(Data); 'D' : Res := (Ord(Data[1]) - 64) in ThisUser.AF2; 'E' : Case Data[1] of '1' : Res := Session.io.Graphics = 1; diff --git a/mystic/mbbsutil.pas b/mystic/mbbsutil.pas index d3f202d..2ec9dfe 100644 --- a/mystic/mbbsutil.pas +++ b/mystic/mbbsutil.pas @@ -490,7 +490,7 @@ Procedure Kill_BBS_List; Update_Bar (FilePos(TBBSFile), FileSize(TBBSFile)); - If DaysAgo(BBS.Verified) >= BBSKillDays Then Begin + If DaysAgo(BBS.Verified, 2) >= BBSKillDays Then Begin BBS.Deleted := True; BBSPack := True; @@ -557,7 +557,7 @@ Begin Update_Bar (FilePos(TUserFile), FileSize(TUserFile)); - If (DaysAgo(User.LastOn) >= UserKillDays) And (User.Flags AND UserNoKill = 0) Then Begin + If (DaysAgo(User.LastOn, 2) >= UserKillDays) And (User.Flags AND UserNoKill = 0) Then Begin User.Flags := User.Flags OR UserDeleted; Update_Status ('Killing ' + User.Handle); UserPack := True; diff --git a/mystic/mpl_execute.pas b/mystic/mpl_execute.pas index f36a388..b818617 100644 --- a/mystic/mpl_execute.pas +++ b/mystic/mpl_execute.pas @@ -1634,7 +1634,7 @@ Begin Store (TempByte, 1); End; 58 : Begin - TempLong := DaysAgo(Param[1].L); + TempLong := DaysAgo(Param[1].L, 1); Store (TempLong, 4); End; 59 : Begin diff --git a/mystic/mutil.pas b/mystic/mutil.pas index a3762bd..6c31ed5 100644 --- a/mystic/mutil.pas +++ b/mystic/mutil.pas @@ -51,7 +51,8 @@ Uses mUtil_FilesBBS, mUtil_AllFiles, mUtil_MsgPurge, - mUtil_MsgPack; + mUtil_MsgPack, + mUtil_MsgPost; {$I MUTIL_ANSI.PAS} @@ -173,6 +174,7 @@ Var DoAllFiles : Boolean; DoMsgPurge : Boolean; DoMsgPack : Boolean; + DoMsgPost : Boolean; Begin ApplicationStartup; @@ -188,6 +190,7 @@ Begin DoAllFiles := CheckProcess(Header_ALLFILES); DoMsgPurge := CheckProcess(Header_MSGPURGE); DoMsgPack := CheckProcess(Header_MSGPACK); + DoMsgPost := CheckProcess(Header_MSGPOST); // Exit with an error if nothing is configured @@ -209,4 +212,5 @@ Begin If DoAllFiles Then uAllFilesList; If DoMsgPurge Then uPurgeMessageBases; If DoMsgPack Then uPackMessageBases; + If DoMsgPost Then uPostMessages; End. diff --git a/mystic/mutil_common.pas b/mystic/mutil_common.pas index 6b346e5..7413896 100644 --- a/mystic/mutil_common.pas +++ b/mystic/mutil_common.pas @@ -34,6 +34,7 @@ Const Header_ALLFILES = 'GenerateAllFiles'; Header_MSGPURGE = 'PurgeMessageBases'; Header_MSGPACK = 'PackMessageBases'; + Header_MSGPOST = 'PostTextFiles'; Procedure Log (Level: Byte; Code: Char; Str: String); Function strAddr2Str (Addr : RecEchoMailAddr) : String; @@ -45,6 +46,7 @@ Procedure AddMessageBase (Var MBase: RecMessageBase); Procedure AddFileBase (Var FBase: RecFileBase); Function ShellDOS (ExecPath: String; Command: String) : LongInt; Procedure ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte); +Function GetMBaseByIndex (Num: LongInt; Var TempBase: RecMessageBase) : Boolean; Implementation @@ -289,4 +291,26 @@ Begin ShellDOS ('', Temp); End; -End. +Function GetMBaseByIndex (Num: LongInt; Var TempBase: RecMessageBase) : Boolean; +Var + F : File; +Begin + Result := False; + + Assign (F, bbsConfig.DataPath + 'mbases.dat'); + + If Not ioReset(F, SizeOf(RecMessageBase), fmRWDN) Then Exit; + + While Not Eof(F) Do Begin + ioRead(F, TempBase); + + If TempBase.Index = Num Then Begin + Result := True; + Break; + End; + End; + + Close (F); +End; + +End. \ No newline at end of file diff --git a/mystic/mutil_msgpurge.pas b/mystic/mutil_msgpurge.pas index 35162f6..d1cec0a 100644 --- a/mystic/mutil_msgpurge.pas +++ b/mystic/mutil_msgpurge.pas @@ -10,15 +10,101 @@ Implementation Uses m_Strings, + m_DateTime, mUtil_Common, - mUtil_Status; + mUtil_Status, + bbs_MsgBase_ABS, + bbs_MsgBase_JAM, + bbs_MsgBase_Squish; Procedure uPurgeMessageBases; +Var + PurgeTotal : LongInt = 0; + PurgeBase : LongInt; + BaseFile : File of RecMessageBase; + Base : RecMessageBase; + MsgBase : PMsgBaseABS; Begin ProcessName ('Purging Message Bases', True); ProcessResult (rWORKING, False); - ProcessStatus ('Complete', True); + Assign (BaseFile, bbsConfig.DataPath + 'mbases.dat'); + {$I-} Reset (BaseFile); {$I+} + + If IoResult = 0 Then Begin + While Not Eof(BaseFile) Do Begin + Read (BaseFile, Base); + + ProcessStatus (Base.Name, False); + BarOne.Update (FilePos(BaseFile), FileSize(BaseFile)); + + PurgeBase := 0; + + Case Base.BaseType of + 0 : MsgBase := New(PMsgBaseJAM, Init); + 1 : MsgBase := New(PMsgBaseSquish, Init); + End; + + MsgBase^.SetMsgPath (Base.Path + Base.FileName); + MsgBase^.SetTempFile (TempPath + 'msgbuf.tmp'); + + If Not MsgBase^.OpenMsgBase Then Begin + Dispose (MsgBase, Done); + + Continue; + End; + + If Base.MaxAge > 0 Then Begin + MsgBase^.SeekFirst(1); + + While MsgBase^.SeekFound Do Begin + MsgBase^.MsgStartUp; + + If MsgBase^.IsDeleted Then Begin + MsgBase^.SeekNext; + + Continue; + End; + + If DaysAgo(DateStr2Julian(MsgBase^.GetDate), 1) > Base.MaxAge Then Begin + MsgBase^.DeleteMsg; + + Inc (PurgeTotal); + Inc (PurgeBase); + End; + + MsgBase^.SeekNext; + End; + End; + + If Base.MaxMsgs > 0 Then Begin + MsgBase^.SeekFirst(1); + + While MsgBase^.SeekFound And (MsgBase^.NumberOfMsgs > Base.MaxMsgs) Do Begin + MsgBase^.MsgStartUp; + + If Not MsgBase^.IsDeleted Then Begin + MsgBase^.DeleteMsg; + + Inc (PurgeTotal); + Inc (PurgeBase); + End; + + MsgBase^.SeekNext; + End; + End; + + MsgBase^.CloseMsgBase; + + Dispose (MsgBase, Done); + + Log (2, '+', ' Purged ' + strI2S(PurgeBase)); + End; + + Close (BaseFile); + End; + + ProcessStatus ('Purged |15' + strI2S(PurgeTotal) + ' |07messages', True); ProcessResult (rDONE, True); End; diff --git a/mystic/mystpack.pas b/mystic/mystpack.pas index e976915..d3a2d8d 100644 --- a/mystic/mystpack.pas +++ b/mystic/mystpack.pas @@ -290,7 +290,7 @@ Begin UnixToDT (MsgHdr.DateWritten, MsgDateTime); PackTime (MsgDateTime, Temp); - LimitKill := DaysAgo(Temp) > MBase.MaxAge; + LimitKill := DaysAgo(Temp, 2) > MBase.MaxAge; Killed := Killed or LimitKill; End;