diff --git a/xtrn/DDMsgReader/DDMsgReader.js b/xtrn/DDMsgReader/DDMsgReader.js index da3332b5597ebb2bdf406da9e8c9ec9872856144..69c0ed2403009a4ff43f2c4bd6af6fa4d9df2bfc 100644 --- a/xtrn/DDMsgReader/DDMsgReader.js +++ b/xtrn/DDMsgReader/DDMsgReader.js @@ -73,6 +73,9 @@ * Bug fix: When forwarding a message, it now correctly * sets the to_net_type property in the message header to * FidoNet or internet for those types of message destinations + * 2020-12-01 Eric Oulashin Version 1.39 + * When forwarding a message, added the ability to + * optionally edit the message before forwarding it. */ @@ -184,8 +187,8 @@ if (system.version_num < 31500) } // Reader version information -var READER_VERSION = "1.38"; -var READER_DATE = "2020-11-26"; +var READER_VERSION = "1.39"; +var READER_DATE = "2020-12-01"; // Keyboard key codes for displaying on the screen var UP_ARROW = ascii(24); @@ -13333,6 +13336,7 @@ function DigDistMsgReader_ForwardMessage(pMsgHdr, pMsgBody) else return "Unable to open the sub-board to get the message body"; } + // Prepend some lines to the message body to describe where // the message came from originally. var newMsgBody = "This is a forwarded message from " + system.name + "\n"; @@ -13354,6 +13358,56 @@ function DigDistMsgReader_ForwardMessage(pMsgHdr, pMsgBody) newMsgBody += "==================================\n\n"; newMsgBody += pMsgBody; + // New - Editing the message + // TODO: Ask whether to edit the message before forwarding it, + // and use console.editfile(filename) to edit it. + if (!console.noyes("Edit the message before sending")) + { + var baseWorkDir = system.node_dir + "DDMsgReader_Temp"; + deltree(baseWorkDir + "/"); + if (mkdir(baseWorkDir)) + { + // TODO: Let the user edit the message, then read it + // and set newMsgBody to it + var tmpMsgFilename = baseWorkDir + "/message.txt"; + // Write the current message to the file + var wroteMsgToTmpFile = false; + var outFile = new File(tmpMsgFilename); + if (outFile.open("w")) + { + wroteMsgToTmpFile = outFile.write(newMsgBody, newMsgBody.length); + outFile.close(); + } + if (wroteMsgToTmpFile) + { + // Let the user edit the file, and if successful, + // read it in to newMsgBody + if (console.editfile(tmpMsgFilename)) + { + var inFile = new File(tmpMsgFilename); + if (inFile.open("r")) + { + newMsgBody = inFile.read(inFile.length); + inFile.close(); + } + } + } + else + { + console.print("\1n\1cFailed to write message to a file for editing\1n"); + console.crlf(); + console.pause(); + } + } + else + { + console.print("\1n\1cCouldn't create temporary directory\1n"); + console.crlf(); + console.pause(); + } + } + // End New (editing message) + // Create part of a header object which will be used when saving/sending // the message. The destination ("to" informatoin) will be filled in // according to the destination type. diff --git a/xtrn/DDMsgReader/readme.txt b/xtrn/DDMsgReader/readme.txt index b686c334cb9dabdf15b2dcad5015e204b4034805..46c3e6ce0fffc3598c2f4aaea86b67f9e419615b 100644 --- a/xtrn/DDMsgReader/readme.txt +++ b/xtrn/DDMsgReader/readme.txt @@ -1,6 +1,6 @@ Digital Distortion Message Reader - Version 1.38 - Release date: 2020-11-26 + Version 1.39 + Release date: 2020-12-01 by diff --git a/xtrn/DDMsgReader/revision_history.txt b/xtrn/DDMsgReader/revision_history.txt index 03796ef04477f4ab8a0d067f70f7b465de7a69dc..8dd53fa16c6b3dec162927e48508c174e5d6e8f6 100644 --- a/xtrn/DDMsgReader/revision_history.txt +++ b/xtrn/DDMsgReader/revision_history.txt @@ -5,6 +5,8 @@ Revision History (change log) ============================= Version Date Description ------- ---- ----------- +1.39 2020-12-01 When forwarding a message, added the ability to optinally + edit the message before forwarding it. 1.38 2020-11-26 Bug fix: When forwarding a message, it now correctly sets sets the to_net_type property in the message header to FidoNet or internet for those types of message