mUtil message post, message purge

This commit is contained in:
mysticbbs 2012-09-26 16:51:07 -04:00
parent ef161cbc9c
commit 7964933a16
10 changed files with 125 additions and 32 deletions

View File

@ -4900,3 +4900,14 @@
! MBBSUTIL BBS list packer was not working properly when checking
verification days.
+ MUTIL now has a message posting function. This function can post any
number of text files to a message base, including echomail and netmail
bases. It will also split large posts into multple messages - allowing
up to 10,000 line text files to be posted. To enable, add this to your
[GENERAL] section of your mUtil .INI configuration files:
PostTextFiles = true
Then add the [PostTextFiles] section from the default mutil.ini from a
new install.

View File

@ -52,17 +52,16 @@ Uses
mUtil_AllFiles,
mUtil_MsgPurge,
mUtil_MsgPack,
mUtil_MsgPost;
mUtil_MsgPost,
bbs_Common;
{$I MUTIL_ANSI.PAS}
Function CheckProcess (pName: String) : Boolean;
Begin
Result := False;
If strUpper(INI.ReadString(Header_General, pName, 'FALSE')) = 'TRUE' Then Begin
Result := True;
Result := INI.ReadBoolean(Header_General, pName, False);
If Result Then Begin
Inc (ProcessTotal);
Log (2, '+', ' EXEC ' + pName);

View File

@ -13,7 +13,8 @@ Uses
m_Strings,
m_FileIO,
mUtil_Common,
mUtil_Status;
mUtil_Status,
bbs_Common;
Const
TotalFiles : Cardinal = 0;

View File

@ -7,9 +7,11 @@ Interface
Uses
m_Output,
m_IniReader,
mutil_Status;
{$I RECORDS.PAS}
mutil_Status,
bbs_Common,
bbs_MsgBase_Abs,
bbs_MsgBase_Squish,
bbs_MsgBase_JAM;
Var
Console : TOutput;
@ -47,6 +49,8 @@ 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;
Function MessageBaseOpen (Var Msg: PMsgBaseABS; Var Area: RecMessageBase) : Boolean;
Function SaveMessage (mArea: RecMessageBase; mFrom, mTo, mSubj: String; mAddr: RecEchoMailAddr; mText: RecMessageText; mLines: Integer) : Boolean;
Implementation
@ -313,4 +317,88 @@ Begin
Close (F);
End;
Function MessageBaseOpen (Var Msg: PMsgBaseABS; Var Area: RecMessageBase) : Boolean;
Begin
Result := False;
Case Area.BaseType of
0 : Msg := New(PMsgBaseJAM, Init);
1 : Msg := New(PMsgBaseSquish, Init);
End;
Msg^.SetMsgPath (Area.Path + Area.FileName);
Msg^.SetTempFile (TempPath + 'msgbuf.tmp');
If Not Msg^.OpenMsgBase Then
If Not Msg^.CreateMsgBase (Area.MaxMsgs, Area.MaxAge) Then Begin
Dispose (Msg, Done);
Exit;
End Else
If Not Msg^.OpenMsgBase Then Begin
Dispose (Msg, Done);
Exit;
End;
Result := True;
End;
Function SaveMessage (mArea: RecMessageBase; mFrom, mTo, mSubj: String; mAddr: RecEchoMailAddr; mText: RecMessageText; mLines: Integer) : Boolean;
Var
SemFile : File;
Count : SmallInt;
Msg : PMsgBaseABS;
Begin
Result := False;
If Not MessageBaseOpen(Msg, mArea) Then Exit;
Msg^.StartNewMsg;
Msg^.SetLocal (True);
If mArea.NetType > 0 Then Begin
If mArea.NetType = 2 Then Begin
Msg^.SetMailType (mmtNetMail);
Msg^.SetCrash (bbsConfig.netCrash);
Msg^.SetHold (bbsConfig.netHold);
Msg^.SetKillSent (bbsConfig.netKillSent);
Msg^.SetDest (mAddr);
End Else
Msg^.SetMailType (mmtEchoMail);
Msg^.SetOrig(bbsConfig.NetAddress[mArea.NetAddr]);
Case mArea.NetType of
1 : Assign (SemFile, Config.SemaPath + fn_SemFileEcho);
2 : Assign (SemFile, Config.SemaPath + fn_SemFileNews);
3 : Assign (SemFile, Config.SemaPath + fn_SemFileNet);
End;
ReWrite (SemFile);
Close (SemFile);
End Else
Msg^.SetMailType (mmtNormal);
Msg^.SetPriv (mArea.Flags And MBPrivate <> 0);
Msg^.SetDate (DateDos2Str(CurDateDos, 1));
Msg^.SetTime (TimeDos2Str(CurDateDos, False));
Msg^.SetFrom (mFrom);
Msg^.SetTo (mTo);
Msg^.SetSubj (mSubj);
For Count := 1 to mLines Do
Msg^.DoStringLn(mText[Count]);
If mArea.NetType > 0 Then Begin
Msg^.DoStringLn (#13 + '--- ' + mysSoftwareID + ' BBS v' + mysVersion + ' (' + OSID + ')');
Msg^.DoStringLn (' * Origin: ' + mArea.Origin + ' (' + strAddr2Str(Config.NetAddress[mArea.NetAddr]) + ')');
End;
Msg^.WriteMsg;
Msg^.CloseMsgBase;
Dispose (Msg, Done);
Result := True;
End;
End.

View File

@ -12,8 +12,9 @@ Uses
m_Types,
m_Strings,
m_FileIO,
mutil_Common,
mutil_Status;
mUtil_Common,
mUtil_Status,
bbs_Common;
Procedure uImportFileBone;
Var

View File

@ -13,7 +13,8 @@ Uses
m_FileIO,
m_DateTime,
mUtil_Common,
mUtil_Status;
mUtil_Status,
bbs_Common;
Procedure uImportFilesBBS;
Var

View File

@ -10,8 +10,9 @@ Implementation
Uses
m_Strings,
mutil_Common,
mutil_Status;
mUtil_Common,
mUtil_Status,
bbs_Common;
Procedure uImportNA;
Var

View File

@ -13,6 +13,7 @@ Uses
m_DateTime,
mUtil_Common,
mUtil_Status,
bbs_Common,
bbs_MsgBase_ABS,
bbs_MsgBase_JAM,
bbs_MsgBase_Squish;
@ -40,19 +41,7 @@ Begin
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 Not MessageBaseOpen(MsgBase, Base) Then Continue;
If Base.MaxAge > 0 Then Begin
MsgBase^.SeekFirst(1);

View File

@ -12,8 +12,9 @@ Uses
m_QuickSort,
m_Strings,
m_FileIO,
mutil_Common,
mutil_Status;
mUtil_Common,
mUtil_Status,
bbs_Common;
Type
TopListType = (TopCall, TopPost, TopDL, TopUL, TopPCR);

View File

@ -11,8 +11,9 @@ Uses
m_FileIO,
m_Strings,
m_DateTime,
mutil_Common,
mutil_Status;
mUtil_Common,
mUtil_Status,
bbs_Common;
Procedure uMassUpload;
Var