Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Commits
aacffcda
Commit
aacffcda
authored
May 25, 2013
by
nightfox
Browse files
Made a small internal code optimization.
parent
6867dfb5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
16 deletions
+34
-16
exec/SlyEdit.js
exec/SlyEdit.js
+7
-3
exec/SlyEdit_Misc.js
exec/SlyEdit_Misc.js
+27
-13
No files found.
exec/SlyEdit.js
View file @
aacffcda
...
...
@@ -28,7 +28,7 @@
* to specify whether the message number is an
* offset. Released as version 1.26 after some
* testing.
* 2013-05-2
3
Eric Oulashin Version 1.27
* 2013-05-2
4
Eric Oulashin Version 1.27
* Updated to check whether bbs.msg_number is > 0
* rather than checking the Synchronet version
* >= 3.16 & build date at least May 12, 2013
...
...
@@ -36,7 +36,11 @@
* bbs.smb_curmsg. Sysops who use Digital
* Message Lister must now update the message
* lister to version 1.36 or newer to properly
* work with this version of SlyEdit.
* work with this version of SlyEdit. Also,
* in SlyEdit_Misc.js, updated to add one more
* data member to the return object:
* msgNumIsOffset, which stores whether or not the
* message number is an offset.
*/
/* Command-line arguments:
...
...
@@ -110,7 +114,7 @@ if (!console.term_supports(USER_ANSI))
// Constants
const
EDITOR_VERSION
=
"
1.27
"
;
const
EDITOR_VER_DATE
=
"
2013-05-2
3
"
;
const
EDITOR_VER_DATE
=
"
2013-05-2
4
"
;
// Program variables
...
...
exec/SlyEdit_Misc.js
View file @
aacffcda
...
...
@@ -97,6 +97,19 @@
* to be figured out once, and eliminates the
* need for a global variable to store it for
* speed optimization purposes.
* 2013-05-23 Eric Oulashin Simplified the decision of whether to use
* bbs.msg_number or bbs.smb_curmsg by checking
* whether bbs.msg_number is > 0 (if it is, then
* it's valid, so use it). This is simpler than
* checking the Synchronet version & build date.
* 2013-05-24 Eric Oulashin Updated getCurMsgInfo() to add one more
* data member to the return object:
* msgNumIsOffset, which stores whether or not the
* message number is an offset. If not, then it's
* the aboslute message number (i.e., bbs.msg_number).
* That simplified getFromNameForCurMsg(), which can
* pass that to msgBase.get_msg_header().
*
*/
// Note: These variables are declared with "var" instead of "const" to avoid
...
...
@@ -1961,6 +1974,9 @@ function wrapQuoteLines(pUseAuthorInitials, pIndentQuoteLinesWithInitials)
// bbs.msg_number is preferred because it works properly in all
// situations, whereas in earlier builds, bbs.msg_number was
// always given to JavaScript scripts as 0.
// msgNumIsOffset: Boolean - Whether or not the message number is an offset.
// If not, then it is the absolute message number (i.e.,
// bbs.msg_number).
// subBoardCode: The current sub-board code (i.e., bbs.smb_sub_code)
// grpIndex: The message group index for the sub-board
//
...
...
@@ -1975,6 +1991,7 @@ function wrapQuoteLines(pUseAuthorInitials, pIndentQuoteLinesWithInitials)
function
getCurMsgInfo
(
pMsgAreaName
)
{
var
retObj
=
new
Object
();
retObj
.
msgNumIsOffset
=
false
;
if
(
bbs
.
smb_sub_code
.
length
>
0
)
{
retObj
.
lastMsg
=
bbs
.
smb_last_msg
;
...
...
@@ -1983,7 +2000,14 @@ function getCurMsgInfo(pMsgAreaName)
// use the older behavior of using bbs.smb_curmsg (the offset) instead.
// bbs.msg_number was correct in Synchronet 3.16 builds starting on
// May 12, 2013.
retObj
.
curMsgNum
=
(
bbs
.
msg_number
>
0
?
bbs
.
msg_number
:
bbs
.
smb_curmsg
);
//retObj.curMsgNum = (bbs.msg_number > 0 ? bbs.msg_number : bbs.smb_curmsg);
if
(
bbs
.
msg_number
>
0
)
retObj
.
curMsgNum
=
bbs
.
msg_number
;
else
{
retObj
.
curMsgNum
=
bbs
.
smb_curmsg
;
retObj
.
msgNumIsOffset
=
true
;
}
retObj
.
subBoardCode
=
bbs
.
smb_sub_code
;
retObj
.
grpIndex
=
msg_area
.
sub
[
bbs
.
smb_sub_code
].
grp_index
;
}
...
...
@@ -2101,6 +2125,7 @@ function getCurMsgInfo(pMsgAreaName)
break
;
case
3
:
retObj
.
curMsgNum
=
+
fileLine
;
retObj
.
msgNumIsOffset
=
false
;
// For Message Lister 1.36 and newer
break
;
case
4
:
retObj
.
subBoardCode
=
fileLine
;
...
...
@@ -2147,18 +2172,7 @@ function getFromNameForCurMsg(pMsgInfo)
if
(
msgBase
!=
null
)
{
msgBase
.
open
();
// The first parameter to msgBase.get_msg_header() is whether the message
// number is an offset. We only want to use offsets if bbs.msg_number is
// 0, since bbs.msg_number is 1-based. bbs.msg_numer became valid in
// Synchronet 3.16 builds starting onMay 12, 2013.
//var msgNumAsOffset = (bbs.msg_number == 0);
// Use an offset if bbs.msg_number is 0 and Digital Distortion Message
// Lister's drop file does not exist. Otherwise, we'll be using the
// absolute message number. Note: If using Digital Distortion's Message
// Lister, this logic requires version 1.36 or newer of Digital Distortion's
// Message Lister, or else this might get the wrong message header.
var
msgNumAsOffset
=
((
bbs
.
msg_number
==
0
)
&&
!
file_exists
(
gDDML_DROP_FILE_NAME
));
var
hdr
=
msgBase
.
get_msg_header
(
msgNumAsOffset
,
msgInfo
.
curMsgNum
,
true
);
var
hdr
=
msgBase
.
get_msg_header
(
msgInfo
.
msgNumIsOffset
,
msgInfo
.
curMsgNum
,
true
);
if
(
hdr
!=
null
)
fromName
=
hdr
.
from
;
msgBase
.
close
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment