Newer
Older
/* This is a message reader/lister door for Synchronet. Features include:
* - Listing messages in the user's current message area with the ability to
* navigate forwards & backwards through the list (and for ANSI users, a
* lightbar interface will be used, or optionally can be set to use a more
* traditional interface for ANSI users)
* - The user can select a message from the list to read and optionally reply to
* - For ANSI users, reading messages is done with an enhanced user interface,
* with the ability to scroll up & down through the message, move to the next
* or previous message using the right & left arrow keys, display the message
* list to choose another message to read, etc.
* - The ability to start up with the message list or reading messages in the
* user's current message area (AKA sub-board)
* - Message searching
*
* Author: Eric Oulashin (AKA Nightfox)
* BBS: Digital Distortion
* BBS address: digitaldistortionbbs.com (or digdist.bbsindex.com)
*
* Date Author Description
* 2014-09-13 Eric Oulashin Started (based on my message lister script)
* ... Comments trimmed ...
* 2020-04-03 Eric Oulashin Version 1.29
* When reading a message, if a message is written to the
* current user, the 'To' username in the header above
* the message is now written in a different color.
* 2020-04-07 Eric Oulashin Version 1.30
* The message list features now uses DDLightbarMenu
* rather than the internal lightbar chooser code.
* Later I also plan to update the area chooser code
* to use DDLightbarMenu as well and remove the
* internal lightbar chooser code altogether.
* 2020-04-13 Eric Oulashin Version 1.31
* The area change feature now uses DDLightbarMenu.
* There is no more internal lightbar code in this
* message reader.
* 2020-04-19 Eric Oulashin Version 1.32
* Removed some code that's no longer used. Also,
* fixed an issue when changing to another sub-board
* with the traditional-style (non-lightbar) list
* where it was slow to list sub-boards. For the number
* of messages, it was checking all headers to ignore
* ones marked as deleted, etc., but that can be
* fairly slow.. Now it just uses total_msgs for the
* MessageBase object, which is a lot faster and still
* gives an idea of how many messages are there.
* 2020-04-21 Eric Oulashin Version 1.33
* Fixed: A new user starting to read messages in
* a sub-board no longer causes an error (it checks
* for the scan_ptr being 0xffffffff). This had
* been fixed in a couple places previously, but
* apparently not this particular case.
* 2020-05-11 Eric Oulashin Version 1.34
* The message list mode now honors anonymous posts,
* showing the 'from' name as "Anonymous" (for non-sysops).
* The sysop can still see the real name of the poster.
* 2020-05-13 Eric Oulashin Version 1.35
* Fixed some logic in determining how to address
* a personal email when replying (either to a local
* user or via their network address).
* 2020-05-23 Eric Oulashin Version 1.36
* Added a command-line parameter, -onlyNewPersonalEmail,
* which specifies to list/read only new/unread personal
* email to the user. And for integration with Synchronet
* via the "Read Email" loadable module, this is to
* be used together with the updated DDReadPersonalEmail.js.
* 2020-07-11 Eric Oulashin Version 1.37
* Added mouse support to the scrollable reader interface.
* The integrated area changer functionality doesn't have mouse
* support yet.

Eric Oulashin
committed
* 2020-11-26 Eric Oulashin Verison 1.38
* 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.
* 2021-01-31 Michael Long Version 1.40
* Fixed left/right colors not being customizable on message
* list lightbar
* 2021-02-12 Eric Oulashin Version 1.41
* Bug fix: When changing to another area with the lightbar
* interface, if the user's current sub-board is a high-numbered
* sub-board and they select a message group with fewer
* sub-boards, the highlighted sub-board in that group would
* be set to that high number and would be incorrect.
* That has been fixed. Copied a fix from my stand-alone
* message area chooser. In that scenario, the current
* highlighted sub-board in the other group will be
* the first one.
* 2021-03-15 Eric Oulashin Version 1.42 Beta
* Started working on converting HTML entities in
* HTML-formatted messages.
* 2021-08-02 Added the ability to sort the message list by date
* & time written rather than the import date/time.
* This is specified in the configuration file via the
* msgListSort option.
* 2022-01-13 Eric Oulashin Version 1.42
* Fixed attachment downloading.
Eric Oulashin
committed
* 2022-02-10 Eric Oulashin Version 1.43
* Fixed the memory error when viewing message header info
* (I had used the same loop control variable name for a loop
* inside a loop..oops). Also, added a check to the header
* properties so that it won't display JS functions when viewing
* the message header information.
Eric Oulashin
committed
* 2022-02-15 Eric Oulashin Version 1.44 Beta
* Removed the scanScopePromptText text line and used
* the SubGroupOrAll line (621) from text.dat instead.
* Updated to support @-codes in configured text strings.
* Also, started working on making text search support
* sub-board, group, or all like the other text searching.
* When reading the theme file, color settings are now checked
* to ensure they only have Synchronet attribute codes.
* 2022-02-19 Eric Oulashin Version 1.44
* Releasing this version.
*/
/* Command-line arguments (in -arg=val format, or -arg format to enable an
option):
-search: A search type. Available options:
keyword_search: Do a keyword search in message subject/body text (current message area)
from_name_search: 'From' name search (current message area)
to_name_search: 'To' name search (current message area)
to_user_search: To user search (current message area)
new_msg_scan: New message scan (prompt for current sub-board, current
group, or all)
new_msg_scan_all: New message scan (all sub-boards)
new_msg_scan_cur_grp: New message scan (current message group only)

nightfox
committed
new_msg_scan_cur_sub: New message scan (current sub-board only). This
can (optionally) be used with the -subBoard
command-line parameter, which specifies an internal
code for a sub-board, which may be different from
the user's currently selected sub-board.
to_user_new_scan: Scan for new (unread) messages to the user (prompt
for current sub-board, current group, or all)
to_user_new_scan_all: Scan for new (unread) messages to the user
(all sub-boards)
to_user_new_scan_cur_grp: Scan for new (unread) messages to the user
(current group)
to_user_new_scan_cur_sub: Scan for new (unread) messages to the user
(current sub-board)
to_user_all_scan: Scan for all messages to the user (prompt for current
sub-board, current group, or all)
prompt: Prompt the user for one of several search/scan options to
choose from
Note that if the -personalEmail option is specified (to read personal
email), the only valid search types are keyword_search and
from_name_search.
-suppressSearchTypeText: Disable the search type text that would appear
above searches or scans (such as "New To You
Message Scan", etc.)
-startMode: Startup mode. Available options:
list (or lister): Message list mode
read (or reader): Message read mode
-configFilename: Specifies the name of the configuration file to use.
Defaults to DDMsgReader.cfg.
-personalEmail: Read personal email to the user. This is a true/false value.
It doesn't need to explicitly have a =true or =false afterward;
simply including -personalEmail will enable it. If this is specified,
the -chooseAreaFirst and -subBoard options will be ignored.
-personalEmailSent: Read personal email to the user. This is a true/false
value. It doesn't need to explicitly have a =true or =false
afterward; simply including -personalEmailSent will enable it.
-allPersonalEmail: Read all personal email (to/from all)
-userNum: Specify a user number (for the personal email options)
-chooseAreaFirst: Display the message area chooser before reading/listing
messages. This is a true/false value. It doesn't need
to explicitly have a =true or =false afterward; simply
including -chooseAreaFirst will enable it. If -personalEmail
or -subBoard is specified, then this option won't have any
effect.
-subBoard: The sub-board (internal code or number) to read, other than the user's
current sub-board. If this is specified, the -chooseAreaFirst option
will be ignored.
-verboseLogging: Enable logging to the system log & node log. Currently, there
isn't much that will be logged, but more log messages could be
added in the future.
*/
// TODOs:
Eric Oulashin
committed
// - Search in text: Support current sub-board, group, or all searching
// - Make use of these lines from text.dat?
// "\1n\1c(\1h%u \1n\1csub-boards)\1h\1w complete.\r\n" 117 MessageScanComplete
// "\1r\1iaborted.\1n\r\n" 118 MessageScanAborted
// - For pageUp & pageDown, enable alternate keys:
// - When reading a message - scrollTextLines()
// - When listing messages
// - When listing message groups & sub-boards for sub-board selection
// - For sub-board area search:
// - Enable searching in traditional interface
// - Update the keys in the lightbar help line and traditional interface
const requireFnExists = (typeof(require) === "function");
if (requireFnExists)
{
require("sbbsdefs.js", "K_UPPER");
require("text.js", "Email"); // Text string definitions (referencing text.dat)
require("utf8_cp437.js", "utf8_cp437");
Loading
Loading full blame...