diff --git a/exec/SlyEdit.js b/exec/SlyEdit.js index 0ff107c6f776001e8d62b7973d7713a3554c4d1a..8f3c8a897608839cf3c2f37b949986c6cf158a3b 100644 --- a/exec/SlyEdit.js +++ b/exec/SlyEdit.js @@ -100,6 +100,14 @@ * for access), SlyEdit now uses the first sub-board * that the user can post into. This avoids crashes * due to JavaScript errors. + * 2013-02-17 Eric Oulashin Version 1.24 + * Bug fix: If the user is posting a new message + * on a sub-board, SlyEdit now should have the + * correct sub-board info, even if the user is posting + * on a different sub-board than the one they're + * currently set for reading. + * Also, defaulted the option for indenting quote + * lines with initials to true. */ /* Command-line arguments: @@ -172,8 +180,8 @@ if (!console.term_supports(USER_ANSI)) } // Constants -const EDITOR_VERSION = "1.23"; -const EDITOR_VER_DATE = "2013-02-13"; +const EDITOR_VERSION = "1.24"; +const EDITOR_VER_DATE = "2013-02-17"; // Program variables @@ -403,7 +411,8 @@ console.clear(); // Read the message from name, to name, and subject from the drop file // (msginf in the node directory). -var gMsgAreaInfo = getCurMsgInfo(); // Contains info about the current sub-board +var gMsgAreaInfo = null; // Will store the value returned by getCurMsgInfo(). +var setMsgAreaInfoObj = false; var gMsgSubj = ""; var gFromName = user.alias; var gToName = gInputFilename; @@ -426,6 +435,14 @@ if (dropFileName != undefined) gMsgSubj = info[2]; gMsgArea = info[4]; + // Now that we know the name of the message area + // that the message is being posted in, call + // getCurMsgInfo() to set gMsgAreaInfo. + gMsgAreaInfo = getCurMsgInfo(gMsgArea); + setMsgAreaInfoObj = true; + + // If we're configured to use poster's initials in the + // quote lines, then do it. if (gConfigSettings.useQuoteLineInitials) { // For the name to use for quote line initials: @@ -465,49 +482,18 @@ if (dropFileName != undefined) } file_remove(dropFileName); } +// If gMsgAreaInfo hasn't been set yet, then set it. +if (!setMsgAreaInfoObj) +{ + gMsgAreaInfo = getCurMsgInfo(gMsgArea); + setMsgAreaInfoObj = true; +} +// Set a variable to store whether or not cross-posting can be done. +var gCanCrossPost = (gConfigSettings.allowCrossPosting && postingInMsgSubBoard(gMsgArea)); // If the user is posting in a message sub-board, then add its information // to gCrossPostMsgSubs. if (postingInMsgSubBoard(gMsgArea)) gCrossPostMsgSubs.add(gMsgAreaInfo.subBoardCode); -// Set a variable to store whether or not cross-posting can be done. -var gCanCrossPost = (gConfigSettings.allowCrossPosting && postingInMsgSubBoard(gMsgArea)); -// If the message area name (gMsgArea) is different from what's in gMsgAreaInfo, -// then we probably want to use bbs.cursub_code instead of bbs.smb_sub_code, etc. -if (msg_area.sub[gMsgAreaInfo.subBoardCode].name.indexOf(gMsgArea) == -1) -{ - gMsgAreaInfo.lastMsg = -1; - gMsgAreaInfo.curMsgNum = -1; - // If the user has a valid current sub-board code, then use it; - // otherwise, find the first sub-board the user is able to post - // in and use that. - if (typeof(msg_area.sub[bbs.cursub_code]) != "undefined") - { - gMsgAreaInfo.subBoardCode = bbs.cursub_code; - gMsgAreaInfo.grpIndex = msg_area.sub[bbs.cursub_code].grp_index; - } - else - { - var firstPostableSubInfo = getFirstPostableSubInfo(); - gMsgAreaInfo.subBoardCode = firstPostableSubInfo.subCode; - gMsgAreaInfo.grpIndex = firstPostableSubInfo.grpIndex; - } - - // If we got a valid sub-board code, then open that sub-board - // and get the total number of messages from it. - if (gMsgAreaInfo.subBoardCode.length > 0) - { - var tmpMsgBaseObj = new MsgBase(gMsgAreaInfo.subBoardCode); - if (tmpMsgBaseObj.open()) - { - gMsgAreaInfo.totalNumMsgs = tmpMsgBaseObj.total_msgs; - tmpMsgBaseObj.close(); - } - else - gMsgAreaInfo.totalNumMsgs = 0; - } - else - gMsgAreaInfo.totalNumMsgs = 0; -} // Open the quote file / message file var inputFile = new File(gInputFilename); diff --git a/exec/SlyEdit_Misc.js b/exec/SlyEdit_Misc.js index 8c3342778446b322f80c89c850ea4cfeaf4d7f31..6b9eeaa7ca00b9122e795ab562337bd93122e9f3 100644 --- a/exec/SlyEdit_Misc.js +++ b/exec/SlyEdit_Misc.js @@ -78,7 +78,8 @@ * 2013-02-13 Eric Oulashin Updated getCurMsgInfo() to get the first * postable message sub-board if the user has no * current sub-board (i.e., a new user is applying - * for access). + * for access). Also, updated ReadSlyEditConfigFile() + * to default indentQuoteLinesWithInitials to true. */ // Note: These variables are declared with "var" instead of "const" to avoid @@ -695,7 +696,7 @@ function ReadSlyEditConfigFile() // The next setting specifies whether or not quote lines // should be prefixed with a space when using author // initials. - cfgObj.indentQuoteLinesWithInitials = false; + cfgObj.indentQuoteLinesWithInitials = true; cfgObj.allowCrossPosting = true; // General SlyEdit color settings @@ -1941,7 +1942,10 @@ function wrapQuoteLines(pUseAuthorInitials, pIndentQuoteLinesWithInitials) // Distortion Message Lister v1.31 and higher). If that file can't be read, // the values will default to the values of bbs.smb_last_msg, // bbs.smb_total_msgs, and bbs.smb_curmsg. -function getCurMsgInfo() +// +// Parameters: +// pMsgAreaName: The name of the message area being posted to +function getCurMsgInfo(pMsgAreaName) { var retObj = new Object(); if (bbs.smb_sub_code.length > 0) @@ -1987,6 +1991,47 @@ function getCurMsgInfo() else retObj.totalNumMsgs = 0; } + // If pMsgAreaName is valid, then if it specifies a message area name that is + // different from what's in retObj, then we probably want to use bbs.cursub_code + // instead of bbs.smb_sub_code, etc. + if ((typeof(pMsgAreaName) == "string") && (pMsgAreaName.length > 0)) + { + if (msg_area.sub[retObj.subBoardCode].name.indexOf(pMsgAreaName) == -1) + { + retObj.lastMsg = -1; + retObj.curMsgNum = -1; + // If the user has a valid current sub-board code, then use it; + // otherwise, find the first sub-board the user is able to post + // in and use that. + if (typeof(msg_area.sub[bbs.cursub_code]) != "undefined") + { + retObj.subBoardCode = bbs.cursub_code; + retObj.grpIndex = msg_area.sub[bbs.cursub_code].grp_index; + } + else + { + var firstPostableSubInfo = getFirstPostableSubInfo(); + retObj.subBoardCode = firstPostableSubInfo.subCode; + retObj.grpIndex = firstPostableSubInfo.grpIndex; + } + + // If we got a valid sub-board code, then open that sub-board + // and get the total number of messages from it. + if (retObj.subBoardCode.length > 0) + { + var tmpMsgBaseObj = new MsgBase(retObj.subBoardCode); + if (tmpMsgBaseObj.open()) + { + retObj.totalNumMsgs = tmpMsgBaseObj.total_msgs; + tmpMsgBaseObj.close(); + } + else + retObj.totalNumMsgs = 0; + } + else + retObj.totalNumMsgs = 0; + } + } // If the Digital Distortion Message Lister drop file exists, // then use the message information from that file instead.