Skip to content
Snippets Groups Projects
Commit 2574aaf9 authored by Eric Oulashin's avatar Eric Oulashin
Browse files

DDMsgReader: New command-line option: -indexModeScope, which can specify the...

DDMsgReader: New command-line option: -indexModeScope, which can specify the indexed reader scope (group/all) without prompting the user.
parent 5dce87ee
No related branches found
No related tags found
1 merge request!385DDMR fix for indexed mode reading (not newscan): Showing the first unread message when selecting a sub-board, updating scan pointer, and selecting the next sub-board when done with the current sub-board
Pipeline #5225 passed
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -124,7 +124,10 @@
* Fix: For indexed read mode (not doing a newscan), when choosing a sub-board to
* read, the correct (first unread) message is displayed. Also, the user's scan
* pointer is also updated to the last_read pointer.
* 2024-01-06 Eric Oulashin Version 1.93a
* 2024-01-07 Eric Oulashin Version 1.93a
* New operator option for read mode: Add author email to email.can.
* New command-line option: -indexModeScope, which can specify the indexed
* reader scope (group/all) without prompting the user.
* Releasing this version
*/
 
......@@ -232,7 +235,7 @@ var hexdump = load('hexdump_lib.js');
 
// Reader version information
var READER_VERSION = "1.93a";
var READER_DATE = "2024-01-06";
var READER_DATE = "2024-01-07";
 
// Keyboard key codes for displaying on the screen
var UP_ARROW = ascii(24);
......@@ -574,14 +577,26 @@ if (gDoDDMR)
{
console.attributes = "N";
console.crlf();
var scopeChar = "";
if (typeof(gCmdLineArgVals.indexmodescope) === "string")
{
var argScopeLower = gCmdLineArgVals.indexmodescope.toLowerCase();
if (argScopeLower == "group" || argScopeLower == "grp")
scopeChar = "G";
else if (argScopeLower == "all")
scopeChar = "A";
}
if (scopeChar == "")
{
console.mnemonics("Indexed read: ~Group: @GRP@, or ~@All@: ");
var scopeChar = console.getkeys("GA").toString();
scopeChar = console.getkeys("GA").toString();
}
if (typeof(scopeChar) === "string" && scopeChar != "")
{
var scanScope = SCAN_SCOPE_ALL;
if (scopeChar == "G")
scanScope = SCAN_SCOPE_GROUP;
else if (scopeChar == "G")
else if (scopeChar == "A")
scanScope = SCAN_SCOPE_ALL;
msgReader.DoIndexedMode(scanScope, false);
}
......@@ -1082,10 +1097,10 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs)
userSettings: CTRL_U,
validateMsg: "A", // Only if the user is a sysop
quickValUser: CTRL_Q,
threadView: "*", // TODO: Implement this
operatorMenu: CTRL_O,
showMsgHex: "X",
hexDump: CTRL_X,
threadView: "*" // TODO: Implement this
hexDump: CTRL_X
};
//if (user.is_sysop)
// this.enhReaderKeys.validateMsg = "A";
......@@ -1576,7 +1591,8 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs)
showMsgHex: 5,
saveMsgHexToFile: 6,
quickValUser: 7,
addAuthorToTwitList: 8
addAuthorToTwitList: 8,
addAuthorEmailToEmailFilter: 9
};
 
// For indexed mode, whether to set the indexed mode menu item index to 1 more when showing
......@@ -6448,6 +6464,24 @@ function DigDistMsgReader_ReadMessageEnhanced_Scrollable(msgHeader, allowChgMsgA
this.DisplayEnhancedMsgReadHelpLine(console.screen_rows, allowChgMsgArea);
}
break;
case this.readerOpMenuOptValues.addAuthorEmailToEmailFilter:
var fromEmailAddr = "";
if (typeof(msgHeader.from_net_addr) === "string" && msgHeader.from_net_addr.length > 0)
{
if (msgHeader.from_net_type == NET_INTERNET)
fromEmailAddr = msgHeader.from_net_addr;
else
fromEmailAddr = msgHeader.from + "@" + msgHeader.from_net_addr;
}
var promptTxt = format("Add %s to global email filter", fromEmailAddr);
if (this.EnhReaderPromptYesNo(promptTxt, msgInfo.messageLines, topMsgLineIdx, msgLineFormatStr, solidBlockStartRow, numSolidScrollBlocks, true))
{
var statusMsg = "\x01n" + addToGlobalEmailFilter(fromEmailAddr) ? "\x01w\x01hSuccessfully updated the email filter" : "\x01y\x01hFailed to update the email filter!"
writeWithPause(1, console.screen_rows, statusMsg, ERROR_PAUSE_WAIT_MS, "\x01n", true);
console.attributes = "N";
this.DisplayEnhancedMsgReadHelpLine(console.screen_rows, allowChgMsgArea);
}
break;
}
}
}
......@@ -7768,6 +7802,25 @@ function DigDistMsgReader_ReadMessageEnhanced_Traditional(msgHeader, allowChgMsg
console.pause();
}
break;
case this.readerOpMenuOptValues.addAuthorEmailToEmailFilter:
var fromEmailAddr = "";
if (typeof(msgHeader.from_net_addr) === "string" && msgHeader.from_net_addr.length > 0)
{
if (msgHeader.from_net_type == NET_INTERNET)
fromEmailAddr = msgHeader.from_net_addr;
else
fromEmailAddr = msgHeader.from + "@" + msgHeader.from_net_addr;
}
var promptTxt = format("Add %s to global email filter", fromEmailAddr);
if (!console.noyes(promptTxt))
{
var statusMsg = "\x01n" + addToGlobalEmailFilter(fromEmailAddr) ? "\x01w\x01hSuccessfully updated the email filter" : "\x01y\x01hFailed to update the email filter!"
console.print(statusMsg);
console.attributes = "N";
console.crlf();
console.pause();
}
break;
}
}
}
......@@ -7859,7 +7912,7 @@ function DigDistMsgReader_CreateReadModeOpMenu()
var subBoardIsModerated = (this.subBoardCode != "mail" && msg_area.sub[this.subBoardCode].is_moderated);
 
var opMenuWidth = 35;
var opMenuHeight = 10;
var opMenuHeight = 11;
if (subBoardIsModerated)
++opMenuHeight;
var opMenuX = Math.floor(console.screen_columns/2) - Math.floor(opMenuWidth/2);
......@@ -7882,6 +7935,7 @@ function DigDistMsgReader_CreateReadModeOpMenu()
opMenu.Add("&E: Save message hex to file", this.readerOpMenuOptValues.saveMsgHexToFile);
opMenu.Add("&A: Quick validate the user", this.readerOpMenuOptValues.quickValUser);
opMenu.Add("&I: Add author to twit list", this.readerOpMenuOptValues.addAuthorToTwitList);
opMenu.Add("&M: Add author to email filter", this.readerOpMenuOptValues.addAuthorEmailToEmailFilter);
// Use cyan for the item color, and cyan with blue background for selected item color
opMenu.colors.itemColor = "\x01n\x01c";
opMenu.colors.selectedItemColor = "\x01n\x01c\x014";
......@@ -7896,6 +7950,7 @@ function DigDistMsgReader_CreateReadModeOpMenu()
opMenu.Add("Save message hex to file", this.readerOpMenuOptValues.saveMsgHexToFile);
opMenu.Add("Quick validate the user", this.readerOpMenuOptValues.quickValUser);
opMenu.Add("Add author to twit list", this.readerOpMenuOptValues.addAuthorToTwitList);
opMenu.Add("Add author to email filter", this.readerOpMenuOptValues.addAuthorEmailToEmailFilter);
// Use green for the item color and high cyan for the item number color
opMenu.colors.itemColor = "\x01n\x01g";
opMenu.colors.itemNumColor = "\x01n\x01c\x01h";
......@@ -23999,6 +24054,69 @@ function entryExistsInTwitList(pStr)
return entryExists;
}
 
