From 7964933a162d29d2b02b1ad79210fe176f03a34a Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Wed, 26 Sep 2012 16:51:07 -0400 Subject: [PATCH] mUtil message post, message purge --- mystic/HISTORY.txt | 11 +++++ mystic/mutil.pas | 9 ++-- mystic/mutil_allfiles.pas | 3 +- mystic/mutil_common.pas | 96 +++++++++++++++++++++++++++++++++++++-- mystic/mutil_filebone.pas | 5 +- mystic/mutil_filesbbs.pas | 3 +- mystic/mutil_importna.pas | 5 +- mystic/mutil_msgpurge.pas | 15 +----- mystic/mutil_toplists.pas | 5 +- mystic/mutil_upload.pas | 5 +- 10 files changed, 125 insertions(+), 32 deletions(-) diff --git a/mystic/HISTORY.txt b/mystic/HISTORY.txt index 5c2a98e..cc15b73 100644 --- a/mystic/HISTORY.txt +++ b/mystic/HISTORY.txt @@ -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. diff --git a/mystic/mutil.pas b/mystic/mutil.pas index 6c31ed5..b17aec6 100644 --- a/mystic/mutil.pas +++ b/mystic/mutil.pas @@ -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); diff --git a/mystic/mutil_allfiles.pas b/mystic/mutil_allfiles.pas index 2d0de7d..57017e6 100644 --- a/mystic/mutil_allfiles.pas +++ b/mystic/mutil_allfiles.pas @@ -13,7 +13,8 @@ Uses m_Strings, m_FileIO, mUtil_Common, - mUtil_Status; + mUtil_Status, + bbs_Common; Const TotalFiles : Cardinal = 0; diff --git a/mystic/mutil_common.pas b/mystic/mutil_common.pas index 7413896..d655585 100644 --- a/mystic/mutil_common.pas +++ b/mystic/mutil_common.pas @@ -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; -End. \ No newline at end of file +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. diff --git a/mystic/mutil_filebone.pas b/mystic/mutil_filebone.pas index a4c88b9..a01f0a7 100644 --- a/mystic/mutil_filebone.pas +++ b/mystic/mutil_filebone.pas @@ -12,8 +12,9 @@ Uses m_Types, m_Strings, m_FileIO, - mutil_Common, - mutil_Status; + mUtil_Common, + mUtil_Status, + bbs_Common; Procedure uImportFileBone; Var diff --git a/mystic/mutil_filesbbs.pas b/mystic/mutil_filesbbs.pas index 4d37498..ed38163 100644 --- a/mystic/mutil_filesbbs.pas +++ b/mystic/mutil_filesbbs.pas @@ -13,7 +13,8 @@ Uses m_FileIO, m_DateTime, mUtil_Common, - mUtil_Status; + mUtil_Status, + bbs_Common; Procedure uImportFilesBBS; Var diff --git a/mystic/mutil_importna.pas b/mystic/mutil_importna.pas index e2c7d3e..5ee064d 100644 --- a/mystic/mutil_importna.pas +++ b/mystic/mutil_importna.pas @@ -10,8 +10,9 @@ Implementation Uses m_Strings, - mutil_Common, - mutil_Status; + mUtil_Common, + mUtil_Status, + bbs_Common; Procedure uImportNA; Var diff --git a/mystic/mutil_msgpurge.pas b/mystic/mutil_msgpurge.pas index d1cec0a..7d0ab24 100644 --- a/mystic/mutil_msgpurge.pas +++ b/mystic/mutil_msgpurge.pas @@ -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); diff --git a/mystic/mutil_toplists.pas b/mystic/mutil_toplists.pas index 835d56c..0cbdcf3 100644 --- a/mystic/mutil_toplists.pas +++ b/mystic/mutil_toplists.pas @@ -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); diff --git a/mystic/mutil_upload.pas b/mystic/mutil_upload.pas index c2bd32a..1bfbf6a 100644 --- a/mystic/mutil_upload.pas +++ b/mystic/mutil_upload.pas @@ -11,8 +11,9 @@ Uses m_FileIO, m_Strings, m_DateTime, - mutil_Common, - mutil_Status; + mUtil_Common, + mUtil_Status, + bbs_Common; Procedure uMassUpload; Var