* Fix String vs Address when creating (NetMail) packets causing orig address info to not be recorded correctly
This commit is contained in:
parent
b97f96ce18
commit
f967ce1ce6
|
@ -19,15 +19,6 @@ const moment = require('moment');
|
|||
|
||||
exports.Packet = Packet;
|
||||
|
||||
/*
|
||||
:TODO: things
|
||||
* Test SAUCE ignore/extraction
|
||||
* FSP-1010 for netmail (see SBBS)
|
||||
* Syncronet apparently uses odd origin lines
|
||||
* Origin lines starting with "#" instead of "*" ?
|
||||
|
||||
*/
|
||||
|
||||
const FTN_PACKET_HEADER_SIZE = 58; // fixed header size
|
||||
const FTN_PACKET_HEADER_TYPE = 2;
|
||||
const FTN_PACKET_MESSAGE_TYPE = 2;
|
||||
|
@ -647,6 +638,26 @@ function Packet(options) {
|
|||
});
|
||||
};
|
||||
|
||||
this.sanatizeFtnProperties = function(message) {
|
||||
[
|
||||
Message.FtnPropertyNames.FtnOrigNode,
|
||||
Message.FtnPropertyNames.FtnDestNode,
|
||||
Message.FtnPropertyNames.FtnOrigNetwork,
|
||||
Message.FtnPropertyNames.FtnDestNetwork,
|
||||
Message.FtnPropertyNames.FtnAttrFlags,
|
||||
Message.FtnPropertyNames.FtnCost,
|
||||
Message.FtnPropertyNames.FtnOrigZone,
|
||||
Message.FtnPropertyNames.FtnDestZone,
|
||||
Message.FtnPropertyNames.FtnOrigPoint,
|
||||
Message.FtnPropertyNames.FtnDestPoint,
|
||||
Message.FtnPropertyNames.FtnAttribute,
|
||||
].forEach( propName => {
|
||||
if(message.meta.FtnProperty[propName]) {
|
||||
message.meta.FtnProperty[propName] = parseInt(message.meta.FtnProperty[propName]) || 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.getMessageEntryBuffer = function(message, options, cb) {
|
||||
|
||||
function getAppendMeta(k, m, sepChar=':') {
|
||||
|
@ -668,6 +679,9 @@ function Packet(options) {
|
|||
function prepareHeaderAndKludges(callback) {
|
||||
const basicHeader = new Buffer(34);
|
||||
|
||||
// ensure address FtnProperties are numbers
|
||||
self.sanatizeFtnProperties(message);
|
||||
|
||||
basicHeader.writeUInt16LE(FTN_PACKET_MESSAGE_TYPE, 0);
|
||||
basicHeader.writeUInt16LE(message.meta.FtnProperty.ftn_orig_node, 2);
|
||||
basicHeader.writeUInt16LE(message.meta.FtnProperty.ftn_dest_node, 4);
|
||||
|
|
|
@ -308,16 +308,18 @@ function FTNMessageScanTossModule() {
|
|||
//
|
||||
// Set various FTN kludges/etc.
|
||||
//
|
||||
const localAddress = new Address(options.network.localAddress); // ensure we have an Address obj not a string version
|
||||
|
||||
message.meta.FtnProperty = message.meta.FtnProperty || {};
|
||||
message.meta.FtnKludge = message.meta.FtnKludge || {};
|
||||
|
||||
message.meta.FtnProperty.ftn_orig_node = options.network.localAddress.node;
|
||||
message.meta.FtnProperty.ftn_orig_network = options.network.localAddress.net;
|
||||
message.meta.FtnProperty.ftn_orig_node = localAddress.node;
|
||||
message.meta.FtnProperty.ftn_orig_network = localAddress.net;
|
||||
message.meta.FtnProperty.ftn_cost = 0;
|
||||
|
||||
// tear line and origin can both go in EchoMail & NetMail
|
||||
message.meta.FtnProperty.ftn_tear_line = ftnUtil.getTearLine();
|
||||
message.meta.FtnProperty.ftn_origin = ftnUtil.getOrigin(options.network.localAddress);
|
||||
message.meta.FtnProperty.ftn_origin = ftnUtil.getOrigin(localAddress);
|
||||
|
||||
let ftnAttribute = ftnMailPacket.Packet.Attribute.Local; // message from our system
|
||||
|
||||
|
@ -345,10 +347,10 @@ function FTNMessageScanTossModule() {
|
|||
// We need to set INTL, and possibly FMPT and/or TOPT
|
||||
// See http://retro.fidoweb.ru/docs/index=ftsc&doc=FTS-4001&enc=mac
|
||||
//
|
||||
message.meta.FtnKludge.INTL = ftnUtil.getIntl(options.destAddress, options.network.localAddress);
|
||||
message.meta.FtnKludge.INTL = ftnUtil.getIntl(options.destAddress, localAddress);
|
||||
|
||||
if(_.isNumber(options.network.localAddress.point) && options.network.localAddress.point > 0) {
|
||||
message.meta.FtnKludge.FMPT = options.network.localAddress.point;
|
||||
if(_.isNumber(localAddress.point) && localAddress.point > 0) {
|
||||
message.meta.FtnKludge.FMPT = localAddress.point;
|
||||
}
|
||||
|
||||
if(_.get(message, 'meta.FtnProperty.ftn_dest_point', 0) > 0) {
|
||||
|
@ -378,15 +380,14 @@ function FTNMessageScanTossModule() {
|
|||
// with remote address(s) we are exporting to.
|
||||
//
|
||||
const seenByAdditions =
|
||||
[ `${options.network.localAddress.net}/${options.network.localAddress.node}` ].concat(Config.messageNetworks.ftn.areas[message.areaTag].uplinks);
|
||||
[ `${localAddress.net}/${localAddress.node}` ].concat(Config.messageNetworks.ftn.areas[message.areaTag].uplinks);
|
||||
message.meta.FtnProperty.ftn_seen_by =
|
||||
ftnUtil.getUpdatedSeenByEntries(message.meta.FtnProperty.ftn_seen_by, seenByAdditions);
|
||||
|
||||
//
|
||||
// And create/update PATH for ourself
|
||||
//
|
||||
message.meta.FtnKludge.PATH =
|
||||
ftnUtil.getUpdatedPathEntries(message.meta.FtnKludge.PATH, options.network.localAddress);
|
||||
message.meta.FtnKludge.PATH = ftnUtil.getUpdatedPathEntries(message.meta.FtnKludge.PATH, localAddress);
|
||||
}
|
||||
|
||||
message.meta.FtnProperty.ftn_attr_flags = ftnAttribute;
|
||||
|
@ -398,7 +399,7 @@ function FTNMessageScanTossModule() {
|
|||
// export that failed to finish
|
||||
//
|
||||
if(!message.meta.FtnKludge.MSGID) {
|
||||
message.meta.FtnKludge.MSGID = ftnUtil.getMessageIdentifier(message, options.network.localAddress);
|
||||
message.meta.FtnKludge.MSGID = ftnUtil.getMessageIdentifier(message, localAddress);
|
||||
}
|
||||
|
||||
message.meta.FtnKludge.TZUTC = ftnUtil.getUTCTimeZoneOffset();
|
||||
|
|
Loading…
Reference in New Issue