// Adds to the global email filter (email.can).
//
// Parameters:
// pEmailAddr: An email address
//
// Return value: Boolean - Whether or not this was successful
function addToGlobalEmailFilter(pEmailAddr)
{
if (typeof(pEmailAddr) !== "string")
return false;
var wasSuccessful = true;
if (!entryExistsInGlobalEmailFilter(pEmailAddr))
{
wasSuccessful = false;
var filterFile = new File(system.text_dir + "email.can");
//if (filterFile.open(filterFile.exists ? "r+" : "w+"))
if (filterFile.open("a"))
{
wasSuccessful = filterFile.writeln(pEmailAddr);
filterFile.close();
}
}
return wasSuccessful;
}
// Returns whether an entry exists in the global email filter (email.can).
//
// Parameters:
// pEmailAddr: An entry to check in the twit list
//
// Return value: Boolean - Whether or not the given string exists in the twit list
function entryExistsInGlobalEmailFilter(pEmailAddr)
{
if (typeof(pEmailAddr) !== "string")
return false;
var entryExists = false;
var filterFile = new File(system.text_dir + "email.can");
if (filterFile.open("r"))
{
while (!filterFile.eof && !entryExists)
{
//// Read the next line from the config file.
var fileLine = filterFile.readln(2048);
// fileLine should be a string, but I've seen some cases
// where for some reason it isn't. If it's not a string,
// then continue onto the next line.
if (typeof(fileLine) != "string")
continue;
// If the line starts with with a semicolon (the comment
// character) or is blank, then skip it.
if ((fileLine.substr(0, 1) == ";") || (fileLine.length == 0))
continue;
// See if this line matches the given string
entryExists = (pEmailAddr == skipsp(truncsp(fileLine)));
}
filterFile.close();
}
return entryExists;
}
///////////////////////////////////////////////////////////////////////////////////
 
// For debugging: Writes some text on the screen at a given location with a given pause.
......
Digital Distortion Message Reader
Version 1.93a
Release date: 2024-01-06
Release date: 2024-01-07
by
......@@ -312,6 +312,8 @@ The following are the command-line parameters supported by DDMsgReader.js:
user wants to list sub-boards in the current group, or all
sub-boards.
This is intended to work if it is the only command-line option.
-indexModeScope: Specifies the scope (set of sub-boards) for indexed reader mode
with -indexedMode. Valid values are "group" or "all".
-search: A search type. Available options:
keyword_search: Do a keyword search in message subject/body text (current message area)
from_name_search: 'From' name search (current message area)
......@@ -452,6 +454,14 @@ common message operations.
- Start in indexed reader mode:
?../xtrn/DDMsgReader/DDMsgReader.js -indexedMode
- Start in indexed reader mode for the sub-boards in the current group (without
prompting):
?../xtrn/DDMsgReader/DDMsgReader.js -indexedMode -indexModeScope=group
- Start in indexed reader mode for all sub-boards(without prompting):
?../xtrn/DDMsgReader/DDMsgReader.js -indexedMode -indexModeScope=all
- Text (keyword) search in the current sub-board, and list the messages found:
?../xtrn/DDMsgReader/DDMsgReader.js -search=keyword_search -startMode=list
......@@ -1248,10 +1258,14 @@ Indexed reader mode may also be started with the -indexedMode command-line
parameter. For example, if you are using a JavaScript command shell:
bbs.exec("?../xtrn/DDMsgReader/DDMsgReader.js -indexedMode");
With the above command-line parameter, DDMsgReader will show all sub-boards the
user is allowed to read and which they have in their newscan configuration.
If the user has enabled indexed mode for newscans, then during a newscan, it
will show sub-boards based on the user's chosen option for current
sub-board/group/all.
user is allowed to read. It will prompt the user to use sub-boards in the
current group or all sub-boards.
To have it start in indexed reader for the current group without prompting:
bbs.exec("?../xtrn/DDMsgReader/DDMsgReader.js -indexedMode -indexModeScope=group");
To have it start in indexed reader for all sub-boards without prompting:
bbs.exec("?../xtrn/DDMsgReader/DDMsgReader.js -indexedMode -indexModeScope=all");
This is an example of the sub-board menu that appears in indexed mode - And from
here, the user can choose a sub-board to read:
......
......@@ -5,10 +5,15 @@ Revision History (change log)
=============================
Version Date Description
------- ---- -----------
1.93a 2024-01-06 Fix: For indexed read mode (not doing a newscan), when
1.93a 2024-01-07 Fix: For indexed read mode (not doing a newscan), when
choosing a sub-board to read, the correct (first unread)
message is displayed. Also, the user's scan pointer is
also updated to the last_read pointer.
New operator option for read mode: Add author email to
email.can
New command-line option: -indexModeScope, which can
specify the indexed reader scope (group/all) without
prompting the user.
1.93 2024-01-01 New user-toggleable behavior: Show indexed menu after
reading all new messages
Also, indexed reader mode (started with the -indexedMode
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment