Add ability to send directly to a NetMail address

This commit is contained in:
Bryan Ashby 2018-01-13 09:06:50 -07:00
parent 9a00b3eb15
commit 84fd0ff6d2
3 changed files with 17 additions and 4 deletions

View File

@ -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) {

View File

@ -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
}
}
});

View File

@ -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)
;
};
}