Skip to content
Snippets Groups Projects
DDMsgReader.js 730.64 KiB
/* 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 ...
 * 2022-03-14 Eric Oulashin     Version 1.47
 *                              Updated to make DDMsgReader can be called directly as a
 *                              loadable module by Synchronet (work started on March 8).
 *                              Also, refactored to use attr_conv.js and removed the
 *                              attribute conversion functions from this script.
 * 2022-03-23 Eric Oulashin     Version 1.47a
 *                              Now calls bbs.edit_msg() to edit an existing message (if
 *                              that function exists - It was added in Synchronet 3.18).
 * 2022-06-12 Eric Oulashin     Version 1.48
 *                              Improved display of ANSI messages via the use of the Graphic object
 * 2022-06-13 Eric Oulashin     Version 1.49
 *                              Refactor: Simplified saving a message to BBS machine for sysop
 *                              (as-is, less processing); removed attachment stuff for pre-Synchronet
 *                              3.17; moved hasSyncAttrCodes() to attr_conv.js because that's where it
 *                              needs to be.
 * 2022-06-13 Eric Oulashin     Version 1.50
 *                              When doing a text search, it now ignores the user scan configuration for
 *                              sub-boards, to ensure it will show any results of the text search.
 * 2020-07-05 Eric Oulashin     Version 1.51
 *                              Graphic is now only used when using the scrollable interface. Also,
 *                              when creating the Graphic, now subtracting 1 from the reading area height
 *                              to avoid making the Graphic one line too tall to avoid unnecessary scrolling.
 *                              When saving messages with ANSI codes, Graphic is only used if the message has
 *                              any ASCII drawing characters. (not sure if this really matters much though).
 *                              Also, applied "use strict" and made some changes as necessary.
 */

"use strict";

// TODO: In the message list, add the ability to search with / similar to my area chooser

/* 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)
            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)