Skip to content
Snippets Groups Projects
Commit c3baa671 authored by nightfox's avatar nightfox
Browse files

Version 1.29: When reading a message, if a message is written to the current...

Version 1.29: When reading a message, if a message is written to the current user, the 'To' username in the header above the message is now written in a different color.  Also, there are new color settings available in the theme configuration file (see the readme for descriptions): msgHdrMsgNumColor, msgHdrFromColor, msgHdrToColor, msgHdrToUserColor, msgHdrSubjColor, msgHdrDateColor
parent b589882b
Branches
Tags
No related merge requests found
...@@ -55,6 +55,10 @@ ...@@ -55,6 +55,10 @@
* area while reading a message, the reader would exit * area while reading a message, the reader would exit
* with an error due to an invalid last-read message number. * with an error due to an invalid last-read message number.
* This has been fixed. * This has been fixed.
* 2020-04-03 Eric Oulashin Version 1.29
* In reader mode, if a message is written to the
* current user, the 'To' username in the header above
* the message is now written in a different color.
*/ */
   
   
...@@ -120,7 +124,12 @@ ...@@ -120,7 +124,12 @@
added in the future. added in the future.
*/ */
   
// TODOs - For sub-board area search: // TODOs:
// - For pageUp & pageDown, enable alternate keys:
// - When reading a message - scrollTextLines()
// - When listing messages
// - When listing message groups & sub-boards for sub-board selection
// - For sub-board area search:
// - Enable searching in traditional interface // - Enable searching in traditional interface
// - Update the keys in the lightbar help line and traditional interface // - Update the keys in the lightbar help line and traditional interface
   
...@@ -157,8 +166,8 @@ if (system.version_num < 31500) ...@@ -157,8 +166,8 @@ if (system.version_num < 31500)
} }
   
// Reader version information // Reader version information
var READER_VERSION = "1.28"; var READER_VERSION = "1.29";
var READER_DATE = "2019-12-21"; var READER_DATE = "2020-04-03";
   
// 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);
...@@ -638,6 +647,31 @@ if (gDoDDMR) ...@@ -638,6 +647,31 @@ if (gDoDDMR)
   
// End of script execution. Functions below: // End of script execution. Functions below:
   
// Generates an internal enhanced reader header line for the 'To' user.
//
// Parameters:
// pColors: A JSON object containing the color settings read from the
// theme configuration file. This function will use the
// 'msgHdrToColor' or 'msgHdrToUserColor' property, depending
// on the pToReadingUser property.
// pToReadingUser: Boolean - Whether or not to generate the line with
// the color/attribute for the reading user
//
// Return value: A string containing the internal enhanced reader header
// line specifying the 'to' user
function genEnhHdrToUserLine(pColors, pToReadingUser)
{
var toHdrLine = "\1n\1h\1k" + VERTICAL_SINGLE + BLOCK1 + BLOCK2 + BLOCK3
+ "\1gT\1n\1go \1h\1c: " +
(pToReadingUser ? pColors.msgHdrToUserColor : pColors.msgHdrToColor) +
"@MSG_TO-L";
var numChars = console.screen_columns - 21;
for (var i = 0; i < numChars; ++i)
toHdrLine += "#";
toHdrLine += "@\1k" + VERTICAL_SINGLE;
return toHdrLine;
}
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// DigDistMsgReader class stuff // DigDistMsgReader class stuff
   
...@@ -871,7 +905,7 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs) ...@@ -871,7 +905,7 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs)
// extended read mode // extended read mode
this.numTabSpaces = 3; this.numTabSpaces = 3;
   
// this.text is an object containing text used for various functionality. // this.text is an object containing text used for various prompts & functions.
this.text = { this.text = {
scrollbarBGChar: BLOCK1, scrollbarBGChar: BLOCK1,
scrollbarScrollBlockChar: BLOCK2, scrollbarScrollBlockChar: BLOCK2,
...@@ -968,7 +1002,8 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs) ...@@ -968,7 +1002,8 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs)
vote: "V", vote: "V",
showVotes: "T", showVotes: "T",
closePoll: "!", closePoll: "!",
bypassSubBoardInNewScan: "B" bypassSubBoardInNewScan: "B",
threadView: "*" // TODO: Implement this
}; };
if (gIsSysop) if (gIsSysop)
this.enhReaderKeys.validateMsg = "A"; this.enhReaderKeys.validateMsg = "A";
...@@ -1074,6 +1109,10 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs) ...@@ -1074,6 +1109,10 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs)
// different terminal widths (i.e., msgHeader_80.ans for an 80-column console // different terminal widths (i.e., msgHeader_80.ans for an 80-column console
// and msgHeader_132 for a 132-column console). // and msgHeader_132 for a 132-column console).
this.enhMsgHeaderLines = loadTextFileIntoArray("enhMsgHeader", 10); this.enhMsgHeaderLines = loadTextFileIntoArray("enhMsgHeader", 10);
// this.enhMsgHeaderLinesToReadingUser will be a copy of this.endMsgReaderLines
// but with the 'To' user line changed to highlight the name for messages to
// the logged-on reading user
this.enhMsgHeaderLinesToReadingUser = [];
// If the header file didn't exist, then populate the enhanced reader header // If the header file didn't exist, then populate the enhanced reader header
// array with default lines. // array with default lines.
this.usingInternalEnhMsgHdr = (this.enhMsgHeaderLines.length == 0); this.usingInternalEnhMsgHdr = (this.enhMsgHeaderLines.length == 0);
...@@ -1099,36 +1138,35 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs) ...@@ -1099,36 +1138,35 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs)
hdrLine1 += "\1n\1c" + HORIZONTAL_SINGLE + HORIZONTAL_SINGLE + "\1h" hdrLine1 += "\1n\1c" + HORIZONTAL_SINGLE + HORIZONTAL_SINGLE + "\1h"
+ HORIZONTAL_SINGLE + UPPER_RIGHT_SINGLE; + HORIZONTAL_SINGLE + UPPER_RIGHT_SINGLE;
this.enhMsgHeaderLines.push(hdrLine1); this.enhMsgHeaderLines.push(hdrLine1);
this.enhMsgHeaderLinesToReadingUser.push(hdrLine1);
var hdrLine2 = "\1n\1c" + VERTICAL_SINGLE + "\1h\1k" + BLOCK1 + BLOCK2 var hdrLine2 = "\1n\1c" + VERTICAL_SINGLE + "\1h\1k" + BLOCK1 + BLOCK2
+ BLOCK3 + "\1gM\1n\1gsg#\1h\1c: \1b@MSG_NUM_AND_TOTAL-L"; + BLOCK3 + "\1gM\1n\1gsg#\1h\1c: " + this.colors.msgHdrMsgNumColor + "@MSG_NUM_AND_TOTAL-L";
numChars = console.screen_columns - 32; numChars = console.screen_columns - 32;
for (var i = 0; i < numChars; ++i) for (var i = 0; i < numChars; ++i)
hdrLine2 += "#"; hdrLine2 += "#";
hdrLine2 += "@\1n\1c" + VERTICAL_SINGLE; hdrLine2 += "@\1n\1c" + VERTICAL_SINGLE;
this.enhMsgHeaderLines.push(hdrLine2); this.enhMsgHeaderLines.push(hdrLine2);
this.enhMsgHeaderLinesToReadingUser.push(hdrLine2);
var hdrLine3 = "\1n\1h\1k" + VERTICAL_SINGLE + BLOCK1 + BLOCK2 + BLOCK3 var hdrLine3 = "\1n\1h\1k" + VERTICAL_SINGLE + BLOCK1 + BLOCK2 + BLOCK3
+ "\1gF\1n\1grom\1h\1c: \1b@MSG_FROM_AND_FROM_NET-L"; + "\1gF\1n\1grom\1h\1c: " + this.colors.msgHdrFromColor + "@MSG_FROM_AND_FROM_NET-L";
numChars = console.screen_columns - 36; numChars = console.screen_columns - 36;
for (var i = 0; i < numChars; ++i) for (var i = 0; i < numChars; ++i)
hdrLine3 += "#"; hdrLine3 += "#";
hdrLine3 += "@\1k" + VERTICAL_SINGLE; hdrLine3 += "@\1k" + VERTICAL_SINGLE;
this.enhMsgHeaderLines.push(hdrLine3); this.enhMsgHeaderLines.push(hdrLine3);
var hdrLine4 = "\1n\1h\1k" + VERTICAL_SINGLE + BLOCK1 + BLOCK2 + BLOCK3 this.enhMsgHeaderLinesToReadingUser.push(hdrLine3);
+ "\1gT\1n\1go \1h\1c: \1b@MSG_TO-L"; this.enhMsgHeaderLines.push(genEnhHdrToUserLine(this.colors, false));
numChars = console.screen_columns - 21; this.enhMsgHeaderLinesToReadingUser.push(genEnhHdrToUserLine(this.colors, true));
for (var i = 0; i < numChars; ++i)
hdrLine4 += "#";
hdrLine4 += "@\1k" + VERTICAL_SINGLE;
this.enhMsgHeaderLines.push(hdrLine4);
var hdrLine5 = "\1n\1h\1k" + VERTICAL_SINGLE + BLOCK1 + BLOCK2 + BLOCK3 var hdrLine5 = "\1n\1h\1k" + VERTICAL_SINGLE + BLOCK1 + BLOCK2 + BLOCK3
+ "\1gS\1n\1gubj\1h\1c: \1b@MSG_SUBJECT-L"; + "\1gS\1n\1gubj\1h\1c: " + this.colors.msgHdrSubjColor + "@MSG_SUBJECT-L";
numChars = console.screen_columns - 26; numChars = console.screen_columns - 26;
for (var i = 0; i < numChars; ++i) for (var i = 0; i < numChars; ++i)
hdrLine5 += "#"; hdrLine5 += "#";
hdrLine5 += "@\1k" + VERTICAL_SINGLE; hdrLine5 += "@\1k" + VERTICAL_SINGLE;
this.enhMsgHeaderLines.push(hdrLine5); this.enhMsgHeaderLines.push(hdrLine5);
this.enhMsgHeaderLinesToReadingUser.push(hdrLine5);
var hdrLine6 = "\1n\1c" + VERTICAL_SINGLE + "\1h\1k" + BLOCK1 + BLOCK2 + BLOCK3 var hdrLine6 = "\1n\1c" + VERTICAL_SINGLE + "\1h\1k" + BLOCK1 + BLOCK2 + BLOCK3
+ "\1gD\1n\1gate\1h\1c: \1b@MSG_DATE-L"; + "\1gD\1n\1gate\1h\1c: " + this.colors.msgHdrDateColor + "@MSG_DATE-L";
//numChars = console.screen_columns - 23; //numChars = console.screen_columns - 23;
numChars = console.screen_columns - 67; numChars = console.screen_columns - 67;
for (var i = 0; i < numChars; ++i) for (var i = 0; i < numChars; ++i)
...@@ -1139,6 +1177,7 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs) ...@@ -1139,6 +1177,7 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs)
hdrLine6 += " "; hdrLine6 += " ";
hdrLine6 += "\1n\1c" + VERTICAL_SINGLE; hdrLine6 += "\1n\1c" + VERTICAL_SINGLE;
this.enhMsgHeaderLines.push(hdrLine6); this.enhMsgHeaderLines.push(hdrLine6);
this.enhMsgHeaderLinesToReadingUser.push(hdrLine6);
var hdrLine7 = "\1n\1h\1c" + BOTTOM_T_SINGLE + HORIZONTAL_SINGLE + "\1n\1c" var hdrLine7 = "\1n\1h\1c" + BOTTOM_T_SINGLE + HORIZONTAL_SINGLE + "\1n\1c"
+ HORIZONTAL_SINGLE + HORIZONTAL_SINGLE + "\1h\1k"; + HORIZONTAL_SINGLE + HORIZONTAL_SINGLE + "\1h\1k";
numChars = console.screen_columns - 8; numChars = console.screen_columns - 8;
...@@ -1147,6 +1186,18 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs) ...@@ -1147,6 +1186,18 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs)
hdrLine7 += "\1n\1c" + HORIZONTAL_SINGLE + HORIZONTAL_SINGLE + "\1h" hdrLine7 += "\1n\1c" + HORIZONTAL_SINGLE + HORIZONTAL_SINGLE + "\1h"
+ HORIZONTAL_SINGLE + BOTTOM_T_SINGLE; + HORIZONTAL_SINGLE + BOTTOM_T_SINGLE;
this.enhMsgHeaderLines.push(hdrLine7); this.enhMsgHeaderLines.push(hdrLine7);
this.enhMsgHeaderLinesToReadingUser.push(hdrLine7);
}
else
{
// We loaded the enhanced message header lines from a custom file.
// Copy from this.enhMsgHeaderLines to this.enhMsgHeaderLinesToReadingUser
// but change any 'To:' line to highlight the 'to' username.
this.enhMsgHeaderLinesToReadingUser = this.enhMsgHeaderLines.slice();
// Go through the header lines and ensure the 'To' line has a different
// color
for (var lineIdx = 0; lineIdx < this.enhMsgHeaderLinesToReadingUser.length; ++lineIdx)
this.enhMsgHeaderLinesToReadingUser[lineIdx] = syncAttrCodesToANSI(strWithToUserColor(this.enhMsgHeaderLinesToReadingUser[lineIdx], this.colors.msgHdrToUserColor));
} }
// Save the enhanced reader header width. This will be the length of the longest // Save the enhanced reader header width. This will be the length of the longest
// line in the header. // line in the header.
...@@ -7619,7 +7670,10 @@ function DigDistMsgReader_ReadConfigFile() ...@@ -7619,7 +7670,10 @@ function DigDistMsgReader_ReadConfigFile()
(setting == "hdrLineLabelColor") || (setting == "hdrLineValueColor") || (setting == "hdrLineLabelColor") || (setting == "hdrLineValueColor") ||
(setting == "selectedMsgMarkColor") || (setting == "msgListScoreColor") || (setting == "selectedMsgMarkColor") || (setting == "msgListScoreColor") ||
(setting == "msgListToUserScoreColor") || (setting == "msgListFromUserScoreColor") || (setting == "msgListToUserScoreColor") || (setting == "msgListFromUserScoreColor") ||
(setting == "msgListScoreHighlightColor")) (setting == "msgListScoreHighlightColor") || (setting == "msgHdrMsgNumColor") ||
(setting == "msgHdrFromColor") || (setting == "msgHdrToColor") ||
(setting == "msgHdrToUserColor") || (setting == "msgHdrSubjColor") ||
(setting == "msgHdrDateColor"))
{ {
// Trim leading & trailing spaces from the value when // Trim leading & trailing spaces from the value when
// setting a color. Also, replace any instances of "\1" // setting a color. Also, replace any instances of "\1"
...@@ -9482,9 +9536,13 @@ function DigDistMsgReader_DisplayEnhancedMsgHdr(pMsgHdr, pDisplayMsgNum, pStartS ...@@ -9482,9 +9536,13 @@ function DigDistMsgReader_DisplayEnhancedMsgHdr(pMsgHdr, pDisplayMsgNum, pStartS
{ {
if ((pMsgHdr == null) || (typeof(pMsgHdr) != "object")) if ((pMsgHdr == null) || (typeof(pMsgHdr) != "object"))
return; return;
if (this.enhMsgHeaderLines == null) // For the set of enhanced header lines, choose the regular set or the set with
// the highlighted 'to' user, dependin on whether the message was written to the
// logged-in (reading) user.
var enhMsgHdrLines = (userNameHandleAliasMatch(pMsgHdr.to) ? this.enhMsgHeaderLinesToReadingUser : this.enhMsgHeaderLines);
if (enhMsgHdrLines == null)
return; return;
if ((this.enhMsgHeaderLines.length == 0) || (this.enhMsgHeaderWidth == 0)) if ((enhMsgHdrLines.length == 0) || (this.enhMsgHeaderWidth == 0))
return; return;
   
// Create a formatted date & time string. Adjust the message's time to // Create a formatted date & time string. Adjust the message's time to
...@@ -9506,7 +9564,7 @@ function DigDistMsgReader_DisplayEnhancedMsgHdr(pMsgHdr, pDisplayMsgNum, pStartS ...@@ -9506,7 +9564,7 @@ function DigDistMsgReader_DisplayEnhancedMsgHdr(pMsgHdr, pDisplayMsgNum, pStartS
var msgIsAPoll = false; var msgIsAPoll = false;
if (typeof(MSG_POLL) != "undefined") if (typeof(MSG_POLL) != "undefined")
msgIsAPoll = ((pMsgHdr.attr & MSG_POLL) == MSG_POLL); msgIsAPoll = ((pMsgHdr.attr & MSG_POLL) == MSG_POLL);
var enhHdrLines = this.enhMsgHeaderLines.slice(0); var enhHdrLines = enhMsgHdrLines.slice(0);
if (this.usingInternalEnhMsgHdr && !msgIsAPoll && pMsgHdr.hasOwnProperty("total_votes") && pMsgHdr.hasOwnProperty("upvotes")) if (this.usingInternalEnhMsgHdr && !msgIsAPoll && pMsgHdr.hasOwnProperty("total_votes") && pMsgHdr.hasOwnProperty("upvotes"))
{ {
// Only add the vote information if the total_votes value is non-zero // Only add the vote information if the total_votes value is non-zero
...@@ -9525,7 +9583,6 @@ function DigDistMsgReader_DisplayEnhancedMsgHdr(pMsgHdr, pDisplayMsgNum, pStartS ...@@ -9525,7 +9583,6 @@ function DigDistMsgReader_DisplayEnhancedMsgHdr(pMsgHdr, pDisplayMsgNum, pStartS
// Display the header starting on the first column and the given screen row. // Display the header starting on the first column and the given screen row.
var screenX = 1; var screenX = 1;
var screenY = (typeof(pStartScreenRow) == "number" ? pStartScreenRow : 1); var screenY = (typeof(pStartScreenRow) == "number" ? pStartScreenRow : 1);
//for (var hdrFileIdx = 0; hdrFileIdx < this.enhMsgHeaderLines.length; ++hdrFileIdx)
for (var hdrFileIdx = 0; hdrFileIdx < enhHdrLines.length; ++hdrFileIdx) for (var hdrFileIdx = 0; hdrFileIdx < enhHdrLines.length; ++hdrFileIdx)
{ {
console.gotoxy(screenX, screenY++); console.gotoxy(screenX, screenY++);
...@@ -15124,130 +15181,136 @@ function DisplayProgramInfo() ...@@ -15124,130 +15181,136 @@ function DisplayProgramInfo()
// DigDistMessageReader class. // DigDistMessageReader class.
function getDefaultColors() function getDefaultColors()
{ {
var colorObj = {}; return {
// Colors for the message header displayed above messages in the scrollable reader mode
// Header line: "Current msg group:" msgHdrMsgNumColor: "\1n\1b\1h", // Message #
colorObj.msgListHeaderMsgGroupTextColor = "\1n\1" + "4\1c"; // Normal cyan on blue background msgHdrFromColor: "\1n\1b\1h", // From username
//colorObj.msgListHeaderMsgGroupTextColor = "\1n\1" + "4\1w"; // Normal white on blue background msgHdrToColor: "\1n\1b\1h", // To username
msgHdrToUserColor: "\1n\1g\1h", // To username when it's to the current user
// Header line: Message group name msgHdrSubjColor: "\1n\1b\1h", // Message subject
colorObj.msgListHeaderMsgGroupNameColor = "\1h\1c"; // High cyan msgHdrDateColor: "\1n\1b\1h", // Message date
//colorObj.msgListHeaderMsgGroupNameColor = "\1h\1w"; // High white
// Message list header line: "Current msg group:"
// Header line: "Current sub-board:" msgListHeaderMsgGroupTextColor: "\1n\1" + "4\1c", // Normal cyan on blue background
colorObj.msgListHeaderSubBoardTextColor = "\1n\1" + "4\1c"; // Normal cyan on blue background // msgListHeaderMsgGroupTextColor: "\1n\1" + "4\1w", // Normal white on blue background
//colorObj.msgListHeaderSubBoardTextColor = "\1n\1" + "4\1w"; // Normal white on blue background
// Message list header line: Message group name
// Header line: Message sub-board name msgListHeaderMsgGroupNameColor: "\1h\1c", // High cyan
colorObj.msgListHeaderMsgSubBoardName = "\1h\1c"; // High cyan // msgListHeaderMsgGroupNameColor: "\1h\1w", // High white
//colorObj.msgListHeaderMsgSubBoardName = "\1h\1w"; // High white
// Message list header line: "Current sub-board:"
msgListHeaderSubBoardTextColor: "\1n\1" + "4\1c", // Normal cyan on blue background
// msgListHeaderSubBoardTextColor: "\1n\1" + "4\1w", // Normal white on blue background
// Message list header line: Message sub-board name
msgListHeaderMsgSubBoardName: "\1h\1c", // High cyan
// msgListHeaderMsgSubBoardName: "\1h\1w", // High white
// Line with column headers // Line with column headers
//colorObj.msgListColHeader = "\1h\1w"; // High white (keep blue background) // msgListColHeader: "\1h\1w", // High white (keep blue background)
colorObj.msgListColHeader = "\1n\1h\1w"; // High white on black background msgListColHeader: "\1n\1h\1w", // High white on black background
//colorObj.msgListColHeader = "\1h\1c"; // High cyan (keep blue background) // msgListColHeader: "\1h\1c", // High cyan (keep blue background)
//colorObj.msgListColHeader = "\1" + "4\1h\1y"; // High yellow (keep blue background) // msgListColHeader: "\1" + "4\1h\1y", // High yellow (keep blue background)
   
// Message list information // Message list information
colorObj.msgListMsgNumColor = "\1n\1h\1y"; msgListMsgNumColor: "\1n\1h\1y",
colorObj.msgListFromColor = "\1n\1c"; msgListFromColor: "\1n\1c",
colorObj.msgListToColor = "\1n\1c"; msgListToColor: "\1n\1c",
colorObj.msgListSubjectColor = "\1n\1c"; msgListSubjectColor: "\1n\1c",
colorObj.msgListScoreColor = "\1n\1c"; msgListScoreColor: "\1n\1c",
colorObj.msgListDateColor = "\1h\1b"; msgListDateColor: "\1h\1b",
colorObj.msgListTimeColor = "\1h\1b"; msgListTimeColor: "\1h\1b",
// Message information for messages written to the user // Message information for messages written to the user
colorObj.msgListToUserMsgNumColor = "\1n\1h\1y"; msgListToUserMsgNumColor: "\1n\1h\1y",
colorObj.msgListToUserFromColor = "\1h\1g"; msgListToUserFromColor: "\1h\1g",
colorObj.msgListToUserToColor = "\1h\1g"; msgListToUserToColor: "\1h\1g",
colorObj.msgListToUserSubjectColor = "\1h\1g"; msgListToUserSubjectColor: "\1h\1g",
colorObj.msgListToUserScoreColor = "\1h\1g"; msgListToUserScoreColor: "\1h\1g",
colorObj.msgListToUserDateColor = "\1h\1b"; msgListToUserDateColor: "\1h\1b",
colorObj.msgListToUserTimeColor = "\1h\1b"; msgListToUserTimeColor: "\1h\1b",
// Message information for messages from the user // Message information for messages from the user
colorObj.msgListFromUserMsgNumColor = "\1n\1h\1y"; msgListFromUserMsgNumColor: "\1n\1h\1y",
colorObj.msgListFromUserFromColor = "\1n\1c"; msgListFromUserFromColor: "\1n\1c",
colorObj.msgListFromUserToColor = "\1n\1c"; msgListFromUserToColor: "\1n\1c",
colorObj.msgListFromUserSubjectColor = "\1n\1c"; msgListFromUserSubjectColor: "\1n\1c",
colorObj.msgListFromUserScoreColor = "\1n\1c"; msgListFromUserScoreColor: "\1n\1c",
colorObj.msgListFromUserDateColor = "\1h\1b"; msgListFromUserDateColor: "\1h\1b",
colorObj.msgListFromUserTimeColor = "\1h\1b"; msgListFromUserTimeColor: "\1h\1b",
   
// Message list highlight colors // Message list highlight colors
colorObj.msgListHighlightBkgColor = "\1" + "4"; // Background msgListHighlightBkgColor: "\1" + "4", // Background
colorObj.msgListMsgNumHighlightColor = "\1h\1y"; msgListMsgNumHighlightColor: "\1h\1y",
colorObj.msgListFromHighlightColor = "\1h\1c"; msgListFromHighlightColor: "\1h\1c",
colorObj.msgListToHighlightColor = "\1h\1c"; msgListToHighlightColor: "\1h\1c",
colorObj.msgListSubjHighlightColor = "\1h\1c"; msgListSubjHighlightColor: "\1h\1c",
colorObj.msgListScoreHighlightColor = "\1h\1c"; msgListScoreHighlightColor: "\1h\1c",
colorObj.msgListDateHighlightColor = "\1h\1w"; msgListDateHighlightColor: "\1h\1w",
colorObj.msgListTimeHighlightColor = "\1h\1w"; msgListTimeHighlightColor: "\1h\1w",
   
// Lightbar message list help line colors // Lightbar message list help line colors
colorObj.lightbarMsgListHelpLineBkgColor = "\1" + "7"; // Background lightbarMsgListHelpLineBkgColor: "\1" + "7", // Background
colorObj.lightbarMsgListHelpLineGeneralColor = "\1b"; lightbarMsgListHelpLineGeneralColor: "\1b",
colorObj.lightbarMsgListHelpLineHotkeyColor = "\1r"; lightbarMsgListHelpLineHotkeyColor: "\1r",
colorObj.lightbarMsgListHelpLineParenColor = "\1m"; lightbarMsgListHelpLineParenColor: "\1m",
   
// Continue prompt colors // Continue prompt colors
colorObj.tradInterfaceContPromptMainColor = "\1n\1g"; // Main text color tradInterfaceContPromptMainColor: "\1n\1g", // Main text color
colorObj.tradInterfaceContPromptHotkeyColor = "\1h\1c"; // Hotkey color tradInterfaceContPromptHotkeyColor: "\1h\1c", // Hotkey color
colorObj.tradInterfaceContPromptUserInputColor = "\1h\1g"; // User input color tradInterfaceContPromptUserInputColor: "\1h\1g", // User input color
   
// Message body color // Message body color
colorObj.msgBodyColor = "\1n\1w"; msgBodyColor: "\1n\1w",
   
// Read message confirmation colors // Read message confirmation colors
colorObj.readMsgConfirmColor = "\1n\1c"; readMsgConfirmColor: "\1n\1c",
colorObj.readMsgConfirmNumberColor = "\1h\1c"; readMsgConfirmNumberColor: "\1h\1c",
// Prompt for continuing to list messages after reading a message // Prompt for continuing to list messages after reading a message
colorObj.afterReadMsg_ListMorePromptColor = "\1n\1c"; afterReadMsg_ListMorePromptColor: "\1n\1c",
   
// Help screen text color // Help screen text color
colorObj.tradInterfaceHelpScreenColor = "\1n\1h\1w"; tradInterfaceHelpScreenColor: "\1n\1h\1w",
   
// Colors for choosing a message group & sub-board // Colors for choosing a message group & sub-board
colorObj.areaChooserMsgAreaNumColor = "\1n\1w\1h"; areaChooserMsgAreaNumColor: "\1n\1w\1h",
colorObj.areaChooserMsgAreaDescColor = "\1n\1c"; areaChooserMsgAreaDescColor: "\1n\1c",
colorObj.areaChooserMsgAreaNumItemsColor = "\1b\1h"; areaChooserMsgAreaNumItemsColor: "\1b\1h",
colorObj.areaChooserMsgAreaHeaderColor = "\1n\1y\1h"; areaChooserMsgAreaHeaderColor: "\1n\1y\1h",
colorObj.areaChooserSubBoardHeaderColor = "\1n\1g"; areaChooserSubBoardHeaderColor: "\1n\1g",
colorObj.areaChooserMsgAreaMarkColor = "\1g\1h"; areaChooserMsgAreaMarkColor: "\1g\1h",
colorObj.areaChooserMsgAreaLatestDateColor = "\1n\1g"; areaChooserMsgAreaLatestDateColor: "\1n\1g",
colorObj.areaChooserMsgAreaLatestTimeColor = "\1n\1m"; areaChooserMsgAreaLatestTimeColor: "\1n\1m",
// Highlighted colors (for lightbar mode) // Highlighted colors (for lightbar mode)
colorObj.areaChooserMsgAreaBkgHighlightColor = "\1" + "4"; // Blue background areaChooserMsgAreaBkgHighlightColor: "\1" + "4", // Blue background
colorObj.areaChooserMsgAreaNumHighlightColor = "\1w\1h"; areaChooserMsgAreaNumHighlightColor: "\1w\1h",
colorObj.areaChooserMsgAreaDescHighlightColor = "\1c"; areaChooserMsgAreaDescHighlightColor: "\1c",
colorObj.areaChooserMsgAreaDateHighlightColor = "\1w\1h"; areaChooserMsgAreaDateHighlightColor: "\1w\1h",
colorObj.areaChooserMsgAreaTimeHighlightColor = "\1w\1h"; areaChooserMsgAreaTimeHighlightColor: "\1w\1h",
colorObj.areaChooserMsgAreaNumItemsHighlightColor = "\1w\1h"; areaChooserMsgAreaNumItemsHighlightColor: "\1w\1h",
// Lightbar area chooser help line // Lightbar area chooser help line
colorObj.lightbarAreaChooserHelpLineBkgColor = "\1" + "7"; // Background lightbarAreaChooserHelpLineBkgColor: "\1" + "7", // Background
colorObj.lightbarAreaChooserHelpLineGeneralColor = "\1b"; lightbarAreaChooserHelpLineGeneralColor: "\1b",
colorObj.lightbarAreaChooserHelpLineHotkeyColor = "\1r"; lightbarAreaChooserHelpLineHotkeyColor: "\1r",
colorObj.lightbarAreaChooserHelpLineParenColor = "\1m"; lightbarAreaChooserHelpLineParenColor: "\1m",
   
// Scrollbar background and scroll block colors (for the enhanced // Scrollbar background and scroll block colors (for the enhanced
// message reader interface) // message reader interface)
colorObj.scrollbarBGColor = "\1n\1h\1k"; scrollbarBGColor: "\1n\1h\1k",
colorObj.scrollbarScrollBlockColor = "\1n\1h\1w"; scrollbarScrollBlockColor: "\1n\1h\1w",
// Color for the line drawn in the 2nd to last line of the message // Color for the line drawn in the 2nd to last line of the message
// area in the enhanced reader mode before a prompt // area in the enhanced reader mode before a prompt
colorObj.enhReaderPromptSepLineColor = "\1n\1h\1g"; enhReaderPromptSepLineColor: "\1n\1h\1g",
// Colors for the enhanced reader help line // Colors for the enhanced reader help line
colorObj.enhReaderHelpLineBkgColor = "\1" + "7"; enhReaderHelpLineBkgColor: "\1" + "7",
colorObj.enhReaderHelpLineGeneralColor = "\1b"; enhReaderHelpLineGeneralColor: "\1b",
colorObj.enhReaderHelpLineHotkeyColor = "\1r"; enhReaderHelpLineHotkeyColor: "\1r",
colorObj.enhReaderHelpLineParenColor = "\1m"; enhReaderHelpLineParenColor: "\1m",
   
// Message header line colors // Message header line colors
colorObj.hdrLineLabelColor = "\1n\1c"; hdrLineLabelColor: "\1n\1c",
colorObj.hdrLineValueColor = "\1n\1b\1h"; hdrLineValueColor: "\1n\1b\1h",
   
// Selected message marker color // Selected message marker color
colorObj.selectedMsgMarkColor = "\1n\1w\1h"; selectedMsgMarkColor: "\1n\1w\1h"
};
return colorObj;
} }
   
// This function returns the month number (1-based) from a capitalized // This function returns the month number (1-based) from a capitalized
...@@ -17764,7 +17827,7 @@ function regexFirstIndexOf(pStr, pRegex) ...@@ -17764,7 +17827,7 @@ function regexFirstIndexOf(pStr, pRegex)
// Parameters: // Parameters:
// pText: The text with ANSI ;-delimited modes to convert // pText: The text with ANSI ;-delimited modes to convert
// //
// Return value: The text with ANSI ;-delimited modes converted to Synchronet attributes // Return value: The text with ANSI ;-delimited codes converted to Synchronet attributes
function ANSIMultiConvertToSyncCodes(pText) function ANSIMultiConvertToSyncCodes(pText)
{ {
var multiMatches = pText.match(/\[[0-9]+(;[0-9]+)+m/g); var multiMatches = pText.match(/\[[0-9]+(;[0-9]+)+m/g);
...@@ -17825,6 +17888,48 @@ function ANSIMultiConvertToSyncCodes(pText) ...@@ -17825,6 +17888,48 @@ function ANSIMultiConvertToSyncCodes(pText)
return updatedText; return updatedText;
} }
   
// Converts Synchronet attribute codes to ANSI ;-delimited modes (such as alue;...;Valuem)
//
// Parameters:
// pText: The text with Synchronet codes to convert
//
// Return value: The text with Synchronet attributes converted to ANSI ;-delimited codes
function syncAttrCodesToANSI(pText)
{
// First, see if the text has any Synchronet attribute codes at
// all. We'll be performing a bunch of search & replace commands,
// so we don't want to do all that work for nothing.. :)
if (hasSyncAttrCodes(pText))
{
var ANSIESCCodeStart = "[";
var newText = pText.replace(/\1n/gi, ANSIESCCodeStart + "0m"); // Normal
newText = newText.replace(/\1-/gi, ANSIESCCodeStart + "0m"); // Normal
newText = newText.replace(/\1_/gi, ANSIESCCodeStart + "0m"); // Normal
newText = newText.replace(/\1h/gi, ANSIESCCodeStart + "1m"); // High intensity/bold
newText = newText.replace(/\1i/gi, ANSIESCCodeStart + "5m"); // Blinking on
newText = newText.replace(/\1f/gi, ANSIESCCodeStart + "5m"); // Blinking on
newText = newText.replace(/\1k/gi, ANSIESCCodeStart + "30m"); // Black foreground
newText = newText.replace(/\1r/gi, ANSIESCCodeStart + "31m"); // Red foreground
newText = newText.replace(/\1g/gi, ANSIESCCodeStart + "32m"); // Green foreground
newText = newText.replace(/\1y/gi, ANSIESCCodeStart + "33m"); // Yellow/brown foreground
newText = newText.replace(/\1b/gi, ANSIESCCodeStart + "34m"); // Blue foreground
newText = newText.replace(/\1m/gi, ANSIESCCodeStart + "35m"); // Magenta foreground
newText = newText.replace(/\1c/gi, ANSIESCCodeStart + "36m"); // Cyan foreground
newText = newText.replace(/\1w/gi, ANSIESCCodeStart + "37m"); // White foreground
newText = newText.replace(/\1[0]/gi, ANSIESCCodeStart + "40m"); // Black background
newText = newText.replace(/\1[1]/gi, ANSIESCCodeStart + "41m"); // Red background
newText = newText.replace(/\1[2]/gi, ANSIESCCodeStart + "42m"); // Green background
newText = newText.replace(/\1[3]/gi, ANSIESCCodeStart + "43m"); // Yellow/brown background
newText = newText.replace(/\1[4]/gi, ANSIESCCodeStart + "44m"); // Blue background
newText = newText.replace(/\1[5]/gi, ANSIESCCodeStart + "45m"); // Magenta background
newText = newText.replace(/\1[6]/gi, ANSIESCCodeStart + "46m"); // Cyan background
newText = newText.replace(/\1[7]/gi, ANSIESCCodeStart + "47m"); // White background
return newText;
}
else
return pText; // No Synchronet-style attribute codes found, so just return the text.
}
// Given some text, this converts ANSI color codes to Synchronet codes and // Given some text, this converts ANSI color codes to Synchronet codes and
// removes unwanted ANSI codes (such as cursor movement codes, etc.). // removes unwanted ANSI codes (such as cursor movement codes, etc.).
// //
...@@ -19631,6 +19736,8 @@ function applyAttrsInMsgHdrInMessagbase(pMsgbaseOrSubCode, pMsgNum, pMsgAttrs) ...@@ -19631,6 +19736,8 @@ function applyAttrsInMsgHdrInMessagbase(pMsgbaseOrSubCode, pMsgNum, pMsgAttrs)
if (msgHdr != null) if (msgHdr != null)
{ {
msgHdr.attr |= pMsgAttrs; msgHdr.attr |= pMsgAttrs;
// TODO: Occasional when going to next message area:
// Error: Error -110 adding SENDERNETADDR field to message header
retObj.saveSucceeded = msgbase.put_msg_header(false, pMsgNum, msgHdr); retObj.saveSucceeded = msgbase.put_msg_header(false, pMsgNum, msgHdr);
if (retObj.saveSucceeded) if (retObj.saveSucceeded)
retObj.msgAttrs = msgHdr.attr; retObj.msgAttrs = msgHdr.attr;
...@@ -20140,6 +20247,56 @@ function getMsgAreaPageNumFromSearch(pText, pNumItemsPerPage, pSubBoard, pStartI ...@@ -20140,6 +20247,56 @@ function getMsgAreaPageNumFromSearch(pText, pNumItemsPerPage, pSubBoard, pStartI
return retObj; return retObj;
} }
   
// Searches for a @MSG_TO @-code in a string and inserts a color/attribute code
// before the @-code in the string.
//
// Parameters:
// pStr: The string to look in
// pToUserColor: The color/attribute code to insert before the @MSG_TO @-code
//
// Return value: A string with the given color/attribute code inserted before the
// @MSG_TO @-code
function strWithToUserColor(pStr, pToUserColor)
{
if ((typeof(pStr) != "string") || (typeof(pToUserColor) != "string"))
return "";
if (pToUserColor.length == 0)
return pStr;
// Find start & end indexes of a @MSG_TO* @-code, i.e.,
// @MSG_TO, @MSG_TO_NAME, @MSG_TO_EXT, @MSG_TO_NET
var toCodeStartIdx = pStr.indexOf("@MSG_TO");
if (toCodeStartIdx < 0)
return pStr;
// Insert the color in the right position and return the line
return pStr.substr(0, toCodeStartIdx) + "\1n" + pToUserColor + pStr.substr(toCodeStartIdx) + "\1n";
/*
// Insert the color in the right position, and
// put a \1n right after the end of the @-code
var str = "";
var toCodeEndIdx = pStr.indexOf("@", toCodeStartIdx+1);
if (toCodeEndIdx >= 0)
{
str = pStr.substr(0, toCodeStartIdx) + "\1n" + pToUserColor + pStr.substr(toCodeStartIdx, toCodeEndIdx-toCodeStartIdx+1)
+ "\1n" + pStr.substr(toCodeEndIdx);
}
else
str = pStr.substr(0, toCodeStartIdx) + "\1n" + pToUserColor + pStr.substr(toCodeStartIdx) + "\1n";
return str;
*/
}
// Returns whether a string has any Synchronet attribute codes
//
// Parameters:
// pStr: the string to check
//
// Return value: Boolean - Whether or not the string has any Synchronet attribute codes
function hasSyncAttrCodes(pStr)
{
return (pStr.search(/\1[krgybmcwhifn\-_01234567]/i) > -1);
}
// For debugging: Writes some text on the screen at a given location with a given pause. // For debugging: Writes some text on the screen at a given location with a given pause.
// //
// Parameters: // Parameters:
......
...@@ -43,6 +43,15 @@ cannotDeleteAllSelectedMsgsText=nyh* Cannot delete all selected messages ...@@ -43,6 +43,15 @@ cannotDeleteAllSelectedMsgsText=nyh* Cannot delete all selected messages
msgEditConfirmText=ncEdit message #h%dnc: Are you sure msgEditConfirmText=ncEdit message #h%dnc: Are you sure
; -------- Internal header lines displayed above a message --------
msgHdrMsgNumColor=nbh
msgHdrFromColor=nbh
msgHdrToColor=nbh
msgHdrToUserColor=ngh
msgHdrSubjColor=nbh
msgHdrDateColor=nbh
; -------- Message list colors & text -------- ; -------- Message list colors & text --------
; Header line: "Current msg group:" - Normal cyan on blue background ; Header line: "Current msg group:" - Normal cyan on blue background
......
Digital Distortion Message Reader Digital Distortion Message Reader
Version 1.28 Version 1.29
Release date: 2019-12-21 Release date: 2020-04-03
by by
...@@ -829,6 +829,27 @@ areaChooserMsgAreaLatestDateColor Color for the latest message date when ...@@ -829,6 +829,27 @@ areaChooserMsgAreaLatestDateColor Color for the latest message date when
areaChooserMsgAreaLatestTimeColor Color for the latest message date when areaChooserMsgAreaLatestTimeColor Color for the latest message date when
choosing a different message area choosing a different message area
- Colors for the built-in header displayed above a message (if not using your
own message header ANSI -
msgHdrMsgNumColor Color for the message number displayed in
the header above a message
msgHdrFromColor Color for the 'From' name displayed in the
header above a message
msgHdrToColor Color for the 'To' name displayed in the
header above a message
msgHdrToUserColor Color for the 'To' name displayed in the
header above a message when the message is
written to the current user
msgHdrSubjColor Color for the subject displayed in the
header above a message
msgHdrDateColor Color for the message date displayed in
the header above a message
- Highlighted versions of the above message area list colors: - Highlighted versions of the above message area list colors:
areaChooserMsgAreaBkgHighlightColor areaChooserMsgAreaBkgHighlightColor
areaChooserMsgAreaNumHighlightColor areaChooserMsgAreaNumHighlightColor
......
...@@ -5,6 +5,13 @@ Revision History (change log) ...@@ -5,6 +5,13 @@ Revision History (change log)
============================= =============================
Version Date Description Version Date Description
------- ---- ----------- ------- ---- -----------
1.29 2020-04-03 When reading a message, if a message is written to the
current user, the 'To' username in the header above the
message is now written in a different color. Also, there
are new color settings available in the theme
configuration file (see the readme for descriptions):
msgHdrMsgNumColor, msgHdrFromColor, msgHdrToColor,
msgHdrToUserColor, msgHdrSubjColor, msgHdrDateColor
1.28 2019-12-21 Bug fix: When the user changes to a different message 1.28 2019-12-21 Bug fix: When the user changes to a different message
area while reading a message, the reader would exit with area while reading a message, the reader would exit with
an error due to an invalid last-read message number. an error due to an invalid last-read message number.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment