Skip to content
Snippets Groups Projects
Commit 02c962f2 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Merge branch 'ddmr_loadable_module_update' into 'master'

DDMsgReader can be called directly as a loadable module

See merge request !159
parents 0c9985d4 49b2f946
No related branches found
No related tags found
2 merge requests!463MRC mods by Codefenix (2024-10-20),!159DDMsgReader can be called directly as a loadable module
......@@ -1066,16 +1066,22 @@ function ANSIMultiConvertToSyncCodes(pText)
//
// Parameters:
// pText: The text to be converted
// pConvertANSI: Optional boolean - Whether or not to convert ANSI. Defaults to true.
//
// Return value: The text with various other system attribute codes converted
// to Synchronet attribute codes, or not, depending on the toggle
// options in Extra Attribute Codes in SCFG
function convertAttrsToSyncPerSysCfg(pText)
function convertAttrsToSyncPerSysCfg(pText, pConvertANSI)
{
// Convert any ANSI codes to Synchronet attribute codes.
// Then convert other BBS attribute codes to Synchronet attribute
// codes according to the current system configuration.
var convertedText = ANSIAttrsToSyncAttrs(pText);
var convertedText = pText;
var convertANSI = (typeof(pConvertANSI) === "boolean" ? pConvertANSI : true);
if (convertANSI)
{
// Convert any ANSI codes to Synchronet attribute codes.
// Then convert other BBS attribute codes to Synchronet attribute
// codes according to the current system configuration.
convertedText = ANSIAttrsToSyncAttrs(convertedText);
}
if ((system.settings & SYS_RENEGADE) == SYS_RENEGADE)
convertedText = renegadeAttrsToSyncAttrs(convertedText);
if ((system.settings & SYS_WWIV) == SYS_WWIV)
......
This diff is collapsed.
// SYSOPS: Change the msgReaderPath variable if you put Digital Distortion
// Message Reader in a different path
var msgReaderPath = "../xtrn/DDMsgReader";
// Run Digital Distortion Message Reader
bbs.exec("?" + msgReaderPath + "/DDMsgReader.js " + argv.join(" "));
\ No newline at end of file
// $Id: DDReadPersonalMail.js,v 1.5 2020/05/23 23:35:48 nightfox Exp $
// This script is to be executed for the 'Read mail' loadable module, configured
// in SCFG in System > Loadable Modules.
if (typeof(require) === "function")
require("sbbsdefs.js", "SCAN_UNREAD");
else
load("sbbsdefs.js");
console.print("\1n");
// Synchronet will pass 2 command-line arguments:
// 1. The 'which' mailbox value (numeric) - MAIL_YOUR, MAIL_SENT, or MAIL_ALL.
// MAIL_ANY won't be passed to this script.
// 2. The user number (numeric)
if (argc < 2)
{
console.print("\1h\1yNot enough arguments were passed to the Read Mail module! Please inform the");
console.crlf();
console.print("sysop.\1n");
console.crlf();
console.pause();
exit(1);
}
//bbs.read_mail(whichMailbox);
//exit(0);
var whichMailbox = Number(argv[0]);
var userNum = Number(argv[1]);
// The 3rd argument is mode bits. See if we should only display new (unread)
// personal email.
var newMailOnly = false;
if (argv.length >= 3)
{
var modeVal = +(argv[2]);
newMailOnly = (((modeVal & SCAN_FIND) == SCAN_FIND) && ((modeVal & LM_UNREAD) == LM_UNREAD));
}
// SYSOPS: Change the msgReaderPath variable if you put Digital Distortion
// Message Reader in a different path
var msgReaderPath = "../xtrn/DDMsgReader";
// The readerStartMode variable, below, controls whether the reader
// is to start in reader mode or message list mode. Set it to "list"
// for list mode or "read" for reader mode.
var readerStartmode = "list";
//var readerStartmode = "read";
// The start of the command string to use with bbs.exec()
var rdrCmdStrStart = "?" + msgReaderPath + "/DDMsgReader.js ";
// Launch Digital Distortion depending on the value whichMailBox.
// Note: MAIL_ANY won't be passed to this script.
switch (whichMailbox)
{
case MAIL_YOUR: // Mail sent to you
var cmdArgs = "-personalEmail -userNum=" + userNum;
if (newMailOnly)
cmdArgs += " -onlyNewPersonalEmail";
cmdArgs += " -startMode=" + readerStartmode;
bbs.exec(rdrCmdStrStart + cmdArgs);
break;
case MAIL_SENT: // Mail you have sent
bbs.exec(rdrCmdStrStart + "-personalEmailSent -userNum=" + userNum + " -startMode=" + readerStartmode);
break;
case MAIL_ALL:
bbs.exec(rdrCmdStrStart + "-allPersonalEmail -startMode=" + readerStartmode);
break;
default:
bbs.read_mail(whichMailbox);
break;
}
\ No newline at end of file
// $Id: DDScanMsgs.js,v 1.9 2020/05/23 23:26:55 nightfox Exp $
// This script is to be executed for the 'Scan Msgs' loadable module, configured
// in SCFG in System > Loadable Modules.
//
// This module is used for:
// - Simply reading a sub-board
// - Find text in messages
//
// Date Author Description
// 2015-05-06 Eric Oulashin Version 1.0 - Initial release
// 2015-06-10 Eric Oulashin Version 1.02
// Bug fix: Switched to bbs.scan_msgs() instead of
// bbs.scan_subs() for all other scan modes besides
// SCAN_READ.
// For stock Synchronet functionality:
//bbs.scan_msgs([sub-board=current] [,mode=SCAN_READ] [,string find])
load("sbbsdefs.js");
console.print("\1n");
// Synchronet will pass at least 2 command-line arguments and sometimes 3:
// 1. The sub-board internal code
// 2. The scan mode (numeric)
// 3. Optional: Search text (if any)
if (argc < 2)
{
console.print("\1h\1yNot enough arguments were passed to the Scan Messages module! Please inform the");
console.crlf();
console.print("sysop.\1n");
console.crlf();
console.pause();
exit(1);
}
var subBoardCode = argv[0];
var scanMode = Number(argv[1]);
var searchText = argv[2];
// SYSOPS: Change the msgReaderPath variable if you put Digital Distortion
// Message Reader in a different path
var msgReaderPath = "../xtrn/DDMsgReader";
// The start of the command string to use with bbs.exec()
var rdrCmdStrStart = "?" + msgReaderPath + "/DDMsgReader.js ";
// No extra mode bits set, only read: Use Digital Distortion Message Reader
// in read mode
if (scanMode == SCAN_READ)
bbs.exec(rdrCmdStrStart + "-subBoard=" + subBoardCode + " -startMode=read");
// Some modes that the Digital Distortion Message Reader doesn't handle yet: Use
// Synchronet's stock behavior.
else
bbs.scan_msgs(subBoardCode, scanMode, searchText);
\ No newline at end of file
// $Id: DDScanSubs.js,v 1.6 2020/05/23 23:26:55 nightfox Exp $
// This script is to be executed for the 'Scan Subs' loadable module, configured
// in SCFG in System > Loadable Modules.
//
// This script is used for:
// - Continuous new scan
// - Browse New Scan
// - New message scan
// - Scan for messages to you (new messages to you)
// - Find text in messages
load("sbbsdefs.js");
console.print("\1n");
// Synchronet will pass 2 command-line arguments: Whether or not all subs
// are being scanned, and the scan mode (numeric).
if (argc < 2)
{
console.print("\1h\1yNot enough arguments were passed to the Scan Subs module! Please inform the");
console.crlf();
console.print("sysop.\1n");
console.crlf();
console.pause();
exit(1);
}
var scanAllSubs = (argv[0] == "1");
var scanMode = Number(argv[1]);
// SYSOPS: Change the msgReaderPath variable if you put Digital Distortion
// Message Reader in a different path
var msgReaderPath = "../xtrn/DDMsgReader";
// The start of the command string to use with bbs.exec()
var rdrCmdStrStart = "?" + msgReaderPath + "/DDMsgReader.js ";
// Note: SCAN_READ is 0, so the mode bits will always look like they have
// SCAN_READ.
// For modes the Digital Distortion Message Reader doesn't handle yet, use
// Synchronet's stock behavior.
if (((scanMode & SCAN_CONST) == SCAN_CONST) || ((scanMode & SCAN_BACK) == SCAN_BACK))
bbs.scan_subs(scanMode, scanAllSubs);
else if ((scanMode & SCAN_NEW) == SCAN_NEW)
{
// Newscan
if (scanAllSubs)
bbs.exec(rdrCmdStrStart +"-search=new_msg_scan_all -suppressSearchTypeText");
else // Prompt for sub-board, group, or all
bbs.exec(rdrCmdStrStart + "-search=new_msg_scan -suppressSearchTypeText");
}
else if (((scanMode & SCAN_TOYOU) == SCAN_TOYOU) || ((scanMode & SCAN_UNREAD) == SCAN_UNREAD))
{
// Scan for messages posted to you/new messages posted to you
if (scanAllSubs)
bbs.exec(rdrCmdStrStart + "-startMode=read -search=to_user_new_scan_all -suppressSearchTypeText");
else // Prompt for sub-board, group, or all
bbs.exec(rdrCmdStrStart + "-startMode=read -search=to_user_new_scan -suppressSearchTypeText");
}
else if ((scanMode & SCAN_FIND) == SCAN_FIND)
bbs.exec(rdrCmdStrStart + "-search=keyword_search -startMode=list");
else // Stock Synchronet functionality
bbs.scan_subs(scanMode, scanAllSubs);
\ No newline at end of file
Digital Distortion Message Reader
Version 1.46
Release date: 2022-03-07
Version 1.47
Release date: 2022-03-14
by
......@@ -189,34 +189,39 @@ sbbs/xtrn/DDMsgReader directory.
Loadable Modules setup
----------------------
In Synchronet 3.16 builds starting on April 27, 2015, there are a few new
options in the Loadable Lodules configuration in SCFG: "Read Mail", "Scan
Msgs", and "Scan Subs". Functionality for these was updated on May 5, 2015.
These loadable modules options can enable the use of a message reader script
for the various message reading, searching, and scanning options provided by
Synchronet. That is probably the easiest way to install the reader, since it
only requires specifying a script in the Loadable Modules options and does not
require modification of your command shell. Setting it up that way also has
the advantage that the reader will be used for reading personal email and
performing a message newscan during the login process. If you have a recent
build of Synchronet 3.16 (or newer), then your version of Synchronet will
support this. If you are using an older version of Synchronet, skip ahead to
the "Command shell setup" subsection.
To set up the reader with the Loadable Module scripts, do the following:
1. Copy DDReadPersonalMail.js, DDScanMsgs.js, and DDScanSubs.js from the
loadable_module_scripts directory to your sbbs/mods directory
2. If you will be running the script from a directory other than
xtrn/DDMsgReader, edit the above scripts and search for the text "SYSOPS:"
(without the double-quotes). One or two lines below that, there is a
variable called msgReaderPath - Change that so that it contains the path
where you copied DDMsgReader.js.
3. Run Synchronet's configuration program (scfg from the command prompt, or
from the GUI, select BBS > Configure). In there, select System, then
Loadable Modules
4. For the 'Read Mail' option, put in DDReadPersonalMail
5. For the 'Scan Msgs' option, put in DDScanMsgs
6. For the 'Scan Subs' option, put in DDScanSubs
The easiest way to get Digital Distortion Message Reader set up is via the
Loadable Module options in SCFG > System > LOadable Modules.
The Loadable Modules options let you specify scripts to run for various events
in Synchronet. As of Synchronet 3.19, the following Loadable Modules options
are available in SCFG for message reading/scanning events:
- Read Mail (added in Synchronet 3.16)
- Scan Msgs (added in Synchronet 3.16)
- Scan Subs (added in Synchronet 3.16)
- List Msgs (added in Synchronet 3.18)
The Loadable Modules options take the filename of the script without the
extension. The Loadable Modules options don't allow a leading path in front of
the name, so if you have DDMsgReader.js in a path other than sbbs/exec or
sbbs/mods, one solution is to copy the included ddmr_lm.js to either your
sbbs/exec or sbbs/mods directory (ideally sbbs/mods so it wouldn't get
accidentally deleted) and specify ddmr_lm in your Loadable Modules as follows:
Read Mail ddmr_lm
Scan Msgs ddmr_lm
Scan Subs ddmr_lm
List Msgs ddmr_lm
Also, if you will be running the script from a directory other than
xtrn/DDMsgReader, edit ddmr_lm.js and look for the text "SYSOPS:" (without the
double-quotes). One or two lines below that, there is a variable called
msgReaderPath - Change that so that it contains the path where you copied
DDMsgReader.js.
Alternately, you can copy DDMsgReader.js to your sbbs/exec or sbbs/mods
directory and specify DDMsgReader in your Loadable Modules for the above
modules in SCFG. For that to work, you would also need to copy DDMsgReader.cfg
to your sbbs/ctrl directory or to sbbs/mods along with DDMsgReader.js.
There are a few search modes that Synchronet provides that Digital Distortion
Message Reader doesn't support yet (such as continuous newscan and browse new
......
......@@ -5,6 +5,10 @@ Revision History (change log)
=============================
Version Date Description
------- ---- -----------
1.47 2022-03-14 DDMsgReader can now be called directly as a loadable
module by Synchronet (though requires the included
ddmr_lm.js if DDMsgReader.js is not in sbbs/exec or
sbbs/mods)
1.46 2022-03-07 Fix: When changing to an empty sub-board from within the
reader (either from read mode or list mode), it now
properly says there are no messages and exits, rather than
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment