From 64418b1be31464c32e867b223fd036fc58e539d8 Mon Sep 17 00:00:00 2001 From: nightfox <> Date: Fri, 1 May 2015 02:53:41 +0000 Subject: [PATCH] SlyEdit v1.44 update - Bug fix: When cross-posting a message in other message areas, the message area settings are now checked to see whether the user's real name should be used for the 'From' name. Previously, SlyEdit was always using the user's alias as the 'From' name when cross-posting. --- exec/SlyEdit.js | 19 +++++--- exec/SlyEdit_Misc.js | 101 ++++++++++++++++++++++--------------------- 2 files changed, 65 insertions(+), 55 deletions(-) diff --git a/exec/SlyEdit.js b/exec/SlyEdit.js index 0bc3285461..92a155633a 100644 --- a/exec/SlyEdit.js +++ b/exec/SlyEdit.js @@ -36,8 +36,15 @@ * Bug fixes in wrapTextLines() in SlyEdit_Misc: * No more extra blank lines added to quote lines, * and no more leading spaces added to quote lines. - * 2015-11-16 Eric Oulashin Version 1.43 + * 2015-01-16 Eric Oulashin Version 1.43 * Releasing this version after several days of testing. + * 2015-04-30 Eric Oulashin Version 1.44 + * Bug fix: When cross-posting a message in other + * message areas, the message area settings are now + * checked to see whether the user's real name + * should be used for the 'From' name. Previously, + * SlyEdit was always using the user's alias as + * the 'From' name when cross-posting. */ /* Command-line arguments: @@ -115,8 +122,8 @@ if (!console.term_supports(USER_ANSI)) } // Constants -const EDITOR_VERSION = "1.43"; -const EDITOR_VER_DATE = "2015-01-16"; +const EDITOR_VERSION = "1.44"; +const EDITOR_VER_DATE = "2015-04-30"; // Program variables @@ -512,7 +519,7 @@ if ((exitCode == 0) && (gEditLines.length > 0)) // Clear the screen and display the end-of-program information (if the setting // is enabled). -console.clear("n"); +console.clear("\1n"); if (gConfigSettings.displayEndInfoScreen) { displayProgramExitInfo(false); @@ -572,9 +579,9 @@ if ((exitCode == 0) && (gEditLines.length > 0)) msgContents += msgSigInfo.sigContents + "\r\n"; } - console.print("n"); + console.print("\1n"); console.crlf(); - console.print("n" + gConfigSettings.genColors.msgWillBePostedHdr + "Your message will be posted into the following area(s):"); + console.print("\1n" + gConfigSettings.genColors.msgWillBePostedHdr + "Your message will be posted into the following area(s):"); console.crlf(); // If the user is posting in the originally-chosen sub-board and other sub-boards, // then make a log in the BBS log that the user is posting a message (for diff --git a/exec/SlyEdit_Misc.js b/exec/SlyEdit_Misc.js index ac57032fe3..c03dfe71ab 100644 --- a/exec/SlyEdit_Misc.js +++ b/exec/SlyEdit_Misc.js @@ -3341,55 +3341,58 @@ function numObjProperties(pObject) // Return value: String - Blank on success, or message on failure. function postMsgToSubBoard(pSubBoardCode, pTo, pSubj, pMessage, pFromUserNum) { - // Return if the parameters are invalid. - if (typeof(pSubBoardCode) != "string") - return ("Sub-board code is not a string"); - if (typeof(pTo) != "string") - return ("To name is not a string"); - if (pTo.length == 0) - return ("The 'to' user name is blank"); - if (typeof(pSubj) != "string") - return ("Subject is not a string"); - if (pSubj.length == 0) - return ("The subject is blank"); - if (typeof(pMessage) != "string") - return ("Message is not a string"); - if (pMessage.length == 0) - return ("Not sending an empty message"); - if (typeof(pFromUserNum) != "number") - return ("From user number is not a number"); - if ((pFromUserNum <= 0) || (pFromUserNum > system.lastuser)) - return ("Invalid user number"); - - // LOad the user record specified by pFromUserNum. If it's a deleted user, - // then return an error. - var fromUser = new User(pFromUserNum); - if (fromUser.settings & USER_DELETED) - return ("The 'from' user is marked as deleted"); - - var msgbase = new MsgBase(pSubBoardCode); - if ((msgbase.open != undefined) && !msgbase.open()) - { - msgbase.close(); - return ("Error opening the message area: " + msgbase.last_error); - } - - // Create the message header, and send the message. - var header = new Object(); - header.to = pTo; - header.from_net_type = NET_NONE; - header.to_net_type = NET_NONE; - header.from = fromUser.alias; - header.from_ext = fromUser.number; - header.from_net_addr = fromUser.netmail; - header.subject = pSubj; - var saveRetval = msgbase.save_msg(header, pMessage); - msgbase.close(); - - if (!saveRetval) - return ("Error saving the message: " + msgbase.last_error); - - return ""; + // Return if the parameters are invalid. + if (typeof(pSubBoardCode) != "string") + return ("Sub-board code is not a string"); + if (typeof(pTo) != "string") + return ("To name is not a string"); + if (pTo.length == 0) + return ("The 'to' user name is blank"); + if (typeof(pSubj) != "string") + return ("Subject is not a string"); + if (pSubj.length == 0) + return ("The subject is blank"); + if (typeof(pMessage) != "string") + return ("Message is not a string"); + if (pMessage.length == 0) + return ("Not sending an empty message"); + if (typeof(pFromUserNum) != "number") + return ("From user number is not a number"); + if ((pFromUserNum <= 0) || (pFromUserNum > system.lastuser)) + return ("Invalid user number"); + + // LOad the user record specified by pFromUserNum. If it's a deleted user, + // then return an error. + var fromUser = new User(pFromUserNum); + if (fromUser.settings & USER_DELETED) + return ("The 'from' user is marked as deleted"); + + // Open the sub-board so that the message can be posted there. + var msgbase = new MsgBase(pSubBoardCode); + if (!msgbase.open()) + return ("Error opening the message area: " + msgbase.last_error); + + // Create the message header, and send the message. + var header = new Object(); + header.to = pTo; + header.from_net_type = NET_NONE; + header.to_net_type = NET_NONE; + // For the 'From' name, use the user's real name if the sub-board is set + // up to post using real names; otherwise, use the user's alias. + if ((msgbase.cfg.settings & SUB_NAME) == SUB_NAME) + header.from = fromUser.name; + else + header.from = fromUser.alias; + header.from_ext = fromUser.number; + header.from_net_addr = fromUser.netmail; + header.subject = pSubj; + var saveRetval = msgbase.save_msg(header, pMessage); + msgbase.close(); + + if (!saveRetval) + return ("Error saving the message: " + msgbase.last_error); + + return ""; } // Reads the current user's message signature file (if it exists) -- GitLab