Fix remote from user @ import
This commit is contained in:
parent
00deb3fe72
commit
27fcd40900
|
@ -1113,6 +1113,32 @@ function FTNMessageScanTossModule() {
|
||||||
return alias || lookup;
|
return alias || lookup;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.getAddressesFromNetMailMessage = function(message) {
|
||||||
|
const intlKludge = _.get(message, 'meta.FtnKludge.INTL');
|
||||||
|
|
||||||
|
if(!intlKludge) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
let [ to, from ] = intlKludge.split(' ');
|
||||||
|
if(!to || !from) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const fromPoint = _.get(message, 'meta.FtnKludge.FMPT');
|
||||||
|
const toPoint = _.get(message, 'meta.FtnKludge.TOPT');
|
||||||
|
|
||||||
|
if(fromPoint) {
|
||||||
|
from += `.${fromPoint}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(toPoint) {
|
||||||
|
to += `.${toPoint}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { to : Address.fromString(to), from : Address.fromString(from) };
|
||||||
|
};
|
||||||
|
|
||||||
this.importMailToArea = function(config, header, message, cb) {
|
this.importMailToArea = function(config, header, message, cb) {
|
||||||
async.series(
|
async.series(
|
||||||
[
|
[
|
||||||
|
@ -1175,18 +1201,14 @@ function FTNMessageScanTossModule() {
|
||||||
// Create a meta value for the *remote* from user. In the case here with FTN,
|
// Create a meta value for the *remote* from user. In the case here with FTN,
|
||||||
// their fully qualified FTN from address
|
// their fully qualified FTN from address
|
||||||
//
|
//
|
||||||
const intlKludge = _.get(message, 'meta.FtnKludge.INTL');
|
const { from } = self.getAddressesFromNetMailMessage(message);
|
||||||
if(intlKludge && intlKludge.length > 0) {
|
|
||||||
let fromAddress = intlKludge.split(' ')[0];
|
|
||||||
|
|
||||||
const fromPointKludge = _.get(message, 'meta.FtnKludge.FMPT');
|
if(!from) {
|
||||||
if(fromPointKludge) {
|
return callback(Errors.Invalid('Cannot import FTN NetMail without valid INTL line'));
|
||||||
fromAddress += `.${fromPointKludge}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
message.meta.System[Message.SystemMetaNames.RemoteFromUser] = fromAddress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message.meta.System[Message.SystemMetaNames.RemoteFromUser] = from.toString();
|
||||||
|
|
||||||
const lookupName = self.getLocalUserNameFromAlias(message.toUserName);
|
const lookupName = self.getLocalUserNameFromAlias(message.toUserName);
|
||||||
|
|
||||||
User.getUserIdAndNameByLookup(lookupName, (err, localToUserId, localUserName) => {
|
User.getUserIdAndNameByLookup(lookupName, (err, localToUserId, localUserName) => {
|
||||||
|
|
Loading…
Reference in New Issue