mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-04 14:02:17 +08:00
mailto parse improvements (Closes #427)
This commit is contained in:
parent
47cc73c992
commit
3e01887f85
1 changed files with 19 additions and 15 deletions
|
@ -143,38 +143,42 @@
|
|||
sMailToUrl = sMailToUrl.toString().substr(7);
|
||||
|
||||
var
|
||||
aTo = [],
|
||||
aCc = null,
|
||||
aBcc = null,
|
||||
oParams = {},
|
||||
oToEmailModel = null,
|
||||
oCcEmailModel = null,
|
||||
oBccEmailModel = null,
|
||||
EmailModel = require('Model/Email'),
|
||||
sEmail = sMailToUrl.replace(/\?.+$/, ''),
|
||||
sQueryString = sMailToUrl.replace(/^[^\?]*\?/, ''),
|
||||
EmailModel = require('Model/Email')
|
||||
fParseEmailLine = function (sLine) {
|
||||
return sLine ? _.compact(_.map(window.decodeURIComponent(sLine).split(/[,]/), function (sItem) {
|
||||
var oEmailModel = new EmailModel();
|
||||
oEmailModel.mailsoParse(sItem);
|
||||
return '' !== oEmailModel.email ? oEmailModel : null;
|
||||
})) : null;
|
||||
}
|
||||
;
|
||||
|
||||
oToEmailModel = new EmailModel();
|
||||
oToEmailModel.parse(window.decodeURIComponent(sEmail));
|
||||
aTo = fParseEmailLine(sEmail);
|
||||
|
||||
oParams = Utils.simpleQueryParser(sQueryString);
|
||||
|
||||
if (!Utils.isUnd(oParams.cc))
|
||||
{
|
||||
oCcEmailModel = new EmailModel();
|
||||
oCcEmailModel.parse(window.decodeURIComponent(oParams.cc));
|
||||
aCc = fParseEmailLine(window.decodeURIComponent(oParams.cc));
|
||||
}
|
||||
|
||||
if (!Utils.isUnd(oParams.bcc))
|
||||
{
|
||||
oBccEmailModel = new EmailModel();
|
||||
oBccEmailModel.parse(window.decodeURIComponent(oParams.bcc));
|
||||
aBcc = fParseEmailLine(window.decodeURIComponent(oParams.bcc));
|
||||
}
|
||||
|
||||
require('Knoin/Knoin').showScreenPopup(PopupComposeVoreModel, [Enums.ComposeType.Empty, null,
|
||||
oToEmailModel && oToEmailModel.email ? [oToEmailModel] : null,
|
||||
oCcEmailModel && oCcEmailModel.email ? [oCcEmailModel] : null,
|
||||
oBccEmailModel && oBccEmailModel.email ? [oBccEmailModel] : null,
|
||||
Utils.isUnd(oParams.subject) ? null : Utils.pString(oParams.subject),
|
||||
Utils.isUnd(oParams.body) ? null : Utils.plainToHtml(Utils.pString(oParams.body))
|
||||
aTo, aCc, aBcc,
|
||||
Utils.isUnd(oParams.subject) ? null :
|
||||
Utils.pString(window.decodeURIComponent(oParams.subject)),
|
||||
Utils.isUnd(oParams.body) ? null :
|
||||
Utils.plainToHtml(Utils.pString(window.decodeURIComponent(oParams.body)))
|
||||
]);
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue