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

Merge branch...

Merge branch 'ddmr_show_indexed_newscan_menu_after_reading_new_msgs_and_full_indexed_reader_mode' into 'master'

DDMsgReader: New user-toggleable behavior: Show indexed menu after reading all new messages. Indexed reader mode (with -indexedMode command-line parameter) uses all sub-boards instead of just newscan sub-boards

See merge request !383
parents 91504452 05fdd9c2
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
...@@ -114,6 +114,12 @@ ...@@ -114,6 +114,12 @@
* setting to toggle whether to use the indexed newscan menu even if there are * setting to toggle whether to use the indexed newscan menu even if there are
* no new messages. New configuration file option: displayIndexedModeMenuIfNoNewMessages, * no new messages. New configuration file option: displayIndexedModeMenuIfNoNewMessages,
* which is a default for the user setting. * which is a default for the user setting.
* 2024-01-01 Eric Oulashin Version 1.93
* New user-toggleable behavior: Show indexed menu after reading all new messages.
* Also, indexed reader mode (started with the -indexedMode command-line option)
* now lists ALL sub-boards, rather than only sub-boards the user has enabled
* for newscan. It also prompts the user to list sub-boards in the current group
* or all.
*/ */
   
"use strict"; "use strict";
...@@ -219,8 +225,8 @@ var hexdump = load('hexdump_lib.js'); ...@@ -219,8 +225,8 @@ var hexdump = load('hexdump_lib.js');
   
   
// Reader version information // Reader version information
var READER_VERSION = "1.92"; var READER_VERSION = "1.93";
var READER_DATE = "2023-12-29"; var READER_DATE = "2024-01-01";
   
// Keyboard key codes for displaying on the screen // Keyboard key codes for displaying on the screen
var UP_ARROW = ascii(24); var UP_ARROW = ascii(24);
...@@ -559,7 +565,26 @@ if (gDoDDMR) ...@@ -559,7 +565,26 @@ if (gDoDDMR)
} }
var msgReader = new DigDistMsgReader(readerSubCode, gCmdLineArgVals); var msgReader = new DigDistMsgReader(readerSubCode, gCmdLineArgVals);
if (gCmdLineArgVals.indexedmode) if (gCmdLineArgVals.indexedmode)
msgReader.DoIndexedMode(SCAN_SCOPE_ALL); {
console.attributes = "N";
console.crlf();
console.mnemonics("Indexed read: ~Group: @GRP@, or ~@All@: ");
var 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")
scanScope = SCAN_SCOPE_ALL;
msgReader.DoIndexedMode(scanScope, false);
}
else
{
console.putmsg(bbs.text(Aborted), P_SAVEATR);
console.pause();
}
}
else else
{ {
// If the option to choose a message area first was enabled on the command-line // If the option to choose a message area first was enabled on the command-line
...@@ -1136,6 +1161,8 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs) ...@@ -1136,6 +1161,8 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs)
indexedModeMenuSnapToFirstWithNew: false, indexedModeMenuSnapToFirstWithNew: false,
// Whether to display the indexed mode newscan menu when there are no new messages // Whether to display the indexed mode newscan menu when there are no new messages
displayIndexedModeMenuIfNoNewMessages: true, displayIndexedModeMenuIfNoNewMessages: true,
// Whether to show the indexed newscan menu after reading all new messages
showIndexedNewscanMenuAfterReadingAllNewMsgs: true,
// Whether or not to list messages in reverse order // Whether or not to list messages in reverse order
listMessagesInReverse: false, listMessagesInReverse: false,
// Whether or not quitting from the reader goes to the message list (instead of exiting altogether) // Whether or not quitting from the reader goes to the message list (instead of exiting altogether)
...@@ -2502,7 +2529,7 @@ function DigDistMsgReader_MessageAreaScan(pScanCfgOpt, pScanMode, pScanScopeChar ...@@ -2502,7 +2529,7 @@ function DigDistMsgReader_MessageAreaScan(pScanCfgOpt, pScanMode, pScanScopeChar
var scanScope = SCAN_SCOPE_ALL; var scanScope = SCAN_SCOPE_ALL;
if (scanScopeChar === "S") scanScope = SCAN_SCOPE_SUB_BOARD; if (scanScopeChar === "S") scanScope = SCAN_SCOPE_SUB_BOARD;
else if (scanScopeChar === "G") scanScope = SCAN_SCOPE_GROUP; else if (scanScopeChar === "G") scanScope = SCAN_SCOPE_GROUP;
msgReader.DoIndexedMode(scanScope); msgReader.DoIndexedMode(scanScope, true);
this.doingNewscan = false; this.doingNewscan = false;
return; return;
} }
...@@ -14853,6 +14880,9 @@ function DigDistMsgReader_GetGroupNameAndDesc() ...@@ -14853,6 +14880,9 @@ function DigDistMsgReader_GetGroupNameAndDesc()
// pDrawBottomhelpLineFn: A function to draw the bottom help line (it could be the message list // pDrawBottomhelpLineFn: A function to draw the bottom help line (it could be the message list
// help line or reader help line), for refreshing after displaying an error. // help line or reader help line), for refreshing after displaying an error.
// This function must take the reader (this) as a parameter. // This function must take the reader (this) as a parameter.
// pTopRowOverride: Optional - The row on the screen for the top line of the settings dialog.
// If not specified, then 1 below the top of the message area (for reader mode)
// will be used.
// //
// Return value: An object containing the following properties: // Return value: An object containing the following properties:
// needWholeScreenRefresh: Boolean - Whether or not the whole screen needs to be // needWholeScreenRefresh: Boolean - Whether or not the whole screen needs to be
...@@ -14862,7 +14892,7 @@ function DigDistMsgReader_GetGroupNameAndDesc() ...@@ -14862,7 +14892,7 @@ function DigDistMsgReader_GetGroupNameAndDesc()
// optionBoxWidth: The width of the option box // optionBoxWidth: The width of the option box
// optionBoxHeight: The height of the option box // optionBoxHeight: The height of the option box
// userTwitListChanged: Boolean - Whether or not the user's personal twit list changed // userTwitListChanged: Boolean - Whether or not the user's personal twit list changed
function DigDistMsgReader_DoUserSettings_Scrollable(pDrawBottomhelpLineFn) function DigDistMsgReader_DoUserSettings_Scrollable(pDrawBottomhelpLineFn, pTopRowOverride)
{ {
var retObj = { var retObj = {
needWholeScreenRefresh: false, needWholeScreenRefresh: false,
...@@ -14888,14 +14918,20 @@ function DigDistMsgReader_DoUserSettings_Scrollable(pDrawBottomhelpLineFn) ...@@ -14888,14 +14918,20 @@ function DigDistMsgReader_DoUserSettings_Scrollable(pDrawBottomhelpLineFn)
originalSettings[prop] = this.userSettings[prop]; originalSettings[prop] = this.userSettings[prop];
} }
   
// Create the user settings box // Create the user settings box
var optBoxTitle = "Setting Enabled"; var optBoxTitle = "Setting Enabled";
var optBoxWidth = ChoiceScrollbox_MinWidth(); var optBoxWidth = ChoiceScrollbox_MinWidth();
var optBoxHeight = 13; var optBoxHeight = 14;
var msgBoxTopRow = 1;
if (typeof(pTopRowOverride) === "number" && pTopRowOverride >= 1 && pTopRowOverride <= console.screen_rows - optBoxHeight + 1)
msgBoxTopRow = pTopRowOverride;
else
msgBoxTopRow = this.msgAreaTop + 1;
var optBoxStartX = this.msgAreaLeft + Math.floor((this.msgAreaWidth/2) - (optBoxWidth/2)); var optBoxStartX = this.msgAreaLeft + Math.floor((this.msgAreaWidth/2) - (optBoxWidth/2));
if (optBoxStartX < this.msgAreaLeft) if (optBoxStartX < this.msgAreaLeft)
optBoxStartX = this.msgAreaLeft; optBoxStartX = this.msgAreaLeft;
var optionBox = new ChoiceScrollbox(optBoxStartX, this.msgAreaTop+1, optBoxWidth, optBoxHeight, optBoxTitle, var optionBox = new ChoiceScrollbox(optBoxStartX, msgBoxTopRow, optBoxWidth, optBoxHeight, optBoxTitle,
null/*gConfigSettings*/, false, true); null/*gConfigSettings*/, false, true);
optionBox.addInputLoopExitKey(CTRL_U); optionBox.addInputLoopExitKey(CTRL_U);
// Update the bottom help text to be more specific to the user settings box // Update the bottom help text to be more specific to the user settings box
...@@ -14932,6 +14968,10 @@ function DigDistMsgReader_DoUserSettings_Scrollable(pDrawBottomhelpLineFn) ...@@ -14932,6 +14968,10 @@ function DigDistMsgReader_DoUserSettings_Scrollable(pDrawBottomhelpLineFn)
if (this.userSettings.displayIndexedModeMenuIfNoNewMessages) if (this.userSettings.displayIndexedModeMenuIfNoNewMessages)
optionBox.chgCharInTextItem(SHOW_INDEXED_NEWSCAN_MENU_IF_NO_NEW_MSGS_OPT_INDEX, checkIdx, CHECK_CHAR); optionBox.chgCharInTextItem(SHOW_INDEXED_NEWSCAN_MENU_IF_NO_NEW_MSGS_OPT_INDEX, checkIdx, CHECK_CHAR);
   
const INDEXED_MODE_NEWSCAN_MENU_AFTER_READING_ALL_NEW_MSGS_OPT_INDEX = optionBox.addTextItem(format(optionFormatStr, "Show indexed menu after reading all new msgs"));
if (this.userSettings.showIndexedNewscanMenuAfterReadingAllNewMsgs)
optionBox.chgCharInTextItem(INDEXED_MODE_NEWSCAN_MENU_AFTER_READING_ALL_NEW_MSGS_OPT_INDEX, checkIdx, CHECK_CHAR);
const INDEXED_MODE_MENU_SNAP_TO_NEW_MSGS_OPT_INDEX = optionBox.addTextItem(format(optionFormatStr, "Index menu: Snap to sub-boards w/ new messages")); const INDEXED_MODE_MENU_SNAP_TO_NEW_MSGS_OPT_INDEX = optionBox.addTextItem(format(optionFormatStr, "Index menu: Snap to sub-boards w/ new messages"));
if (this.userSettings.indexedModeMenuSnapToFirstWithNew) if (this.userSettings.indexedModeMenuSnapToFirstWithNew)
optionBox.chgCharInTextItem(INDEXED_MODE_MENU_SNAP_TO_NEW_MSGS_OPT_INDEX, checkIdx, CHECK_CHAR); optionBox.chgCharInTextItem(INDEXED_MODE_MENU_SNAP_TO_NEW_MSGS_OPT_INDEX, checkIdx, CHECK_CHAR);
...@@ -14959,6 +14999,7 @@ function DigDistMsgReader_DoUserSettings_Scrollable(pDrawBottomhelpLineFn) ...@@ -14959,6 +14999,7 @@ function DigDistMsgReader_DoUserSettings_Scrollable(pDrawBottomhelpLineFn)
optionToggles[NEWSCAN_ONLY_SHOW_NEW_MSGS_INDEX] = this.userSettings.newscanOnlyShowNewMsgs; optionToggles[NEWSCAN_ONLY_SHOW_NEW_MSGS_INDEX] = this.userSettings.newscanOnlyShowNewMsgs;
optionToggles[INDEXED_MODE_NEWSCAN_OPT_INDEX] = this.userSettings.useIndexedModeForNewscan; optionToggles[INDEXED_MODE_NEWSCAN_OPT_INDEX] = this.userSettings.useIndexedModeForNewscan;
optionToggles[SHOW_INDEXED_NEWSCAN_MENU_IF_NO_NEW_MSGS_OPT_INDEX] = this.userSettings.displayIndexedModeMenuIfNoNewMessages; optionToggles[SHOW_INDEXED_NEWSCAN_MENU_IF_NO_NEW_MSGS_OPT_INDEX] = this.userSettings.displayIndexedModeMenuIfNoNewMessages;
optionToggles[INDEXED_MODE_NEWSCAN_MENU_AFTER_READING_ALL_NEW_MSGS_OPT_INDEX] = this.userSettings.showIndexedNewscanMenuAfterReadingAllNewMsgs;
optionToggles[INDEXED_MODE_MENU_SNAP_TO_NEW_MSGS_OPT_INDEX] = this.userSettings.indexedModeMenuSnapToFirstWithNew; optionToggles[INDEXED_MODE_MENU_SNAP_TO_NEW_MSGS_OPT_INDEX] = this.userSettings.indexedModeMenuSnapToFirstWithNew;
optionToggles[INDEX_NEWSCAN_ENTER_SHOWS_MSG_LIST_OPT_INDEX] = this.userSettings.enterFromIndexMenuShowsMsgList; optionToggles[INDEX_NEWSCAN_ENTER_SHOWS_MSG_LIST_OPT_INDEX] = this.userSettings.enterFromIndexMenuShowsMsgList;
optionToggles[READER_QUIT_TO_MSG_LIST_OPT_INDEX] = this.userSettings.quitFromReaderGoesToMsgList; optionToggles[READER_QUIT_TO_MSG_LIST_OPT_INDEX] = this.userSettings.quitFromReaderGoesToMsgList;
...@@ -15004,6 +15045,9 @@ function DigDistMsgReader_DoUserSettings_Scrollable(pDrawBottomhelpLineFn) ...@@ -15004,6 +15045,9 @@ function DigDistMsgReader_DoUserSettings_Scrollable(pDrawBottomhelpLineFn)
case SHOW_INDEXED_NEWSCAN_MENU_IF_NO_NEW_MSGS_OPT_INDEX: case SHOW_INDEXED_NEWSCAN_MENU_IF_NO_NEW_MSGS_OPT_INDEX:
this.readerObj.userSettings.displayIndexedModeMenuIfNoNewMessages = !this.readerObj.userSettings.displayIndexedModeMenuIfNoNewMessages; this.readerObj.userSettings.displayIndexedModeMenuIfNoNewMessages = !this.readerObj.userSettings.displayIndexedModeMenuIfNoNewMessages;
break; break;
case INDEXED_MODE_NEWSCAN_MENU_AFTER_READING_ALL_NEW_MSGS_OPT_INDEX:
this.readerObj.userSettings.showIndexedNewscanMenuAfterReadingAllNewMsgs = !this.readerObj.userSettings.showIndexedNewscanMenuAfterReadingAllNewMsgs;
break;
case INDEXED_MODE_MENU_SNAP_TO_NEW_MSGS_OPT_INDEX: case INDEXED_MODE_MENU_SNAP_TO_NEW_MSGS_OPT_INDEX:
this.readerObj.userSettings.indexedModeMenuSnapToFirstWithNew = !this.readerObj.userSettings.indexedModeMenuSnapToFirstWithNew; this.readerObj.userSettings.indexedModeMenuSnapToFirstWithNew = !this.readerObj.userSettings.indexedModeMenuSnapToFirstWithNew;
break; break;
...@@ -15107,11 +15151,12 @@ function DigDistMsgReader_DoUserSettings_Traditional() ...@@ -15107,11 +15151,12 @@ function DigDistMsgReader_DoUserSettings_Traditional()
var NEWSCAN_ONLY_SHOW_NEW_MSGS_OPT_NUM = 2; var NEWSCAN_ONLY_SHOW_NEW_MSGS_OPT_NUM = 2;
var USE_INDEXED_MODE_FOR_NEWSCAN_OPT_NUM = 3; var USE_INDEXED_MODE_FOR_NEWSCAN_OPT_NUM = 3;
var SHOW_INDEXED_NEWSCAN_MENU_IF_NO_NEW_MSGS_OPT_NUM = 4; var SHOW_INDEXED_NEWSCAN_MENU_IF_NO_NEW_MSGS_OPT_NUM = 4;
var INDEX_NEWSCAN_ENTER_SHOWS_MSG_LIST_OPT_NUM = 5; var INDEXED_MODE_NEWSCAN_MENU_AFTER_READING_ALL_NEW_MSGS_OPT_INDEX = 5;
var READER_QUIT_TO_MSG_LIST_OPT_NUM = 6; var INDEX_NEWSCAN_ENTER_SHOWS_MSG_LIST_OPT_NUM = 6;
var PROPMT_DEL_PERSONAL_MSG_AFTER_REPLY_OPT_NUM = 7; var READER_QUIT_TO_MSG_LIST_OPT_NUM = 7;
var DISPLAY_PERSONAL_MAIL_REPLIED_INDICATOR_CHAR_OPT_NUM = 8; var PROPMT_DEL_PERSONAL_MSG_AFTER_REPLY_OPT_NUM = 8;
var USER_TWITLIST_OPT_NUM = 8; var DISPLAY_PERSONAL_MAIL_REPLIED_INDICATOR_CHAR_OPT_NUM = 9;
var USER_TWITLIST_OPT_NUM = 10;
var HIGHEST_CHOICE_NUM = USER_TWITLIST_OPT_NUM; var HIGHEST_CHOICE_NUM = USER_TWITLIST_OPT_NUM;
   
console.crlf(); console.crlf();
...@@ -15122,6 +15167,7 @@ function DigDistMsgReader_DoUserSettings_Traditional() ...@@ -15122,6 +15167,7 @@ function DigDistMsgReader_DoUserSettings_Traditional()
printTradUserSettingOption(NEWSCAN_ONLY_SHOW_NEW_MSGS_OPT_NUM, "Only show new messages for newscan", wordFirstCharAttrs, wordRemainingAttrs); printTradUserSettingOption(NEWSCAN_ONLY_SHOW_NEW_MSGS_OPT_NUM, "Only show new messages for newscan", wordFirstCharAttrs, wordRemainingAttrs);
printTradUserSettingOption(USE_INDEXED_MODE_FOR_NEWSCAN_OPT_NUM, "Use Indexed mode for newscan", wordFirstCharAttrs, wordRemainingAttrs); printTradUserSettingOption(USE_INDEXED_MODE_FOR_NEWSCAN_OPT_NUM, "Use Indexed mode for newscan", wordFirstCharAttrs, wordRemainingAttrs);
printTradUserSettingOption(SHOW_INDEXED_NEWSCAN_MENU_IF_NO_NEW_MSGS_OPT_NUM, "Show indexed menu if there are no new messages", wordFirstCharAttrs, wordRemainingAttrs); printTradUserSettingOption(SHOW_INDEXED_NEWSCAN_MENU_IF_NO_NEW_MSGS_OPT_NUM, "Show indexed menu if there are no new messages", wordFirstCharAttrs, wordRemainingAttrs);
printTradUserSettingOption(INDEXED_MODE_NEWSCAN_MENU_AFTER_READING_ALL_NEW_MSGS_OPT_INDEX, "Show indexed menu after reading all new messages", wordFirstCharAttrs, wordRemainingAttrs);
printTradUserSettingOption(INDEX_NEWSCAN_ENTER_SHOWS_MSG_LIST_OPT_NUM, "Index: Selection shows message list", wordFirstCharAttrs, wordRemainingAttrs); printTradUserSettingOption(INDEX_NEWSCAN_ENTER_SHOWS_MSG_LIST_OPT_NUM, "Index: Selection shows message list", wordFirstCharAttrs, wordRemainingAttrs);
printTradUserSettingOption(READER_QUIT_TO_MSG_LIST_OPT_NUM, "Quitting From reader goes to message list", wordFirstCharAttrs, wordRemainingAttrs); printTradUserSettingOption(READER_QUIT_TO_MSG_LIST_OPT_NUM, "Quitting From reader goes to message list", wordFirstCharAttrs, wordRemainingAttrs);
printTradUserSettingOption(PROPMT_DEL_PERSONAL_MSG_AFTER_REPLY_OPT_NUM, "Prompt to delete personal message after replying", wordFirstCharAttrs, wordRemainingAttrs); printTradUserSettingOption(PROPMT_DEL_PERSONAL_MSG_AFTER_REPLY_OPT_NUM, "Prompt to delete personal message after replying", wordFirstCharAttrs, wordRemainingAttrs);
...@@ -15158,6 +15204,11 @@ function DigDistMsgReader_DoUserSettings_Traditional() ...@@ -15158,6 +15204,11 @@ function DigDistMsgReader_DoUserSettings_Traditional()
this.userSettings.displayIndexedModeMenuIfNoNewMessages = !console.noyes("Show indexed menu if there are no new messages"); this.userSettings.displayIndexedModeMenuIfNoNewMessages = !console.noyes("Show indexed menu if there are no new messages");
userSettingsChanged = (this.userSettings.displayIndexedModeMenuIfNoNewMessages != oldIndexedMenuIfNoMsgsSetting); userSettingsChanged = (this.userSettings.displayIndexedModeMenuIfNoNewMessages != oldIndexedMenuIfNoMsgsSetting);
break; break;
case INDEXED_MODE_NEWSCAN_MENU_AFTER_READING_ALL_NEW_MSGS_OPT_INDEX:
var oldIndexedMenuAfterReadingAllNewMsgsSetting = this.userSettings.showIndexedNewscanMenuAfterReadingAllNewMsgs;
this.userSettings.showIndexedNewscanMenuAfterReadingAllNewMsgs = console.yesno("Show indexed menu after reading all new messages");
userSettingsChanged = (this.userSettings.showIndexedNewscanMenuAfterReadingAllNewMsgs != oldIndexedMenuAfterReadingAllNewMsgsSetting);
break;
case INDEX_NEWSCAN_ENTER_SHOWS_MSG_LIST_OPT_NUM: case INDEX_NEWSCAN_ENTER_SHOWS_MSG_LIST_OPT_NUM:
var oldIndexedModeEnterShowsMsgListSetting = this.userSettings.enterFromIndexMenuShowsMsgList; var oldIndexedModeEnterShowsMsgListSetting = this.userSettings.enterFromIndexMenuShowsMsgList;
this.userSettings.enterFromIndexMenuShowsMsgList = !console.noyes("Index menu: Show message list with enter"); this.userSettings.enterFromIndexMenuShowsMsgList = !console.noyes("Index menu: Show message list with enter");
...@@ -15238,12 +15289,15 @@ function printTradUserSettingOption(pOptNum, pStr, pWordFirstCharAttrs, pWordRem ...@@ -15238,12 +15289,15 @@ function printTradUserSettingOption(pOptNum, pStr, pWordFirstCharAttrs, pWordRem
// Parameters: // Parameters:
// pScanScope: Numeric - Whether to scan the current sub-board, group, or all. // pScanScope: Numeric - Whether to scan the current sub-board, group, or all.
// This would be SCAN_SCOPE_SUB_BOARD, SCAN_SCOPE_GROUP, or SCAN_SCOPE_ALL. // This would be SCAN_SCOPE_SUB_BOARD, SCAN_SCOPE_GROUP, or SCAN_SCOPE_ALL.
function DigDistMsgReader_DoIndexedMode(pScanScope) // pNewscanOnly: Boolean: Whether or not to only check sub-boards in the user's newscan configuration.
// Defaults to false.
function DigDistMsgReader_DoIndexedMode(pScanScope, pNewscanOnly)
{ {
var scanScope = (isValidScanScopeVal(pScanScope) ? pScanScope : SCAN_SCOPE_ALL); var scanScope = (isValidScanScopeVal(pScanScope) ? pScanScope : SCAN_SCOPE_ALL);
var newscanOnly = (typeof(pNewscanOnly) === "boolean" ? pNewscanOnly : false);
   
this.indexedMode = true; this.indexedMode = true;
this.doingMsgScan = true; this.doingMsgScan = newscanOnly;
   
// msgHdrsCache is used to prevent long loading again when loading a sub-board // msgHdrsCache is used to prevent long loading again when loading a sub-board
// a 2nd time or later. Only if this.enableIndexedModeMsgListCache is true. // a 2nd time or later. Only if this.enableIndexedModeMsgListCache is true.
...@@ -15259,7 +15313,7 @@ function DigDistMsgReader_DoIndexedMode(pScanScope) ...@@ -15259,7 +15313,7 @@ function DigDistMsgReader_DoIndexedMode(pScanScope)
var origNumNewMessages = 0; var origNumNewMessages = 0;
// Let the user choose a sub-board, and if their choice is valid, // Let the user choose a sub-board, and if their choice is valid,
// let them read the sub-board. // let them read the sub-board.
var indexRetObj = this.IndexedModeChooseSubBoard(clearScreenForMenu, drawMenu, writeBottomHelpLine, pScanScope); var indexRetObj = this.IndexedModeChooseSubBoard(clearScreenForMenu, drawMenu, writeBottomHelpLine, pScanScope, pNewscanOnly);
if (typeof(indexRetObj.numNewMsgs) === "number") if (typeof(indexRetObj.numNewMsgs) === "number")
origNumNewMessages = indexRetObj.numNewMsgs; origNumNewMessages = indexRetObj.numNewMsgs;
var userChoseAValidSubBoard = (typeof(indexRetObj.chosenSubCode) === "string" && msg_area.sub.hasOwnProperty(indexRetObj.chosenSubCode)); var userChoseAValidSubBoard = (typeof(indexRetObj.chosenSubCode) === "string" && msg_area.sub.hasOwnProperty(indexRetObj.chosenSubCode));
...@@ -15401,7 +15455,7 @@ function DigDistMsgReader_DoIndexedMode(pScanScope) ...@@ -15401,7 +15455,7 @@ function DigDistMsgReader_DoIndexedMode(pScanScope)
console.putmsg(pReader.indexedModeHelpLine); // console.putmsg() can process @-codes, which we use for mouse click tracking console.putmsg(pReader.indexedModeHelpLine); // console.putmsg() can process @-codes, which we use for mouse click tracking
console.attributes = "N"; console.attributes = "N";
} }
}); }, 2);
if (userSettingsRetObj.needWholeScreenRefresh) if (userSettingsRetObj.needWholeScreenRefresh)
{ {
drawMenu = true; drawMenu = true;
...@@ -15436,13 +15490,15 @@ function DigDistMsgReader_DoIndexedMode(pScanScope) ...@@ -15436,13 +15490,15 @@ function DigDistMsgReader_DoIndexedMode(pScanScope)
// pDisplayHelpLine: Whether or not to draw the help line at the bottom of the screen. Defaults to true. // pDisplayHelpLine: Whether or not to draw the help line at the bottom of the screen. Defaults to true.
// pScanScope: Numeric - Whether to scan the current sub-board, group, or all. // pScanScope: Numeric - Whether to scan the current sub-board, group, or all.
// This would be SCAN_SCOPE_SUB_BOARD, SCAN_SCOPE_GROUP, or SCAN_SCOPE_ALL. // This would be SCAN_SCOPE_SUB_BOARD, SCAN_SCOPE_GROUP, or SCAN_SCOPE_ALL.
// pNewscanOnly: Boolean: Whether or not to only check sub-boards in the user's newscan configuration.
// Defaults to false.
// //
// Return value: An object containing the following values: // Return value: An object containing the following values:
// chosenSubCode: The user's chosen sub-board code; if none selected, this will be null // chosenSubCode: The user's chosen sub-board code; if none selected, this will be null
// numNewMsgs: The number of new messages in the chosen sub-board // numNewMsgs: The number of new messages in the chosen sub-board
// viewMsgList: Whether or not to view the message list instead of going to reader mode // viewMsgList: Whether or not to view the message list instead of going to reader mode
// lastUserInput: The last keypress entered by the user // lastUserInput: The last keypress entered by the user
function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDisplayHelpLine, pScanScope) function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDisplayHelpLine, pScanScope, pNewscanOnly)
{ {
var retObj = { var retObj = {
chosenSubCode: null, chosenSubCode: null,
...@@ -15455,6 +15511,7 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi ...@@ -15455,6 +15511,7 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi
var displayHelpLine = (typeof(pDisplayHelpLine) === "boolean" ? pDisplayHelpLine : true); var displayHelpLine = (typeof(pDisplayHelpLine) === "boolean" ? pDisplayHelpLine : true);
   
var scanScope = (isValidScanScopeVal(pScanScope) ? pScanScope : SCAN_SCOPE_ALL); var scanScope = (isValidScanScopeVal(pScanScope) ? pScanScope : SCAN_SCOPE_ALL);
var newScanOnly = (typeof(pNewscanOnly) === "boolean" ? pNewscanOnly : false);
   
// Note: DDlightbarMenu supports non-ANSI terminals with a more traditional UI // Note: DDlightbarMenu supports non-ANSI terminals with a more traditional UI
// of listing the items and letting the user choose one by typing its number. // of listing the items and letting the user choose one by typing its number.
...@@ -15498,7 +15555,7 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi ...@@ -15498,7 +15555,7 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi
} }
   
// Set text widths for the menu items // Set text widths for the menu items
var newMsgWidthObj = findWidestNumMsgsAndNumNewMsgs(scanScope); var newMsgWidthObj = findWidestNumMsgsAndNumNewMsgs(scanScope, newScanOnly);
var numMsgsWidth = newMsgWidthObj.widestNumMsgs; var numMsgsWidth = newMsgWidthObj.widestNumMsgs;
var numNewMsgsWidth = newMsgWidthObj.widestNumNewMsgs; var numNewMsgsWidth = newMsgWidthObj.widestNumNewMsgs;
// Ensure the column widths for the last few columns (after description) are wide enough // Ensure the column widths for the last few columns (after description) are wide enough
...@@ -15523,7 +15580,7 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi ...@@ -15523,7 +15580,7 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi
// Ensure the menu is clear, and (re-)populate the menu with sub-board information w/ # of new messages in each, etc. // Ensure the menu is clear, and (re-)populate the menu with sub-board information w/ # of new messages in each, etc.
// Also, build an array of sub-board codes for each menu item. // Also, build an array of sub-board codes for each menu item.
this.indexedModeMenu.RemoveAllItems(); this.indexedModeMenu.RemoveAllItems();
var subBoardCodes = []; var numSubBoards = 0;
var totalNewMsgs = 0; var totalNewMsgs = 0;
for (var grpIdx = 0; grpIdx < msg_area.grp_list.length; ++grpIdx) for (var grpIdx = 0; grpIdx < msg_area.grp_list.length; ++grpIdx)
{ {
...@@ -15537,13 +15594,15 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi ...@@ -15537,13 +15594,15 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi
// Skip sub-boards that the user can't read or doesn't have configured for newscans // Skip sub-boards that the user can't read or doesn't have configured for newscans
if (!msg_area.grp_list[grpIdx].sub_list[subIdx].can_read) if (!msg_area.grp_list[grpIdx].sub_list[subIdx].can_read)
continue; continue;
if (!Boolean(msg_area.grp_list[grpIdx].sub_list[subIdx].scan_cfg & SCAN_CFG_NEW)) if (newScanOnly && !Boolean(msg_area.grp_list[grpIdx].sub_list[subIdx].scan_cfg & SCAN_CFG_NEW))
continue; continue;
// If scanning the user's current sub-board and this is the wrong sub-board, then // If scanning the user's current sub-board and this is the wrong sub-board, then
// skip this sub-board (the other groups should have been skipped in the outer loop). // skip this sub-board (the other groups should have been skipped in the outer loop).
if (scanScope == SCAN_SCOPE_SUB_BOARD && bbs.cursub != subIdx) if (scanScope == SCAN_SCOPE_SUB_BOARD && bbs.cursub != subIdx)
continue; continue;
   
++numSubBoards;
if (!grpNameItemAddedToMenu) if (!grpNameItemAddedToMenu)
{ {
//var grpDesc = msg_area.grp_list[grpIdx].name + " - " + msg_area.grp_list[grpIdx].description; //var grpDesc = msg_area.grp_list[grpIdx].name + " - " + msg_area.grp_list[grpIdx].description;
...@@ -15577,25 +15636,44 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi ...@@ -15577,25 +15636,44 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi
// If there are no items on the menu, then show a message and return // If there are no items on the menu, then show a message and return
if (this.indexedModeMenu.NumItems() == 0) if (this.indexedModeMenu.NumItems() == 0)
{ {
console.print("\x01n" + this.text.msgScanCompleteText + "\x01n"); if (newScanOnly)
console.crlf(); {
console.pause(); console.print("\x01n" + this.text.msgScanCompleteText + "\x01n");
console.crlf();
console.pause();
}
return retObj; return retObj;
} }
// If there are no new messages and the user setting to show the indexed menu when there are no new messages // For a newscan, if there are no new messages and the user setting to show the indexed menu when there are no new messages
// is disabled, then say so and return. // is disabled, then say so and return.
else if (thisFunctionFirstCall && totalNewMsgs == 0 && !this.userSettings.displayIndexedModeMenuIfNoNewMessages) else if (thisFunctionFirstCall && totalNewMsgs == 0 && (!this.userSettings.displayIndexedModeMenuIfNoNewMessages || !this.userSettings.showIndexedNewscanMenuAfterReadingAllNewMsgs))
{ {
console.attributes = "N"; if (newScanOnly)
console.putmsg(bbs.text(QWKNoNewMessages)); {
//console.crlf(); console.attributes = "N";
console.pause(); console.putmsg(bbs.text(QWKNoNewMessages));
return retObj; //console.crlf();
console.pause();
return retObj;
}
}
// For a newscan, if this is not the first time the indexed newscan menu is being displayed and there are no more new
// messages, and the user has the setting to show the indexed newscan menu now is disabled, then return.
else if (!thisFunctionFirstCall && totalNewMsgs == 0 && !this.userSettings.showIndexedNewscanMenuAfterReadingAllNewMsgs)
{
if (newScanOnly)
{
console.attributes = "N";
console.crlf();
printf(bbs.text(MessageScanComplete), numSubBoards);
console.pause();
return retObj;
}
} }
   
// If we've saved the index of the selected item in the menu, then set it back in the menu, if it's // If we've saved the index of the selected item in the menu, then set it back in the menu, if it's
// valid. This is done because the list of items is cleared each time this function is called. // valid. This is done because the list of items is cleared each time this function is called.
if (typeof(DigDistMsgReader_IndexedModeChooseSubBoard.selectedItemIdx) === "number") if (!thisFunctionFirstCall && typeof(DigDistMsgReader_IndexedModeChooseSubBoard.selectedItemIdx) === "number")
{ {
var savedItemIdx = DigDistMsgReader_IndexedModeChooseSubBoard.selectedItemIdx; var savedItemIdx = DigDistMsgReader_IndexedModeChooseSubBoard.selectedItemIdx;
if (savedItemIdx >= 0 && savedItemIdx < this.indexedModeMenu.NumItems()) if (savedItemIdx >= 0 && savedItemIdx < this.indexedModeMenu.NumItems())
...@@ -15604,9 +15682,9 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi ...@@ -15604,9 +15682,9 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi
DigDistMsgReader_IndexedModeChooseSubBoard.selectedItemIdx = 0; DigDistMsgReader_IndexedModeChooseSubBoard.selectedItemIdx = 0;
} }
   
// If the user setting to "snap" to the first sub-board with new messages is enabled, then set that // For a newscan, if the user setting to "snap" to the first sub-board with new messages is enabled,
// as the selected item index. // then set that as the selected item index.
if (this.userSettings.indexedModeMenuSnapToFirstWithNew) if (newScanOnly && this.userSettings.indexedModeMenuSnapToFirstWithNew)
{ {
var foundMenuItem = indexedSubMenuSetSelectedNextWithnNewMsgs(this.indexedModeMenu, this.indexedModeMenu.selectedItemIdx, this.indexedModeMenu.NumItems()); var foundMenuItem = indexedSubMenuSetSelectedNextWithnNewMsgs(this.indexedModeMenu, this.indexedModeMenu.selectedItemIdx, this.indexedModeMenu.NumItems());
// If we haven't found a sub-board with new messages and we didn't start at the // If we haven't found a sub-board with new messages and we didn't start at the
...@@ -15897,16 +15975,18 @@ function DigDistMsgReader_ShowIndexedListHelp() ...@@ -15897,16 +15975,18 @@ function DigDistMsgReader_ShowIndexedListHelp()
} }
   
// Returns an object with the widest text length of the number of new messsages and // Returns an object with the widest text length of the number of new messsages and
// number of new-to-you messages in all readable sub-boards // number of new-to-you messages in all readable sub-boards in the user's newscan configuration
// //
// Parameters: // Parameters:
// pScanScope: Numeric - Whether to scan the current sub-board, group, or all. // pScanScope: Numeric - Whether to scan the current sub-board, group, or all.
// This would be SCAN_SCOPE_SUB_BOARD, SCAN_SCOPE_GROUP, or SCAN_SCOPE_ALL. // This would be SCAN_SCOPE_SUB_BOARD, SCAN_SCOPE_GROUP, or SCAN_SCOPE_ALL.
// pForNewscanOnly: Boolean: Whether or not to only check sub-boards in the user's newscan configuration.
// Defaults to false.
// //
// Return value: An object with the following properties: // Return value: An object with the following properties:
// widestNumMsgs: The biggest length of the number of messages in the sub-boards // widestNumMsgs: The biggest length of the number of messages in the sub-boards
// widestNumNewMsgs: The biggest length of the number of new (unread) messages in the sub-boards // widestNumNewMsgs: The biggest length of the number of new (unread) messages in the sub-boards
function findWidestNumMsgsAndNumNewMsgs(pScanScope) function findWidestNumMsgsAndNumNewMsgs(pScanScope, pForNewscanOnly)
{ {
var retObj = { var retObj = {
widestNumMsgs: 0, widestNumMsgs: 0,
...@@ -15914,6 +15994,7 @@ function findWidestNumMsgsAndNumNewMsgs(pScanScope) ...@@ -15914,6 +15994,7 @@ function findWidestNumMsgsAndNumNewMsgs(pScanScope)
}; };
   
var scanScope = (isValidScanScopeVal(pScanScope) ? pScanScope : SCAN_SCOPE_ALL); var scanScope = (isValidScanScopeVal(pScanScope) ? pScanScope : SCAN_SCOPE_ALL);
var onlyNewscanCfg = (typeof(pForNewscanOnly) === "boolean" ? pForNewscanOnly : false);
   
for (var grpIdx = 0; grpIdx < msg_area.grp_list.length; ++grpIdx) for (var grpIdx = 0; grpIdx < msg_area.grp_list.length; ++grpIdx)
{ {
...@@ -15925,13 +16006,14 @@ function findWidestNumMsgsAndNumNewMsgs(pScanScope) ...@@ -15925,13 +16006,14 @@ function findWidestNumMsgsAndNumNewMsgs(pScanScope)
{ {
if (!msg_area.grp_list[grpIdx].sub_list[subIdx].can_read) if (!msg_area.grp_list[grpIdx].sub_list[subIdx].can_read)
continue; continue;
if ((msg_area.grp_list[grpIdx].sub_list[subIdx].scan_cfg & SCAN_CFG_NEW) == 0) if (onlyNewscanCfg && !Boolean(msg_area.grp_list[grpIdx].sub_list[subIdx].scan_cfg & SCAN_CFG_NEW))
continue; continue;
// If scanning the user's current sub-board and this is the wrong sub-board, then // If scanning the user's current sub-board and this is the wrong sub-board, then
// skip this sub-board (the other groups should have been skipped in the outer loop). // skip this sub-board (the other groups should have been skipped in the outer loop).
if (scanScope == SCAN_SCOPE_SUB_BOARD && bbs.cursub != subIdx) if (scanScope == SCAN_SCOPE_SUB_BOARD && bbs.cursub != subIdx)
continue; continue;
   
++retObj.numSubBoards;
var totalNumMsgsInSub = msg_area.grp_list[grpIdx].sub_list[subIdx].posts; var totalNumMsgsInSub = msg_area.grp_list[grpIdx].sub_list[subIdx].posts;
var totalNumMsgsInSubLen = totalNumMsgsInSub.toString().length; var totalNumMsgsInSubLen = totalNumMsgsInSub.toString().length;
if (totalNumMsgsInSubLen > retObj.widestNumMsgs) if (totalNumMsgsInSubLen > retObj.widestNumMsgs)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// If you have DDMsgReader in a directory other than xtrn/DDMsgReader, then the changes to // If you have DDMsgReader in a directory other than xtrn/DDMsgReader, then the changes to
// DDMsgReader.cfg will be saved in that directory (assuming you're running ddmr_cfg.js from // DDMsgReader.cfg will be saved in that directory (assuming you're running ddmr_cfg.js from
// that same directory). // that same directory).
// Currently for DDMsgReader 1.92. // Currently for DDMsgReader 1.93.
// //
// If you're running DDMsgReader from xtrn/DDMsgReader (the standard location) and you want // If you're running DDMsgReader from xtrn/DDMsgReader (the standard location) and you want
// to save the configuration file there (rather than sbbs/mods), you can use one of the // to save the configuration file there (rather than sbbs/mods), you can use one of the
...@@ -18,7 +18,7 @@ require("sbbsdefs.js", "P_NONE"); ...@@ -18,7 +18,7 @@ require("sbbsdefs.js", "P_NONE");
require("uifcdefs.js", "UIFC_INMSG"); require("uifcdefs.js", "UIFC_INMSG");
if (!uifc.init("DigDist. Message Reader 1.92 Configurator")) if (!uifc.init("DigDist. Message Reader 1.93 Configurator"))
{ {
print("Failed to initialize uifc"); print("Failed to initialize uifc");
exit(1); exit(1);
......
Digital Distortion Message Reader Digital Distortion Message Reader
Version 1.92 Version 1.93
Release date: 2023-12-29 Release date: 2024-01-01
by by
...@@ -141,9 +141,11 @@ confirmation before deleting the messages. ...@@ -141,9 +141,11 @@ confirmation before deleting the messages.
files. The configuration files may be placed in the same directory as the files. The configuration files may be placed in the same directory as the
.js script or in the sbbs/ctrl directory. .js script or in the sbbs/ctrl directory.
- Allows a personal twit list, editable via user settings (Ctrl-U) - Allows a personal twit list, editable via user settings (Ctrl-U)
- Has an "indexed" reader mode, which lists all sub-boards configured for - Has an "indexed" mode, which displays a menu of sub-boards that includes the
newscan by the user, with total number of messages, number of new messages, total number of messages and number of new messages in each, and lets the user
and last post date, allowing the user to select a sub-board to read choose a sub-board to read. This can be used for a regular "read", which
lists all sub-boards, or a newscan, which lists the sub-boards enabled for
newscan by the user.
- Allows the sysop to quick-validate a local user while reading one of their - Allows the sysop to quick-validate a local user while reading one of their
messages. The hotkey to do so is Ctrl-Q. messages. The hotkey to do so is Ctrl-Q.
...@@ -304,11 +306,12 @@ personal email. ...@@ -304,11 +306,12 @@ personal email.
The following are the command-line parameters supported by DDMsgReader.js: The following are the command-line parameters supported by DDMsgReader.js:
-indexedMode: Starts DDMsgreader in "indexed" reader mode, which lists all -indexedMode: Starts DDMsgreader in "indexed" reader mode, which lists all
sub-boards configured for newscan by the user, with total number sub-boards, with total number of messages, number of new messages,
of messages, number of new messages, and last post date, allowing and last post date, allowing the user to select a sub-board to
the user to select a sub-board to read. This is intended to work read. This will prompt the user for "Group or All": Whether the
if it is the only command-line option. 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.
-search: A search type. Available options: -search: A search type. Available options:
keyword_search: Do a keyword search in message subject/body text (current message area) keyword_search: Do a keyword search in message subject/body text (current message area)
from_name_search: 'From' name search (current message area) from_name_search: 'From' name search (current message area)
...@@ -1354,6 +1357,7 @@ This message reader uses the following lines from Synchronet's text.dat file ...@@ -1354,6 +1357,7 @@ This message reader uses the following lines from Synchronet's text.dat file
10 (Email) 10 (Email)
30 (Aborted) 30 (Aborted)
54 (DeleteMailQ) 54 (DeleteMailQ)
117 (MessageScanComplete)
390 (UnknownUser) 390 (UnknownUser)
501 (SelectItemHdr) 501 (SelectItemHdr)
503 (SelectItemWhich) 503 (SelectItemWhich)
......
...@@ -5,6 +5,13 @@ Revision History (change log) ...@@ -5,6 +5,13 @@ Revision History (change log)
============================= =============================
Version Date Description Version Date Description
------- ---- ----------- ------- ---- -----------
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
command-line option) now lists ALL sub-boards, rather
than only sub-boards the user has enabled for newscan.
It also prompts the user to list sub-boards in the current
group or all.
1.92 2023-12-29 Indexed newscan: By default, if there are no new messages, 1.92 2023-12-29 Indexed newscan: By default, if there are no new messages,
it now shows "No new messages." (578 QWKNoNewMessages from it now shows "No new messages." (578 QWKNoNewMessages from
text.dat). There's a new user setting to toggle whether to text.dat). There's a new user setting to toggle whether to
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment