mUtil stuff, some datetime fixes
This commit is contained in:
parent
9f318b735c
commit
ae33281f2f
|
@ -4886,3 +4886,17 @@
|
||||||
+ 09/24/12 23:11 Add: SPOT1_3B.LHA To: New File Base
|
+ 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 Result: Uploaded 2 file(s)
|
||||||
+ 09/24/12 23:11 Shutdown
|
+ 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.
|
||||||
|
|
|
@ -111,7 +111,7 @@ Begin
|
||||||
Write (tFile, Session.User.ThisUser.Handle + Ending);
|
Write (tFile, Session.User.ThisUser.Handle + Ending);
|
||||||
Write (tFile, Session.User.ThisUser.RealName + Ending);
|
Write (tFile, Session.User.ThisUser.RealName + Ending);
|
||||||
Write (tFile, '' + 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, Session.User.ThisUser.Gender + Ending);
|
||||||
Write (tFile, '0' + Ending); { User's gold }
|
Write (tFile, '0' + Ending); { User's gold }
|
||||||
Write (tFile, DateDos2Str(Session.User.ThisUser.LastOn, 1) + Ending);
|
Write (tFile, DateDos2Str(Session.User.ThisUser.LastOn, 1) + Ending);
|
||||||
|
|
|
@ -432,7 +432,7 @@ Begin
|
||||||
Session.io.PromptInfo[4] := TempUser.Gender;
|
Session.io.PromptInfo[4] := TempUser.Gender;
|
||||||
Session.io.PromptInfo[5] := strI2S(TempUser.Security);
|
Session.io.PromptInfo[5] := strI2S(TempUser.Security);
|
||||||
Session.io.PromptInfo[6] := TempUser.Address;
|
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[8] := TempUser.Email;
|
||||||
Session.io.PromptInfo[9] := TempUser.UserInfo;
|
Session.io.PromptInfo[9] := TempUser.UserInfo;
|
||||||
Session.io.PromptInfo[10] := TempUser.OptionData[1];
|
Session.io.PromptInfo[10] := TempUser.OptionData[1];
|
||||||
|
|
|
@ -463,7 +463,7 @@ Begin
|
||||||
'3' : LastMCIValue := Pipe2Ansi(23);
|
'3' : LastMCIValue := Pipe2Ansi(23);
|
||||||
End;
|
End;
|
||||||
'A' : Case Code[2] of
|
'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;
|
'O' : AllowAbort := False;
|
||||||
'S' : LastMCIValue := OutON(TBBSCore(Core).User.ThisUser.SigUse);
|
'S' : LastMCIValue := OutON(TBBSCore(Core).User.ThisUser.SigUse);
|
||||||
'V' : LastMCIValue := OutYN(Chat.Available);
|
'V' : LastMCIValue := OutYN(Chat.Available);
|
||||||
|
|
|
@ -66,7 +66,7 @@ Begin
|
||||||
Chat.Location := Session.User.ThisUser.City;
|
Chat.Location := Session.User.ThisUser.City;
|
||||||
Chat.Action := Action;
|
Chat.Action := Action;
|
||||||
Chat.Gender := Session.User.ThisUser.Gender;
|
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
|
If Session.LocalMode Then
|
||||||
Chat.Baud := 'LOCAL' {++lang}
|
Chat.Baud := 'LOCAL' {++lang}
|
||||||
Else
|
Else
|
||||||
|
|
|
@ -141,7 +141,7 @@ Var
|
||||||
Res := False;
|
Res := False;
|
||||||
|
|
||||||
Case Key of
|
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;
|
'D' : Res := (Ord(Data[1]) - 64) in ThisUser.AF2;
|
||||||
'E' : Case Data[1] of
|
'E' : Case Data[1] of
|
||||||
'1' : Res := Session.io.Graphics = 1;
|
'1' : Res := Session.io.Graphics = 1;
|
||||||
|
|
|
@ -490,7 +490,7 @@ Procedure Kill_BBS_List;
|
||||||
|
|
||||||
Update_Bar (FilePos(TBBSFile), FileSize(TBBSFile));
|
Update_Bar (FilePos(TBBSFile), FileSize(TBBSFile));
|
||||||
|
|
||||||
If DaysAgo(BBS.Verified) >= BBSKillDays Then Begin
|
If DaysAgo(BBS.Verified, 2) >= BBSKillDays Then Begin
|
||||||
BBS.Deleted := True;
|
BBS.Deleted := True;
|
||||||
BBSPack := True;
|
BBSPack := True;
|
||||||
|
|
||||||
|
@ -557,7 +557,7 @@ Begin
|
||||||
|
|
||||||
Update_Bar (FilePos(TUserFile), FileSize(TUserFile));
|
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;
|
User.Flags := User.Flags OR UserDeleted;
|
||||||
Update_Status ('Killing ' + User.Handle);
|
Update_Status ('Killing ' + User.Handle);
|
||||||
UserPack := True;
|
UserPack := True;
|
||||||
|
|
|
@ -1634,7 +1634,7 @@ Begin
|
||||||
Store (TempByte, 1);
|
Store (TempByte, 1);
|
||||||
End;
|
End;
|
||||||
58 : Begin
|
58 : Begin
|
||||||
TempLong := DaysAgo(Param[1].L);
|
TempLong := DaysAgo(Param[1].L, 1);
|
||||||
Store (TempLong, 4);
|
Store (TempLong, 4);
|
||||||
End;
|
End;
|
||||||
59 : Begin
|
59 : Begin
|
||||||
|
|
|
@ -51,7 +51,8 @@ Uses
|
||||||
mUtil_FilesBBS,
|
mUtil_FilesBBS,
|
||||||
mUtil_AllFiles,
|
mUtil_AllFiles,
|
||||||
mUtil_MsgPurge,
|
mUtil_MsgPurge,
|
||||||
mUtil_MsgPack;
|
mUtil_MsgPack,
|
||||||
|
mUtil_MsgPost;
|
||||||
|
|
||||||
{$I MUTIL_ANSI.PAS}
|
{$I MUTIL_ANSI.PAS}
|
||||||
|
|
||||||
|
@ -173,6 +174,7 @@ Var
|
||||||
DoAllFiles : Boolean;
|
DoAllFiles : Boolean;
|
||||||
DoMsgPurge : Boolean;
|
DoMsgPurge : Boolean;
|
||||||
DoMsgPack : Boolean;
|
DoMsgPack : Boolean;
|
||||||
|
DoMsgPost : Boolean;
|
||||||
Begin
|
Begin
|
||||||
ApplicationStartup;
|
ApplicationStartup;
|
||||||
|
|
||||||
|
@ -188,6 +190,7 @@ Begin
|
||||||
DoAllFiles := CheckProcess(Header_ALLFILES);
|
DoAllFiles := CheckProcess(Header_ALLFILES);
|
||||||
DoMsgPurge := CheckProcess(Header_MSGPURGE);
|
DoMsgPurge := CheckProcess(Header_MSGPURGE);
|
||||||
DoMsgPack := CheckProcess(Header_MSGPACK);
|
DoMsgPack := CheckProcess(Header_MSGPACK);
|
||||||
|
DoMsgPost := CheckProcess(Header_MSGPOST);
|
||||||
|
|
||||||
// Exit with an error if nothing is configured
|
// Exit with an error if nothing is configured
|
||||||
|
|
||||||
|
@ -209,4 +212,5 @@ Begin
|
||||||
If DoAllFiles Then uAllFilesList;
|
If DoAllFiles Then uAllFilesList;
|
||||||
If DoMsgPurge Then uPurgeMessageBases;
|
If DoMsgPurge Then uPurgeMessageBases;
|
||||||
If DoMsgPack Then uPackMessageBases;
|
If DoMsgPack Then uPackMessageBases;
|
||||||
|
If DoMsgPost Then uPostMessages;
|
||||||
End.
|
End.
|
||||||
|
|
|
@ -34,6 +34,7 @@ Const
|
||||||
Header_ALLFILES = 'GenerateAllFiles';
|
Header_ALLFILES = 'GenerateAllFiles';
|
||||||
Header_MSGPURGE = 'PurgeMessageBases';
|
Header_MSGPURGE = 'PurgeMessageBases';
|
||||||
Header_MSGPACK = 'PackMessageBases';
|
Header_MSGPACK = 'PackMessageBases';
|
||||||
|
Header_MSGPOST = 'PostTextFiles';
|
||||||
|
|
||||||
Procedure Log (Level: Byte; Code: Char; Str: String);
|
Procedure Log (Level: Byte; Code: Char; Str: String);
|
||||||
Function strAddr2Str (Addr : RecEchoMailAddr) : String;
|
Function strAddr2Str (Addr : RecEchoMailAddr) : String;
|
||||||
|
@ -45,6 +46,7 @@ Procedure AddMessageBase (Var MBase: RecMessageBase);
|
||||||
Procedure AddFileBase (Var FBase: RecFileBase);
|
Procedure AddFileBase (Var FBase: RecFileBase);
|
||||||
Function ShellDOS (ExecPath: String; Command: String) : LongInt;
|
Function ShellDOS (ExecPath: String; Command: String) : LongInt;
|
||||||
Procedure ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte);
|
Procedure ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte);
|
||||||
|
Function GetMBaseByIndex (Num: LongInt; Var TempBase: RecMessageBase) : Boolean;
|
||||||
|
|
||||||
Implementation
|
Implementation
|
||||||
|
|
||||||
|
@ -289,4 +291,26 @@ Begin
|
||||||
ShellDOS ('', Temp);
|
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.
|
End.
|
|
@ -10,15 +10,101 @@ Implementation
|
||||||
|
|
||||||
Uses
|
Uses
|
||||||
m_Strings,
|
m_Strings,
|
||||||
|
m_DateTime,
|
||||||
mUtil_Common,
|
mUtil_Common,
|
||||||
mUtil_Status;
|
mUtil_Status,
|
||||||
|
bbs_MsgBase_ABS,
|
||||||
|
bbs_MsgBase_JAM,
|
||||||
|
bbs_MsgBase_Squish;
|
||||||
|
|
||||||
Procedure uPurgeMessageBases;
|
Procedure uPurgeMessageBases;
|
||||||
|
Var
|
||||||
|
PurgeTotal : LongInt = 0;
|
||||||
|
PurgeBase : LongInt;
|
||||||
|
BaseFile : File of RecMessageBase;
|
||||||
|
Base : RecMessageBase;
|
||||||
|
MsgBase : PMsgBaseABS;
|
||||||
Begin
|
Begin
|
||||||
ProcessName ('Purging Message Bases', True);
|
ProcessName ('Purging Message Bases', True);
|
||||||
ProcessResult (rWORKING, False);
|
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);
|
ProcessResult (rDONE, True);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ Begin
|
||||||
UnixToDT (MsgHdr.DateWritten, MsgDateTime);
|
UnixToDT (MsgHdr.DateWritten, MsgDateTime);
|
||||||
PackTime (MsgDateTime, Temp);
|
PackTime (MsgDateTime, Temp);
|
||||||
|
|
||||||
LimitKill := DaysAgo(Temp) > MBase.MaxAge;
|
LimitKill := DaysAgo(Temp, 2) > MBase.MaxAge;
|
||||||
Killed := Killed or LimitKill;
|
Killed := Killed or LimitKill;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue