diff --git a/xtrn/DDMsgReader/DDMsgReader.js b/xtrn/DDMsgReader/DDMsgReader.js index cc7b5ccebe787e707332a45cedc95374bbfd469d..777d2d11cbdf26f15d5f34975b60baf45dedc1f8 100644 --- a/xtrn/DDMsgReader/DDMsgReader.js +++ b/xtrn/DDMsgReader/DDMsgReader.js @@ -148,6 +148,9 @@ * 2024-02-04 Eric Oulashin Version 1.95b * Bug fix: Use the P_UTF8 mode bit when printing UTF-8 message header info (such as 'from' and 'to'). * A dd_lightbar_menu.js update goes along with this. + * 2024- Eric Oulashin Version 1.95c + * The filename of quotes.txt is now in the correct case for the user's editor. + * "terminalSupportsUTF8 not defined" error eliminated. */ "use strict"; @@ -252,8 +255,8 @@ var ansiterm = require("ansiterm_lib.js", 'expand_ctrl_a'); var hexdump = load('hexdump_lib.js'); // Reader version information -var READER_VERSION = "1.95b"; -var READER_DATE = "2024-02-04"; +var READER_VERSION = "1.95c"; +var READER_DATE = "2024-02-15"; // Keyboard key codes for displaying on the screen var UP_ARROW = ascii(24); @@ -4760,7 +4763,50 @@ function DigDistMsgReader_PrintMessageInfo(pMsgHeader, pHighlight, pMsgNum, pRet var msgIsUTF8 = pMsgHeader.hasOwnProperty("is_utf8") && pMsgHeader.is_utf8; if (msgIsUTF8) { - if (!userConsoleSupportsUTF8) + if (userConsoleSupportsUTF8) + { + //fromName = sbbsifyStr(fromName); + // Temporary + /* + var fieldNew = ""; + for (var fieldI = 0; fieldI < fromName.length; ++fieldI) + { + // Credit to Deuce for this code (this was seen in fseditor.js) + var encoded = utf8_encode(fromName[fieldI].charCodeAt(0)); + for (var encodedI = 0; encodedI < encoded.length; ++encodedI) + fieldNew += encoded[encodedI]; + } + fromName = fieldNew; + */ + + /* + // Temporary + if (user.is_sysop) + { + var curPos = console.getxy(); + if (fromName[0] == "D") + { + for (var tmpI = 0; tmpI < fromName.length; ++tmpI) + { + console.gotoxy(1, 1); + var debugMsg = tmpI + ": " + fromName[tmpI] + " ASCII: " + str_is_ascii(fromName[tmpI]) + " "; + console.print(debugMsg, P_UTF8); + mswait(500); + } + } + console.gotoxy(curPos); + } + // End Temporary + */ + /* + var printedLen = console.strlen(fromName, P_UTF8); + if (fromName.length > printedLen) + { + fromName += format("%*s", fromName.length - printedLen, ""); + } + */ + } + else { fromName = utf8_cp437(fromName); toName = utf8_cp437(toName); @@ -4801,6 +4847,35 @@ function DigDistMsgReader_PrintMessageInfo(pMsgHeader, pHighlight, pMsgNum, pRet else if (msgHdrHasAttachmentFlag(pMsgHeader)) msgIndicatorChar = "\x01n" + this.colors.selectedMsgMarkColor + this.colors.msgListHighlightBkgColor + this.msgListStatusChars.attachments + "\x01n"; + // TODO: Handle UTF-8 in the header fields + /* + var fromNameForItemStr = fromName.substr(0, this.FROM_LEN); + var toNameForItemStr = toName.substr(0, this.TO_LEN); + var subjectForItemStr = subject.substr(0, this.SUBJ_LEN); + if (msgIsUTF8 && userConsoleSupportsUTF8) + { + var printedLen = console.strlen(fromNameForItemStr, P_UTF8); + fromNameForItemStr = fromNameForItemStr.length + "; " + printedLen; + if (fromNameForItemStr.length > printedLen) + { + //fromNameForItemStr += format("%*s", fromNameForItemStr.length - printedLen, ""); + } + } + + if (this.showScoresInMsgList) + { + msgHdrStr += format(this.sMsgInfoFormatHighlightStr, msgNum, msgIndicatorChar, + fromNameForItemStr, toNameForItemStr, subjectForItemStr, + msgVoteInfo.voteScore, sDate, sTime); + } + else + { + msgHdrStr += format(this.sMsgInfoFormatHighlightStr, msgNum, msgIndicatorChar, + fromNameForItemStr, toNameForItemStr, subjectForItemStr, + sDate, sTime); + } + */ + if (this.showScoresInMsgList) { msgHdrStr += format(this.sMsgInfoFormatHighlightStr, msgNum, msgIndicatorChar, @@ -4847,6 +4922,45 @@ function DigDistMsgReader_PrintMessageInfo(pMsgHeader, pHighlight, pMsgNum, pRet else formatStr = (msgToUser ? this.sMsgInfoToUserFormatStr : (msgIsFromUser ? this.sMsgInfoFromUserFormatStr : this.sMsgInfoFormatStr)); + // TODO: Handle UTF-8 in the header fields + /* + // Deuce said: + // <Deuce> JS Strings are intended for each codepoint to be "one character" in the JS string. + // <Deuce> Synchronet does it differently though. + // <Deuce> If you want substr to work, you'll ned to convert from UTF-8 into a JS native string. + // <Deuce> But then it won't work with format(). + // <Deuce> Passing a JS native string that has real unicode codepoints in it to a Synchronet function would corrupt the string in wild and wacky ways. + + //var fromNameForItemStr = format("%-" + this.FROM_LEN + "s", fromName.substr(0, this.FROM_LEN)); + var fromNameForItemStr = fromName.substr(0, this.FROM_LEN); + //if (fromNameForItemStr[0] == "D") fromNameForItemStr = str_is_ascii(fromNameForItemStr); + var toNameForItemStr = toName.substr(0, this.TO_LEN); + var subjectForItemStr = subject.substr(0, this.SUBJ_LEN); + if (msgIsUTF8 && userConsoleSupportsUTF8) + { + var printedLen = console.strlen(fromNameForItemStr, P_UTF8); + //fromNameForItemStr = fromNameForItemStr.length + "; " + printedLen; + if (fromNameForItemStr.length > printedLen) + { + // TODO: This isn't working + //fromNameForItemStr += format("%*s", fromNameForItemStr.length - printedLen, ""); + //fromNameForItemStr = format("%-" + this.FROM_LEN + "s", fromName.substr(0, this.FROM_LEN)); + fromNameForItemStr = utf8_decode(fromName).substr(0, this.FROM_LEN); + } + } + + if (this.showScoresInMsgList) + { + msgHdrStr += format(formatStr, msgNum, msgIndicatorChar, fromNameForItemStr, toNameForItemStr, subjectForItemStr, + msgVoteInfo.voteScore, sDate, sTime); + } + else + { + msgHdrStr += format(formatStr, msgNum, msgIndicatorChar, fromNameForItemStr, toNameForItemStr, subjectForItemStr, + sDate, sTime); + } + */ + if (this.showScoresInMsgList) { msgHdrStr += format(formatStr, msgNum, msgIndicatorChar, fromName.substr(0, this.FROM_LEN), @@ -4864,6 +4978,7 @@ function DigDistMsgReader_PrintMessageInfo(pMsgHeader, pHighlight, pMsgNum, pRet var returnStrInstead = (typeof(pReturnStrInstead) == "boolean" ? pReturnStrInstead : false); if (!returnStrInstead) { + var terminalSupportsUTF8 = (typeof(USER_UTF8) != "undefined" ? console.term_supports(USER_UTF8) : false); var printMode = (terminalSupportsUTF8 && hdrIsUTF8 ? P_UTF8 : P_NONE); console.print(msgHdrStr, printMode); console.cleartoeol("\x01n"); // To clear away any extra text that may have been entered by the user @@ -10975,8 +11090,14 @@ function DigDistMsgReader_ReplyToMsg(pMsgHdr, pMsgText, pPrivate, pMsgIdx) // Get the user's setting for whether or not to wrap quote lines (and how long) from // their external editor settings var editorQuoteCfg = getExternalEditorQuoteWrapCfgFromSCFG(user.editor); + // Check for the drop file casing + var quotesFilename = ""; + if (xtrn_area.editor[user.editor].settings & XTRN_LWRCASE) + quotesFilename = "quotes.txt"; + else + quotesFilename = "QUOTES.TXT"; // Write the message text to the quotes file - quoteFile = new File(system.node_dir + "QUOTES.TXT"); + quoteFile = new File(system.node_dir + quotesFilename); if (quoteFile.open("w")) { var msgNum = (typeof(pMsgIdx) === "number" ? pMsgIdx+1 : null); @@ -11580,8 +11701,25 @@ function DigDistMsgReader_DisplayEnhancedMsgHdr(pMsgHdr, pDisplayMsgNum, pStartS for (var hdrFileIdx = 0; hdrFileIdx < enhHdrLines.length; ++hdrFileIdx) { console.gotoxy(screenX, screenY++); - console.putmsg(this.ParseMsgAtCodes(enhHdrLines[hdrFileIdx], pMsgHdr, - pDisplayMsgNum, dateTimeStr, useBBSLocalTimeZone, false), printMode); + // For Synchronet 3.20: + /* + <git_rswindell> From: Rob Swindell (on Windows 11) + <git_rswindell> + https://gitlab.synchro.net/main/sbbs/-/commit/90b93e4a1eb53532faca437a + <git_rswindell> Modified src/sbbs3/js_bbs.cpp + <git_rswindell> Support optional msg_header argument to bbs.expand_atcodes() + <git_rswindell> For Nightfox's use in DDMsgReader. + */ + //if (typeof(bbs.expand_atcodes) === "function") + if (false) + { + console.putmsg(enhHdrLines[hdrFileIdx], pMsgHdr); + } + else + { + console.putmsg(this.ParseMsgAtCodes(enhHdrLines[hdrFileIdx], pMsgHdr, + pDisplayMsgNum, dateTimeStr, useBBSLocalTimeZone, false), printMode); + } } // Older - Used to center the header lines, but I'm not sure this is necessary, // and it might even make the header off by one, which could be bad. @@ -24430,7 +24568,6 @@ function entryExistsInGlobalEmailFilter(pEmailAddr) return entryExists; } - /////////////////////////////////////////////////////////////////////////////////// // For debugging: Writes some text on the screen at a given location with a given pause. diff --git a/xtrn/DDMsgReader/readme.txt b/xtrn/DDMsgReader/readme.txt index fa798ecf9111ac80f66d85e94770e8f7eaacd5be..27cce5c0819e1199de9a5735c01943a376222e24 100644 --- a/xtrn/DDMsgReader/readme.txt +++ b/xtrn/DDMsgReader/readme.txt @@ -1,6 +1,6 @@ Digital Distortion Message Reader - Version 1.95b - Release date: 2024-02-04 + Version 1.95c + Release date: 2024-02-15 by @@ -1290,7 +1290,7 @@ This is an example of the sub-board menu that appears in indexed mode - And from here, the user can choose a sub-board to read: Description Total New Last Post -─────────────────────────────────────────────────────────────────────────────── +��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� AGN GEN - General Chat 1004 0 2023-04-02 AGN BBS - BBS Discussion 1000 0 2023-01-17 NEW AGN ART - Art/Demo Scene 603 1 2023-04-02 @@ -1299,7 +1299,7 @@ NEW AGN ART - Art/Demo Scene 603 1 2023-04-02 AGN L46 - League Scores & Recons 1000 0 2016-09-10 NEW AGN TST - Testing Setups 2086 10 2023-04-03 AGN SYS - Sysops Only 1000 0 2023-01-19 -───── FIDO - FidoNet ────────────────────────────────────────────────────────── +��������������� FIDO - FidoNet ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ NEW BBS CARNIVAL - BBS Software Chatter 660 5 2023-04-04 BBS INTERNET - DOS/Win/OS2/Unix Internet BBS Applicatio 18 0 2023-03-04 CHWARE - Cheepware Support/Discussion 111 0 2023-03-16 @@ -1332,20 +1332,20 @@ added for a user will be preserved (DDMsgReader does a bitwise 'or'). A quick-validation set in CFG is a set that includes a security level, flag sets, exemptions, restrictions, and additional credits. For example: -â•”[â– ][?]â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•— -â•‘ Quick-Validation Values â•‘ -â• â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•£ -â•‘ ?0 SL: 5 F1: â•‘ -â•‘ ?1 SL: 10 F1: â•‘ -â•‘ ?2 SL: 20 F1: â•‘ -â•‘ ?3 SL: 30 F1: â•‘ -â•‘ ?4 SL: 40 F1: â•‘ -â•‘ ?5 SL: 50 F1: â•‘ -â•‘ ?6 SL: 60 F1: â•‘ -â•‘ ?7 SL: 70 F1: â•‘ -â•‘ ?8 SL: 80 F1: â•‘ -â•‘ ?9 SL: 90 F1: â•‘ -â•šâ•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• +���[���][?]������������������������������������������������������������ +��� Quick-Validation Values ��� +��������������������������������������������������������������������������������� +��� ?0 SL: 5 F1: ��� +��� ?1 SL: 10 F1: ��� +��� ?2 SL: 20 F1: ��� +��� ?3 SL: 30 F1: ��� +��� ?4 SL: 40 F1: ��� +��� ?5 SL: 50 F1: ��� +��� ?6 SL: 60 F1: ��� +��� ?7 SL: 70 F1: ��� +��� ?8 SL: 80 F1: ��� +��� ?9 SL: 90 F1: ��� +��������������������������������������������������������������������������������� 9. Drop file for replying to messages with Synchronet message editors diff --git a/xtrn/DDMsgReader/revision_history.txt b/xtrn/DDMsgReader/revision_history.txt index f79a140603301ba83a9ff3264d95d89bded1de84..f0765fc37234ea60574b9cdb947fc8b0bb02fabf 100644 --- a/xtrn/DDMsgReader/revision_history.txt +++ b/xtrn/DDMsgReader/revision_history.txt @@ -5,6 +5,9 @@ Revision History (change log) ============================= Version Date Description ------- ---- ----------- +1.95c 2024-02-15 The filename of quotes.txt is now in the correct case for + the user's editor. + "terminalSupportsUTF8 not defined" error eliminated. 1.95b 2024-02-04 Bug fix: Use the P_UTF8 mode bit when printing UTF-8 message header info (such as 'from' and 'to'). A dd_lightbar_menu.js update goes along with this.