diff --git a/xtrn/DDMsgReader/DDMsgReader.cfg b/xtrn/DDMsgReader/DDMsgReader.cfg index 0570e32277e76f4bdfab8a772d6af4dad3e20b9b..b1b9a08346305912cb6d9d4b2958ad3d8c501b43 100644 --- a/xtrn/DDMsgReader/DDMsgReader.cfg +++ b/xtrn/DDMsgReader/DDMsgReader.cfg @@ -108,10 +108,10 @@ subBoardChangeSorting=None ; as they like. Valid values are true or false. indexedModeNewscanOnlyShowSubsWithNewMsgs=false -; For messages with upvotes/downvotes, when showing vote tally info (a sysop function), -; whether or not to show whose votes are upvotes and whose are downvotes. If false, +; For poll messages or messages with upvotes/downvotes, when showing vote tally info +; (a sysop function), whether or not to show each users' responses. If false, ; it will just show the names of who voted on the message (and when). -showWhoUpvotedAndDownvotedInTallyInfo=false +showUserResponsesInTallyInfo=false ; The theme file name (for colors, strings, etc.) themeFilename=DefaultTheme.cfg diff --git a/xtrn/DDMsgReader/DDMsgReader.js b/xtrn/DDMsgReader/DDMsgReader.js index c20a21543dafa794035deb307afccbd638b97e4a..41a64306efead9c1e58604e90c70de1f06f444a9 100644 --- a/xtrn/DDMsgReader/DDMsgReader.js +++ b/xtrn/DDMsgReader/DDMsgReader.js @@ -244,11 +244,11 @@ * Fix: For the sysop reading personal email addressed to * "sysop", mark the email as read * 2025-04-19 Eric Oulashin Version 1.96p - * When viewing tally information for a message (a sysop - * feature), DDMsgReader can now optionally show who - * specifically voted up/down. Defaults to false. The - * option can be toggled (true/false) via the new - * configuration option showWhoUpvotedAndDownvotedInTallyInfo + * When viewing tally/vote information for a message (a + * sysop feature), DDMsgReader can now optionally show + * users' specific answers (in addition to just showing + * who voted on the message/poll), via the new + * configuration option showUserResponsesInTallyInfo */ "use strict"; @@ -1021,7 +1021,7 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs) this.ForwardMessage = DigDistMsgReader_ForwardMessage; this.VoteOnMessage = DigDistMsgReader_VoteOnMessage; this.HasUserVotedOnMsg = DigDistMsgReader_HasUserVotedOnMsg; - this.GetUpvoteAndDownvoteInfo = DigDistMsgReader_GetUpvoteAndDownvoteInfo; + this.GetVoteResponseInfo = DigDistMsgReader_GetVoteResponseInfo; this.GetMsgBody = DigDistMsgReader_GetMsgBody; this.RefreshMsgHdrInArrays = DigDistMsgReader_RefreshMsgHdrInArrays; this.WriteLightbarKeyHelpMsg = DigDistMsgReader_WriteLightbarKeyHelpMsg; @@ -1104,10 +1104,10 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs) // This is like the stock Synchronet behavior. this.readingPostOnSubBoardInsteadOfGoToNext = false; - // For messages with upvotes/downvotes, when showing vote tally info (a sysop function), - // whether or not to show whose votes are upvotes and whose are downvotes. If false, + // For poll messages or messages with upvotes/downvotes, when showing vote tally info + // (a sysop function), whether or not to show each users' responses. If false, // it will just show the names of who voted on the message (and when). - this.showWhoUpvotedAndDownvotedInTallyInfo = false; + this.showUserResponsesInTallyInfo = false; // String lengths for the columns to write // Fixed field widths: Message number, date, and time @@ -7245,7 +7245,7 @@ function DigDistMsgReader_ShowVoteInfo_Scrollable(pMsgHeader, pMsgAreaWidth, pMs var originalCurPos = console.getxy(); if (retObj.hasVoteProps) { - var voteInfo = this.GetUpvoteAndDownvoteInfo(pMsgHeader); + var voteInfo = this.GetVoteResponseInfo(pMsgHeader); // Display the vote info and let the user scroll through them // (the console height should be enough, but do this just in case) // Calculate information for the scrollbar for the vote info lines @@ -8107,7 +8107,7 @@ function DigDistMsgReader_ReadMessageEnhanced_Traditional(msgHeader, allowChgMsg { console.attributes = "N"; console.crlf(); - var voteInfo = this.GetUpvoteAndDownvoteInfo(msgHeader); + var voteInfo = this.GetVoteResponseInfo(msgHeader); for (var voteInfoIdx = 0; voteInfoIdx < voteInfo.length; ++voteInfoIdx) { console.print(voteInfo[voteInfoIdx]); @@ -8415,7 +8415,7 @@ function DigDistMsgReader_ReadMessageEnhanced_Traditional(msgHeader, allowChgMsg { console.attributes = "N"; console.crlf(); - var voteInfo = this.GetUpvoteAndDownvoteInfo(msgHeader); + var voteInfo = this.GetVoteResponseInfo(msgHeader); for (var voteInfoIdx = 0; voteInfoIdx < voteInfo.length; ++voteInfoIdx) { console.print(voteInfo[voteInfoIdx]); @@ -9995,8 +9995,8 @@ function DigDistMsgReader_ReadConfigFile() this.prependFowardMsgSubject = settingsObj.prependFowardMsgSubject; if (typeof(settingsObj.enableIndexedModeMsgListCache) === "boolean") this.enableIndexedModeMsgListCache = settingsObj.enableIndexedModeMsgListCache; - if (typeof(settingsObj.showWhoUpvotedAndDownvotedInTallyInfo) === "boolean") - this.showWhoUpvotedAndDownvotedInTallyInfo = settingsObj.showWhoUpvotedAndDownvotedInTallyInfo; + if (typeof(settingsObj.showUserResponsesInTallyInfo) === "boolean") + this.showUserResponsesInTallyInfo = settingsObj.showUserResponsesInTallyInfo; if (typeof(settingsObj.themeFilename) === "string") { // First look for the theme config file in the sbbs/mods @@ -18982,8 +18982,9 @@ function DigDistMsgReader_HasUserVotedOnMsg(pMsgNum, pUser) return userHasVotedOnMsg; } -// Gets information about the upvotes and downvotes for a message. -// If the user is a sysop, this will also get who voted on the message. +// Gets tally information about the votes for a message. +// If the user is a sysop, this will also get who voted on the message +// and optionally, how they voted. // // Parameters: // pMsgHdr: A header of a message that has upvotes & downvotes @@ -18991,7 +18992,7 @@ function DigDistMsgReader_HasUserVotedOnMsg(pMsgNum, pUser) // Return value: An array of strings containing information about the upvotes, // downvotes, tally, and (if the user is a sysop) who submitted // votes on the message. -function DigDistMsgReader_GetUpvoteAndDownvoteInfo(pMsgHdr) +function DigDistMsgReader_GetVoteResponseInfo(pMsgHdr) { // If the message header doesn't have the "total_votes" or "upvotes" properties, // then there's no vote information, so just return an empty array. @@ -19030,24 +19031,62 @@ function DigDistMsgReader_GetUpvoteAndDownvoteInfo(pMsgHdr) var tmpMessageBody = msgbase.get_msg_body(false, tmpHdrs[tmpProp].number, false, false, true, true); var msgIsUpvote = Boolean(tmpHdrs[tmpProp].attr & MSG_UPVOTE); var msgIsDownvote = Boolean(tmpHdrs[tmpProp].attr & MSG_DOWNVOTE); - if (tmpHdrs[tmpProp].field_list.length == 0 && tmpMessageBody.length == 0 && (msgIsUpvote || msgIsDownvote)) + if (tmpHdrs[tmpProp].field_list.length == 0 && tmpMessageBody.length == 0) { var msgWrittenLocalTime = msgWrittenTimeToLocalBBSTime(tmpHdrs[tmpProp]); var voteDate = strftime("%a %b %d %Y %H:%M:%S", msgWrittenLocalTime); - var infoStr = ""; - // If the option to show the users' specific up/downvotes is enabled, then include that - if (this.showWhoUpvotedAndDownvotedInTallyInfo) + if (Boolean(pMsgHdr.attr & MSG_POLL)) { - var voteTypeStr = (msgIsUpvote ? "up" : msgIsDownvote ? "down" : ""); - infoStr = format("\x01n\x01c\x01h%s\x01n\x01c voted on this message (%s) on %s\x01n", - tmpHdrs[tmpProp].from, voteTypeStr, voteDate); + // This is a poll + var infoStr = format("\x01n\x01c\x01h%s\x01n\x01c voted on this message on %s\x01n", + tmpHdrs[tmpProp].from, voteDate); + voteInfo.push(infoStr); + // If the option to show the users' specific responses is enabled, then include that + if (this.showUserResponsesInTallyInfo) + { + var answerBitIdx = 0; + for (var fieldI = 0; fieldI < pMsgHdr.field_list.length; ++fieldI) + { + if (pMsgHdr.field_list[fieldI].type == SMB_POLL_ANSWER) + { + var answerBit = (1 << answerBitIdx); + if ((tmpHdrs[tmpProp].votes & answerBit) == answerBit) + { + var optionStrArray = lfexpand(word_wrap(pMsgHdr.field_list[fieldI].data, console.screen_columns-1, null, false)).split("\r\n"); + if (optionStrArray.length > 0) + { + if (optionStrArray[optionStrArray.length-1] == "") + optionStrArray.pop(); + voteInfo.push(format(" - %s", optionStrArray[0].substr(0, console.screen_columns-4))); + for (var optStrI = 1; optStrI < optionStrArray.length; ++optStrI) + { + format(" - %s", optionStrArray[optStrI].substr(0, console.screen_columns-4)) + } + } + } + ++answerBitIdx; + } + } + } } else { - infoStr = format("\x01n\x01c\x01h%s\x01n\x01c voted on this message on %s\x01n", + // The message is not a poll. + // If the option to show the users' specific responses is enabled, then include that + var infoStr = ""; + if (this.showUserResponsesInTallyInfo) + { + var voteTypeStr = (msgIsUpvote ? "up" : msgIsDownvote ? "down" : ""); + infoStr = format("\x01n\x01c\x01h%s\x01n\x01c voted on this message (%s) on %s\x01n", + tmpHdrs[tmpProp].from, voteTypeStr, voteDate); + } + else + { + infoStr = format("\x01n\x01c\x01h%s\x01n\x01c voted on this message on %s\x01n", tmpHdrs[tmpProp].from, voteDate); + } + voteInfo.push(infoStr); } - voteInfo.push(infoStr); } } } diff --git a/xtrn/DDMsgReader/ddmr_cfg.js b/xtrn/DDMsgReader/ddmr_cfg.js index dfd0fe53929651be15ae4f1a463ddba4f80934c8..f6fd0f56e6f956af368a87a69f43bda445955fac 100644 --- a/xtrn/DDMsgReader/ddmr_cfg.js +++ b/xtrn/DDMsgReader/ddmr_cfg.js @@ -119,7 +119,7 @@ function doMainMenu() "promptDelPersonalEmailAfterReply", // Boolean "subBoardChangeSorting", // String: None, Alphabetical, LatestMsgDateOldestFirst, or LatestMsgDateNewestFirst "indexedModeNewscanOnlyShowSubsWithNewMsgs", // Boolean - "showWhoUpvotedAndDownvotedInTallyInfo", // Boolean + "showUserResponsesInTallyInfo", // Boolean "themeFilename" // String ]; // Strings for the options to display on the menu @@ -156,7 +156,7 @@ function doMainMenu() "Personal email: Prompt to delete after reply", "Sorting for sub-board change", "Index newscan: Only show subs w/ new msgs", - "Include specific up/downvotes w/ tally info", + "Include user responses in tally info", "Theme Filename" ]; // Build an array of formatted string to be displayed on the menu @@ -637,10 +637,11 @@ function getOptionHelpText() optionHelpText["indexedModeNewscanOnlyShowSubsWithNewMsgs"] += "whether to only show sub-boards with new messages. This is a "; optionHelpText["indexedModeNewscanOnlyShowSubsWithNewMsgs"] += "default for a user setting, which users can change for themselves."; - optionHelpText["showWhoUpvotedAndDownvotedInTallyInfo"] = "Include specific up/downvotes w/ tally info: For messages with upvotes/downvotes, "; - optionHelpText["showWhoUpvotedAndDownvotedInTallyInfo"] += "when showing vote tally info (a sysop function), whether or not to show whose votes "; - optionHelpText["showWhoUpvotedAndDownvotedInTallyInfo"] += "are upvotes and whose are downvotes. If false, it will just show the names of who "; - optionHelpText["showWhoUpvotedAndDownvotedInTallyInfo"] += "voted on the message (and when)."; + optionHelpText["showUserResponsesInTallyInfo"] = "Include user responses in tally info: For poll messages or messages with "; + optionHelpText["showUserResponsesInTallyInfo"] += "upvotes/downvotes, when showing vote tally info (a sysop function), whether or not "; + optionHelpText["showUserResponsesInTallyInfo"] += "to show each users' responses. If false, it will just show the names of who voted on "; + optionHelpText["showUserResponsesInTallyInfo"] += "the message (and when)."; + optionHelpText["themeFilename"] = "Theme filename: The name of a file for a color theme to use"; @@ -846,8 +847,8 @@ function readDDMsgReaderCfgFile() retObj.cfgOptions.subBoardChangeSorting = "None"; if (!retObj.cfgOptions.hasOwnProperty("indexedModeNewscanOnlyShowSubsWithNewMsgs")) retObj.cfgOptions.indexedModeNewscanOnlyShowSubsWithNewMsgs = false; - if (!retObj.cfgOptions.hasOwnProperty("showWhoUpvotedAndDownvotedInTallyInfo")) - retObj.cfgOptions.showWhoUpvotedAndDownvotedInTallyInfo = false; + if (!retObj.cfgOptions.hasOwnProperty("showUserResponsesInTallyInfo")) + retObj.cfgOptions.showUserResponsesInTallyInfo = false; if (!retObj.cfgOptions.hasOwnProperty("themeFilename")) retObj.cfgOptions.themeFilename = "DefaultTheme.cfg"; diff --git a/xtrn/DDMsgReader/readme.txt b/xtrn/DDMsgReader/readme.txt index 0cdbcadd33f08cad48f715f21a6375ea7bb47392..feb6a0d062f45dd58fb4c2700ad3330d1cea7042 100644 --- a/xtrn/DDMsgReader/readme.txt +++ b/xtrn/DDMsgReader/readme.txt @@ -853,14 +853,12 @@ indexedModeNewscanOnlyShowSubsWithNewMsgs For indexed-mode newscan, whether to for themselves as they like. Valid values are true or false. -showWhoUpvotedAndDownvotedInTallyInfo For messages with upvotes/downvotes, when - showing vote tally info (a sysop - function), this specifies whether or not - to show whose votes are upvotes and whose - are downvotes. If false, it will just - show the names of who voted on the - message (and when). Valid values are true - or false. +showUserResponsesInTallyInfo For poll messages or messages with upvotes + and downvotes, when showing vote tally + info (a sysop function), whether or not to + show each users' responses. If false, it + will just show the names of who voted on + the message (and when). themeFilename The name of the configuration file to use for colors & string settings diff --git a/xtrn/DDMsgReader/revision_history.txt b/xtrn/DDMsgReader/revision_history.txt index 5cbb2f4cdf0ac01882dae63b29e13cb04a09268d..128fbf402599f6fae28769e872f05328e9397c17 100644 --- a/xtrn/DDMsgReader/revision_history.txt +++ b/xtrn/DDMsgReader/revision_history.txt @@ -5,11 +5,11 @@ Revision History (change log) ============================= Version Date Description ------- ---- ----------- -1.96p 2025-04-19 When viewing tally information for a message (a sysop - feature), DDMsgReader can now optionally show who - specifically voted up/down. Defaults to false. The option - can be toggled (true/false) via the new configuration - option showWhoUpvotedAndDownvotedInTallyInfo +1.96p 2025-04-19 When viewing tally/vote information for a message (a sysop + feature), DDMsgReader can now optionally show users' + specific answers (in addition to just showing who voted on + the message/poll), via the new configuration option + showUserResponsesInTallyInfo 1.96o 2025-04-15 Fix: For the sysop reading personal email addressed to "sysop", mark the email as read 1.96N 2025-04-13 Changes (fixes) for the bottom-row key help lines due to