mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-06 04:37:12 +02:00
* Code cleanup * Fix FTN packet header writing * Add CHRS support to FTN packet I/O * Change to FNV-1a hash of ms since 2016-1-1 ("enigma epoc") + message ID for MSGID serial number and <packet>.pkt BSO export * Only write some FTN kludges for EchoMail (vs NetMail) * If config specifies, call message network modoule(s) .record() method @ persist (WIP)
59 lines
No EOL
1.1 KiB
JavaScript
59 lines
No EOL
1.1 KiB
JavaScript
/* jslint node: true */
|
|
'use strict';
|
|
|
|
// ENiGMA½
|
|
let loadModulesForCategory = require('./module_util.js').loadModulesForCategory;
|
|
|
|
// standard/deps
|
|
let async = require('async');
|
|
|
|
exports.startup = startup
|
|
exports.shutdown = shutdown;
|
|
exports.recordMessage = recordMessage;
|
|
|
|
let msgNetworkModules = [];
|
|
|
|
function startup(cb) {
|
|
async.series(
|
|
[
|
|
function loadModules(callback) {
|
|
loadModulesForCategory('scannerTossers', (err, module) => {
|
|
if(!err) {
|
|
const modInst = new module.getModule();
|
|
|
|
modInst.startup(err => {
|
|
if(!err) {
|
|
msgNetworkModules.push(modInst);
|
|
}
|
|
});
|
|
}
|
|
}, err => {
|
|
callback(err);
|
|
});
|
|
}
|
|
],
|
|
cb
|
|
);
|
|
}
|
|
|
|
function shutdown() {
|
|
msgNetworkModules.forEach(mod => {
|
|
mod.shutdown();
|
|
});
|
|
|
|
msgNetworkModules = [];
|
|
}
|
|
|
|
function recordMessage(message, cb) {
|
|
//
|
|
// Give all message network modules (scanner/tossers)
|
|
// a chance to do something with |message|. Any or all can
|
|
// choose to ignore it.
|
|
//
|
|
async.each(msgNetworkModules, (modInst, next) => {
|
|
modInst.record(message);
|
|
next();
|
|
}, err => {
|
|
cb(err);
|
|
});
|
|
} |