Commit 486881ce authored by Eric Oulashin's avatar Eric Oulashin Committed by Rob Swindell
Browse files

DDMsgReader can now optionally convert Y-style MCI attributes to Synchronet attributes.

parent add7bab0
......@@ -1057,6 +1057,45 @@ function ANSIMultiConvertToSyncCodes(pText)
return updatedText;
}
// Converts Y-style MCI attribute codes to Synchronet attribute codes
//
// Parameters:
// pText: A string containing the text to convert
//
// Return value: The text with Y-style MCI attribute codes converted to Synchronet attribute codes
function YStyleMCIAttrsToSyncAttrs(pText)
{
if (/\x19[cz]/.test(pText))
{
return pText.replace(/\x19c0/g, "\x01n\x01k") // Normal Black
.replace(/\x19c1/g, "\x01n\x01r") // Normal Red
.replace(/\x19c2/g, "\x01n\x01g") // Normal Green
.replace(/\x19c3/g, "\x01n\x01y") // Brown
.replace(/\x19c4/g, "\x01n\x01b") // Normal Blue
.replace(/\x19c5/g, "\x01n\x01m") // Normal Magenta
.replace(/\x19c6/g, "\x01n\x01c") // Normal Cyan
.replace(/\x19c7/g, "\x01n\x01w") // Normal White
.replace(/\x19c8/g, "\x01k\x01h") // High Intensity Black
.replace(/\x19c9/g, "\x01r\x01h") // High Intensity Red
.replace(/\x19c[Aa]/g, "\x01g\x01h") // High Intensity Green
.replace(/\x19c[Bb]/g, "\x01y\x01h") // Yellow
.replace(/\x19c[Cc]/g, "\x01b\x01h") // High Intensity Blue
.replace(/\x19c[Dd]/g, "\x01m\x01h") // High Intensity Magenta
.replace(/\x19c[Ee]/g, "\x01c\x01h") // High Intensity Cyan
.replace(/\x19c[Ff]/g, "\x01w\x01h") // High Intensity White
.replace(/\x19z0/g, "\x010") // Background Black
.replace(/\x19z1/g, "\x011") // Background Red
.replace(/\x19z2/g, "\x012") // Background Green
.replace(/\x19z3/g, "\x013") // Background Brown
.replace(/\x19z4/g, "\x014") // Background Blue
.replace(/\x19z5/g, "\x015") // Background Magenta
.replace(/\x19z6/g, "\x016") // Background Cyan
.replace(/\x19z7/g, "\x017"); // Background White
}
else
return pText; // Just return the original string if no "Y" MCI codes found.
}
// Converts non-Synchronet attribute codes in text to Synchronet attribute
// codes according to the toggle options in SCFG > Message Options > Extra
// Attribute Codes
......
......@@ -46,5 +46,8 @@ rightJustifyAvatars=true
; Written: By date/time written (takes time due to sorting)
msgListSort=Received
; Whether or not to convert Y-style MCI attribute codes to Synchronet attribute codes
convertYStyleMCIAttrsToSync=true
; The theme file name (for colors, strings, etc.)
themeFilename=DefaultTheme.cfg
\ No newline at end of file
......@@ -75,6 +75,11 @@
* Also, there's a new user setting to toggle whether or not to use the scrollbar
* in the scrolling reader. Currently there is no alternate progress displayed
* if not using the scrollbar, but that is planned for a future update.
* 2023-01-20 Eric Oulashin Version 1.60
* DDMsgReader can now optionally convert Y-style MCI attribute codes to
* to Synchronet attribute codes, with the new configuration setting
* convertYStyleMCIAttrsToSync (true/false). Requires the updated attr_conv.js
* in sbbs/exec/load.
*/
 
"use strict";
......@@ -179,8 +184,8 @@ var ansiterm = require("ansiterm_lib.js", 'expand_ctrl_a');
 
 
// Reader version information
var READER_VERSION = "1.59";
var READER_DATE = "2022-12-29";
var READER_VERSION = "1.60";
var READER_DATE = "2023-01-20";
 
// Keyboard key codes for displaying on the screen
var UP_ARROW = ascii(24);
......@@ -1067,6 +1072,9 @@ function DigDistMsgReader(pSubBoardCode, pScriptArgs)
// Message list sort option
this.msgListSort = MSG_LIST_SORT_DATETIME_RECEIVED;
 
// Whether or not to convert Y-style MCI attribute codes to Synchronet attribute codes
this.convertYStyleMCIAttrsToSync = false;
// Whether or not to use the scrollbar in the enhanced message reader
this.useEnhReaderScrollbar = true;
 
......@@ -8222,6 +8230,8 @@ function DigDistMsgReader_ReadConfigFile()
if (valueUpper == "WRITTEN")
this.msgListSort = MSG_LIST_SORT_DATETIME_WRITTEN;
}
else if (settingUpper == "CONVERTYSTYLEMCIATTRSTOSYNC")
this.convertYStyleMCIAttrsToSync = (valueUpper == "TRUE");
}
}
 
......@@ -12625,6 +12635,9 @@ function DigDistMsgReader_GetMsgInfoForEnhancedReader(pMsgHdr, pWordWrap, pDeter
// Convert other BBS color codes to Synchronet attribute codes if the settings
// to do so are enabled.
msgTextAltered = convertAttrsToSyncPerSysCfg(msgTextAltered, false);
// If configured to convert Y-style MCI attribute codes to Synchronet attribute codes, then do so
if (this.convertYStyleMCIAttrsToSync)
msgTextAltered = YStyleMCIAttrsToSyncAttrs(msgTextAltered);
 
// If this is a message with a "By: <name> to <name>" and a date, then
// sometimes such a message might have enter characters (ASCII 13), which
......
Digital Distortion Message Reader
Version 1.59
Release date: 2022-12-29
Version 1.60
Release date: 2023-01-20
by
......@@ -674,6 +674,11 @@ msgListSort How to sort the message list. This can
Written adds time since sorting is
required.
convertYStyleMCIAttrsToSync Whether or not to convert Y-style MCI
attribute codes to Synchronet attribute
codes. Valid values are true and false.
themeFilename The name of the configuration file to
use for colors & string settings
......
......@@ -5,6 +5,10 @@ Revision History (change log)
=============================
Version Date Description
------- ---- -----------
1.60 2023-01-20 DDMsgReader can now optionally convert Y-style MCI
attribute codes to to Synchronet attribute codes, with
the new configuration setting convertYStyleMCIAttrsToSync
(true/false).
1.59 2022-12-29 For Synchronet above 3.20, now reads the external editor
quote wrap setting from xtrn.ini. Below version 3.20, the
quote wrap setting is read from xtrn.cnf.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment