Skip to content
Snippets Groups Projects
Commit 3cae636c authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Merge branch 'dd_msg_reader_save_all_msg_headers_optional' into 'master'

DD Message Reader: Including all message headers when saving a message (sysop...

See merge request !319
parents 49e007b7 e0e455a9
No related branches found
No related tags found
2 merge requests!463MRC mods by Codefenix (2024-10-20),!319DD Message Reader: Including all message headers when saving a message (sysop...
Pipeline #4654 passed
......@@ -63,5 +63,9 @@ enableIndexedModeMsgListCache=true
; menu of quick-validation sets, you can set this to an invalid index (such as -1).
quickUserValSetIndex=-1
; For the sysop, whether to save all message headers when saving a message to the BBS
; PC. This could be a boolean (true/false) or the string "ask" to prompt every time
saveAllHdrsWhenSavingMsgToBBSPC=false
; The theme file name (for colors, strings, etc.)
themeFilename=DefaultTheme.cfg
......@@ -141,6 +141,9 @@
* 2023-08-18 Eric Oulashin Version 1.76
* Fix for "Message header has 'expanded fields'" error when updating message
* header attributes in certain conditions
* 2023-08-20 Eric Oulashin Version 1.77
* Including all message headers when saving a message (sysop only) is now
* optional.
*/
 
"use strict";
......@@ -247,8 +250,8 @@ var ansiterm = require("ansiterm_lib.js", 'expand_ctrl_a');
 
 
// Reader version information
var READER_VERSION = "1.76";
var READER_DATE = "2023-08-18";
var READER_VERSION = "1.77";
var READER_DATE = "2023-08-20";
 
// Keyboard key codes for displaying on the screen
var UP_ARROW = ascii(24);
......@@ -1159,6 +1162,10 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs)
// an invalid index (such as -1) to show a menu of quick-validation values
this.quickUserValSetIndex = -1;
 
// For the sysop, whether to save all message headers when saving a message to the BBS
// PC. This could be a boolean (true/false) or the string "ask" to prompt every time
this.saveAllHdrsWhenSavingMsgToBBSPC = false;
this.cfgFilename = "DDMsgReader.cfg";
// Check the command-line arguments for a custom configuration file name
// before reading the configuration file. Defaults to the current user
......@@ -5688,10 +5695,10 @@ function DigDistMsgReader_ReadMessageEnhanced_Scrollable(msgHeader, allowChgMsgA
console.print("\x01n\x01cFilename:\x01h");
var inputLen = console.screen_columns - 10; // 10 = "Filename:" length + 1
var filename = console.getstr(inputLen, K_NOCRLF);
console.print("\x01n");
console.attributes = "N";
if (filename.length > 0)
{
var saveMsgRetObj = this.SaveMsgToFile(msgHeader, filename);
var saveMsgRetObj = this.SaveMsgToFile(msgHeader, filename, promptPos);
console.gotoxy(promptPos);
console.cleartoeol("\x01n");
console.gotoxy(promptPos);
......@@ -8436,6 +8443,8 @@ function DigDistMsgReader_ReadConfigFile()
if (!file_exists(themeFilename))
themeFilename = gStartupPath + settingsObj.themeFilename;
}
if (settingsObj.hasOwnProperty("saveAllHdrsWhenSavingMsgToBBSPC"))
this.saveAllHdrsWhenSavingMsgToBBSPC = settingsObj["saveAllHdrsWhenSavingMsgToBBSPC"];
}
else
{
......@@ -14708,11 +14717,15 @@ function DigDistMsgReader_MakeLightbarIndexedModeMenu(pNumMsgsWidth, pNumNewMsgs
// Parameters:
// pMsgHdr: The header object for the message
// pFilename: The name of the file to write the message to
// pPromptPos: Optional - An object containing x & y coordinates for the prompot position,
// if using the ANSI interfce. If this is a valid object with x & y, this
// will be used for cursor positioning before prompting to save all message
// headers (if applicable).
//
// Return value: An object containing the following properties:
// succeeded: Boolean - Whether or not the file was successfully written
// errorMsg: String - On failure, will contain the reason it failed
function DigDistMsgReader_SaveMsgToFile(pMsgHdr, pFilename)
function DigDistMsgReader_SaveMsgToFile(pMsgHdr, pFilename, pPromptPos)
{
// Sanity checking
if (typeof(pMsgHdr) !== "object")
......@@ -14741,9 +14754,43 @@ function DigDistMsgReader_SaveMsgToFile(pMsgHdr, pFilename)
var messageSaveFile = new File(pFilename);
if (messageSaveFile.open("w"))
{
// Write the header information to the file
for (var i = 0; i < hdrLines.length; ++i)
messageSaveFile.writeln(hdrLines[i]);
var writeAllHeaders = false;
if (typeof(this.saveAllHdrsWhenSavingMsgToBBSPC) === "boolean")
writeAllHeaders = this.saveAllHdrsWhenSavingMsgToBBSPC;
else if (typeof(this.saveAllHdrsWhenSavingMsgToBBSPC) === "string" && this.saveAllHdrsWhenSavingMsgToBBSPC.toUpperCase() == "ASK")
{
console.attributes = "N";
if (typeof(pPromptPos) === "object" && pPromptPos.hasOwnProperty("x") && pPromptPos.hasOwnProperty("y"))
{
console.gotoxy(pPromptPos);
console.cleartoeol("\x01n");
console.gotoxy(pPromptPos);
}
writeAllHeaders = !console.noyes("Write all headers to saved message");
}
if (writeAllHeaders)
{
// Write all header information to the file
for (var i = 0; i < hdrLines.length; ++i)
messageSaveFile.writeln(hdrLines[i]);
}
else
{
// Write to, from, subjetc, etc. to the file
if (this.subBoardCode == "mail")
messageSaveFile.writeln("From " + pMsgHdr.from + "'s personal email");
else
{
var line = format("From sub-board: %s, %s",
msg_area.grp_list[msg_area.sub[this.subBoardCode].grp_index].description,
msg_area.sub[this.subBoardCode].description);
messageSaveFile.writeln(line);
}
messageSaveFile.writeln("From: " + pMsgHdr.from);
messageSaveFile.writeln("To: " + pMsgHdr.to);
messageSaveFile.writeln("Subject: " + pMsgHdr.subject);
}
messageSaveFile.writeln("===============================");
 
// If the message body has ANSI, then use the Graphic object to strip it
......
Digital Distortion Message Reader
Version 1.76
Release date: 2023-08-18
Version 1.77
Release date: 2023-08-20
by
......@@ -747,8 +747,12 @@ quickUserValSetIndex The index of the quick-validation set to
quickUserValSetIndex can be set to
something invalid (like -1) to have a menu
of the quick-validation sets displayed for
you to choose from
one.
you to choose from one.
saveAllHdrsWhenSavingMsgToBBSPC For the sysop, whether to save all message
headers when saving a message to the BBS
PC. This could be a boolean (true/false)
or the string "ask" to prompt every time
themeFilename The name of the configuration file to
use for colors & string settings
......
......@@ -5,6 +5,8 @@ Revision History (change log)
=============================
Version Date Description
------- ---- -----------
1.77 2023-07-20 Including all message headers when saving a message (sysop
only) is now optional.
1.76 2023-08-18 Fix for "Message header has 'expanded fields'" error when
updating message header attributes in certain conditions
1.75 2023-08-16 Made some changes to allow easy searching of personal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment