diff --git a/core/fse.js b/core/fse.js index 824704dc..51b8dc5c 100644 --- a/core/fse.js +++ b/core/fse.js @@ -15,6 +15,7 @@ const stringFormat = require('./string_format.js'); const MessageAreaConfTempSwitcher = require('./mod_mixins.js').MessageAreaConfTempSwitcher; const { isAnsi, cleanControlCodes, insert } = require('./string_util.js'); const Config = require('./config.js').config; +const { getAddressedToInfo } = require('./mail_util.js'); // deps const async = require('async'); @@ -432,6 +433,18 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul return callback(null); } + // + // Detect if the user is attempting to send to a remote mail type that we support + // + // :TODO: how to plug in support without tying to various types here? isSupportedExteranlType() or such + const addressedToInfo = getAddressedToInfo(self.message.toUserName); + if(addressedToInfo.name && Message.AddressFlavor.FTN === addressedToInfo.flavor) { + self.message.setRemoteToUser(addressedToInfo.remote); + self.message.setExternalFlavor(addressedToInfo.flavor); + self.message.toUserName = addressedToInfo.name; + return callback(null); + } + // we need to look it up User.getUserIdAndNameByLookup(self.message.toUserName, (err, toUserId) => { if(err) { diff --git a/core/oputil/oputil_message_base.js b/core/oputil/oputil_message_base.js index b1c6673e..6e89cf73 100644 --- a/core/oputil/oputil_message_base.js +++ b/core/oputil/oputil_message_base.js @@ -92,7 +92,7 @@ function areaFix() { meta : { System : { [ Message.SystemMetaNames.RemoteToUser ] : ftnAddr.toString(), // where to send it - [ Message.SystemMetaNames.ExternalFlavor ] : Message.ExternalFlavors.FTN, // on FTN-style network + [ Message.SystemMetaNames.ExternalFlavor ] : Message.AddressFlavor.FTN, // on FTN-style network } } }); diff --git a/core/scanner_tossers/ftn_bso.js b/core/scanner_tossers/ftn_bso.js index 8b86e850..4285884e 100644 --- a/core/scanner_tossers/ftn_bso.js +++ b/core/scanner_tossers/ftn_bso.js @@ -1170,7 +1170,7 @@ function FTNMessageScanTossModule() { message.areaTag = config.localAreaTag; // indicate this was imported from FTN - message.meta.System[Message.SystemMetaNames.ExternalFlavor] = Message.ExternalFlavors.FTN; + message.meta.System[Message.SystemMetaNames.ExternalFlavor] = Message.AddressFlavor.FTN; // // If we *allow* dupes (disabled by default), then just generate @@ -1968,7 +1968,7 @@ function FTNMessageScanTossModule() { WHERE message_id = m.message_id AND meta_category = 'System' AND meta_name = '${Message.SystemMetaNames.ExternalFlavor}' - AND meta_value = '${Message.ExternalFlavors.FTN}' + AND meta_value = '${Message.AddressFlavor.FTN}' ) = 1 ORDER BY message_id; `; @@ -2005,7 +2005,7 @@ function FTNMessageScanTossModule() { this.isNetMailMessage = function(message) { return message.isPrivate() && null === _.get(message, 'meta.System.LocalToUserID', null) && - Message.ExternalFlavors.FTN === _.get(message, 'meta.System.external_flavor', null) + Message.AddressFlavor.FTN === _.get(message, 'meta.System.external_flavor', null) ; }; }