Check "Delivered-To" for identities (Closes #160)

This commit is contained in:
RainLoop Team 2014-05-24 02:37:10 +04:00
parent fed896776f
commit 2f074433a2
7 changed files with 105 additions and 80 deletions

View file

@ -25,6 +25,7 @@ function MessageModel()
this.cc = []; this.cc = [];
this.bcc = []; this.bcc = [];
this.replyTo = []; this.replyTo = [];
this.deliveredTo = [];
this.newForAnimation = ko.observable(false); this.newForAnimation = ko.observable(false);
@ -66,7 +67,7 @@ function MessageModel()
} }
return sClass; return sClass;
}, this); }, this);
this.fullFormatDateValue = ko.computed(function () { this.fullFormatDateValue = ko.computed(function () {
return MessageModel.calculateFullFromatDateValue(this.dateTimeStampInUTC()); return MessageModel.calculateFullFromatDateValue(this.dateTimeStampInUTC());
}, this); }, this);
@ -102,7 +103,7 @@ function MessageModel()
this.sMessageId = ''; this.sMessageId = '';
this.sInReplyTo = ''; this.sInReplyTo = '';
this.sReferences = ''; this.sReferences = '';
this.parentUid = ko.observable(0); this.parentUid = ko.observable(0);
this.threads = ko.observableArray([]); this.threads = ko.observableArray([]);
this.threadsLen = ko.observable(0); this.threadsLen = ko.observable(0);
@ -111,7 +112,7 @@ function MessageModel()
this.lastInCollapsedThread = ko.observable(false); this.lastInCollapsedThread = ko.observable(false);
this.lastInCollapsedThreadLoading = ko.observable(false); this.lastInCollapsedThreadLoading = ko.observable(false);
this.threadsLenResult = ko.computed(function () { this.threadsLenResult = ko.computed(function () {
var iCount = this.threadsLen(); var iCount = this.threadsLen();
return 0 === this.parentUid() && 0 < iCount ? iCount + 1 : ''; return 0 === this.parentUid() && 0 < iCount ? iCount + 1 : '';
@ -242,6 +243,7 @@ MessageModel.prototype.clear = function ()
this.cc = []; this.cc = [];
this.bcc = []; this.bcc = [];
this.replyTo = []; this.replyTo = [];
this.deliveredTo = [];
this.newForAnimation(false); this.newForAnimation(false);
@ -262,7 +264,7 @@ MessageModel.prototype.clear = function ()
this.isHtml(false); this.isHtml(false);
this.hasImages(false); this.hasImages(false);
this.attachments([]); this.attachments([]);
this.isPgpSigned(false); this.isPgpSigned(false);
this.isPgpEncrypted(false); this.isPgpEncrypted(false);
this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.None); this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.None);
@ -309,7 +311,7 @@ MessageModel.prototype.initByJson = function (oJsonMessage)
this.uid = oJsonMessage.Uid; this.uid = oJsonMessage.Uid;
this.hash = oJsonMessage.Hash; this.hash = oJsonMessage.Hash;
this.requestHash = oJsonMessage.RequestHash; this.requestHash = oJsonMessage.RequestHash;
this.size(Utils.pInt(oJsonMessage.Size)); this.size(Utils.pInt(oJsonMessage.Size));
this.from = MessageModel.initEmailsFromJson(oJsonMessage.From); this.from = MessageModel.initEmailsFromJson(oJsonMessage.From);
@ -317,6 +319,7 @@ MessageModel.prototype.initByJson = function (oJsonMessage)
this.cc = MessageModel.initEmailsFromJson(oJsonMessage.Cc); this.cc = MessageModel.initEmailsFromJson(oJsonMessage.Cc);
this.bcc = MessageModel.initEmailsFromJson(oJsonMessage.Bcc); this.bcc = MessageModel.initEmailsFromJson(oJsonMessage.Bcc);
this.replyTo = MessageModel.initEmailsFromJson(oJsonMessage.ReplyTo); this.replyTo = MessageModel.initEmailsFromJson(oJsonMessage.ReplyTo);
this.deliveredTo = MessageModel.initEmailsFromJson(oJsonMessage.DeliveredTo);
this.subject(oJsonMessage.Subject); this.subject(oJsonMessage.Subject);
this.dateTimeStampInUTC(Utils.pInt(oJsonMessage.DateTimeStampInUTC)); this.dateTimeStampInUTC(Utils.pInt(oJsonMessage.DateTimeStampInUTC));
@ -332,7 +335,7 @@ MessageModel.prototype.initByJson = function (oJsonMessage)
this.initFlagsByJson(oJsonMessage); this.initFlagsByJson(oJsonMessage);
this.computeSenderEmail(); this.computeSenderEmail();
bResult = true; bResult = true;
} }
@ -814,6 +817,7 @@ MessageModel.prototype.populateByMessageListItem = function (oMessage)
this.cc = oMessage.cc; this.cc = oMessage.cc;
this.bcc = oMessage.bcc; this.bcc = oMessage.bcc;
this.replyTo = oMessage.replyTo; this.replyTo = oMessage.replyTo;
this.deliveredTo = oMessage.deliveredTo;
this.unseen(oMessage.unseen()); this.unseen(oMessage.unseen());
this.flagged(oMessage.flagged()); this.flagged(oMessage.flagged());
@ -907,7 +911,7 @@ MessageModel.prototype.showInternalImages = function (bLazy)
bLazy = Utils.isUnd(bLazy) ? false : bLazy; bLazy = Utils.isUnd(bLazy) ? false : bLazy;
var self = this; var self = this;
$('[data-x-src-cid]', this.body).each(function () { $('[data-x-src-cid]', this.body).each(function () {
var oAttachment = self.findAttachmentByCid($(this).attr('data-x-src-cid')); var oAttachment = self.findAttachmentByCid($(this).attr('data-x-src-cid'));
@ -925,7 +929,7 @@ MessageModel.prototype.showInternalImages = function (bLazy)
} }
} }
}); });
$('[data-x-src-location]', this.body).each(function () { $('[data-x-src-location]', this.body).each(function () {
var oAttachment = self.findAttachmentByContentLocation($(this).attr('data-x-src-location')); var oAttachment = self.findAttachmentByContentLocation($(this).attr('data-x-src-location'));
@ -933,7 +937,7 @@ MessageModel.prototype.showInternalImages = function (bLazy)
{ {
oAttachment = self.findAttachmentByCid($(this).attr('data-x-src-location')); oAttachment = self.findAttachmentByCid($(this).attr('data-x-src-location'));
} }
if (oAttachment && oAttachment.download) if (oAttachment && oAttachment.download)
{ {
if (bLazy && $(this).is('img')) if (bLazy && $(this).is('img'))
@ -1023,7 +1027,7 @@ MessageModel.prototype.fetchDataToDom = function ()
this.isRtl(!!this.body.data('rl-is-rtl')); this.isRtl(!!this.body.data('rl-is-rtl'));
this.isHtml(!!this.body.data('rl-is-html')); this.isHtml(!!this.body.data('rl-is-html'));
this.hasImages(!!this.body.data('rl-has-images')); this.hasImages(!!this.body.data('rl-has-images'));
this.plainRaw = Utils.pString(this.body.data('rl-plain-raw')); this.plainRaw = Utils.pString(this.body.data('rl-plain-raw'));
if (RL.data().capaOpenPGP()) if (RL.data().capaOpenPGP())
@ -1081,7 +1085,7 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function ()
if (oValidSysKey) if (oValidSysKey)
{ {
sPlain = mPgpMessage.getText(); sPlain = mPgpMessage.getText();
this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success); this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);
this.pgpSignedVerifyUser(oValidSysKey.user); this.pgpSignedVerifyUser(oValidSysKey.user);

View file

@ -93,12 +93,12 @@ function PopupsComposeViewModel()
this.identities = RL.data().identities; this.identities = RL.data().identities;
this.currentIdentityID = ko.observable(''); this.currentIdentityID = ko.observable('');
this.currentIdentityString = ko.observable(''); this.currentIdentityString = ko.observable('');
this.currentIdentityResultEmail = ko.observable(''); this.currentIdentityResultEmail = ko.observable('');
this.identitiesOptions = ko.computed(function () { this.identitiesOptions = ko.computed(function () {
var aList = [{ var aList = [{
'optValue': oRainLoopData.accountEmail(), 'optValue': oRainLoopData.accountEmail(),
'optText': this.formattedFrom(false) 'optText': this.formattedFrom(false)
@ -112,11 +112,11 @@ function PopupsComposeViewModel()
}); });
return aList; return aList;
}, this); }, this);
ko.computed(function () { ko.computed(function () {
var var
sResult = '', sResult = '',
sResultEmail = '', sResultEmail = '',
@ -149,7 +149,7 @@ function PopupsComposeViewModel()
this.currentIdentityString(sResult); this.currentIdentityString(sResult);
this.currentIdentityResultEmail(sResultEmail); this.currentIdentityResultEmail(sResultEmail);
return sResult; return sResult;
}, this); }, this);
@ -166,7 +166,7 @@ function PopupsComposeViewModel()
this.resizer.subscribe(function () { this.resizer.subscribe(function () {
this.editorResizeThrottle(); this.editorResizeThrottle();
}, this); }, this);
this.canBeSended = ko.computed(function () { this.canBeSended = ko.computed(function () {
return !this.sending() && return !this.sending() &&
!this.saving() && !this.saving() &&
@ -180,10 +180,10 @@ function PopupsComposeViewModel()
}, this); }, this);
this.deleteCommand = Utils.createCommand(this, function () { this.deleteCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]); RL.deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]);
kn.hideScreenPopup(PopupsComposeViewModel); kn.hideScreenPopup(PopupsComposeViewModel);
}, function () { }, function () {
return this.isDraftFolderMessage(); return this.isDraftFolderMessage();
}); });
@ -336,13 +336,13 @@ function PopupsComposeViewModel()
'multiselect': false 'multiselect': false
}); });
} }
return true; return true;
}, function () { }, function () {
return this.dropboxEnabled(); return this.dropboxEnabled();
}); });
this.driveEnabled = ko.observable(false); this.driveEnabled = ko.observable(false);
this.driveCommand = Utils.createCommand(this, function () { this.driveCommand = Utils.createCommand(this, function () {
@ -358,7 +358,7 @@ function PopupsComposeViewModel()
this.bDisabeCloseOnEsc = true; this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.Compose; this.sDefaultKeyScope = Enums.KeyState.Compose;
Knoin.constructorEnd(this); Knoin.constructorEnd(this);
} }
@ -423,7 +423,7 @@ PopupsComposeViewModel.prototype.findIdentityIdByMessage = function (sComposeTyp
oIDs[oItem.email()] = oItem['id']; oIDs[oItem.email()] = oItem['id'];
}); });
} }
oIDs[RL.data().accountEmail()] = RL.data().accountEmail(); oIDs[RL.data().accountEmail()] = RL.data().accountEmail();
if (oMessage) if (oMessage)
@ -437,7 +437,7 @@ PopupsComposeViewModel.prototype.findIdentityIdByMessage = function (sComposeTyp
case Enums.ComposeType.ReplyAll: case Enums.ComposeType.ReplyAll:
case Enums.ComposeType.Forward: case Enums.ComposeType.Forward:
case Enums.ComposeType.ForwardAsAttachment: case Enums.ComposeType.ForwardAsAttachment:
_.find(_.union(oMessage.to, oMessage.cc, oMessage.bcc), fFindHelper); _.find(_.union(oMessage.to, oMessage.cc, oMessage.bcc, oMessage.deliveredTo), fFindHelper);
break; break;
case Enums.ComposeType.Draft: case Enums.ComposeType.Draft:
_.find(_.union(oMessage.from, oMessage.replyTo), fFindHelper); _.find(_.union(oMessage.from, oMessage.replyTo), fFindHelper);
@ -481,7 +481,7 @@ PopupsComposeViewModel.prototype.formattedFrom = function (bHeaderResult)
PopupsComposeViewModel.prototype.sendMessageResponse = function (sResult, oData) PopupsComposeViewModel.prototype.sendMessageResponse = function (sResult, oData)
{ {
var var
bResult = false, bResult = false,
sMessage = '' sMessage = ''
; ;
@ -496,7 +496,7 @@ PopupsComposeViewModel.prototype.sendMessageResponse = function (sResult, oData)
Utils.delegateRun(this, 'closeCommand'); Utils.delegateRun(this, 'closeCommand');
} }
} }
if (this.modalVisibility() && !bResult) if (this.modalVisibility() && !bResult)
{ {
if (oData && Enums.Notification.CantSaveMessage === oData.ErrorCode) if (oData && Enums.Notification.CantSaveMessage === oData.ErrorCode)
@ -645,7 +645,7 @@ PopupsComposeViewModel.prototype.editor = function (fOnInit)
PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToEmails) PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToEmails)
{ {
kn.routeOff(); kn.routeOff();
var var
self = this, self = this,
sFrom = '', sFrom = '',
@ -716,7 +716,7 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
{ {
case Enums.ComposeType.Empty: case Enums.ComposeType.Empty:
break; break;
case Enums.ComposeType.Reply: case Enums.ComposeType.Reply:
this.to(fEmailArrayToStringLineHelper(oMessage.replyEmails(oExcludeEmail))); this.to(fEmailArrayToStringLineHelper(oMessage.replyEmails(oExcludeEmail)));
this.subject(Utils.replySubjectAdd('Re', sSubject)); this.subject(Utils.replySubjectAdd('Re', sSubject));
@ -897,7 +897,7 @@ PopupsComposeViewModel.prototype.onFocus = function ()
{ {
this.oEditor.focus(); this.oEditor.focus();
} }
this.triggerForResize(); this.triggerForResize();
}; };
@ -924,7 +924,7 @@ PopupsComposeViewModel.prototype.onBuild = function ()
{ {
this.initUploader(); this.initUploader();
var var
self = this, self = this,
oScript = null oScript = null
; ;
@ -943,7 +943,7 @@ PopupsComposeViewModel.prototype.onBuild = function ()
self.sendCommand(); self.sendCommand();
return false; return false;
}); });
key('esc', Enums.KeyState.Compose, function () { key('esc', Enums.KeyState.Compose, function () {
self.tryToClosePopup(); self.tryToClosePopup();
return false; return false;
@ -959,7 +959,7 @@ PopupsComposeViewModel.prototype.onBuild = function ()
oScript.type = 'text/javascript'; oScript.type = 'text/javascript';
oScript.src = 'https://www.dropbox.com/static/api/1/dropins.js'; oScript.src = 'https://www.dropbox.com/static/api/1/dropins.js';
$(oScript).attr('id', 'dropboxjs').attr('data-app-key', RL.settingsGet('DropboxApiKey')); $(oScript).attr('id', 'dropboxjs').attr('data-app-key', RL.settingsGet('DropboxApiKey'));
document.body.appendChild(oScript); document.body.appendChild(oScript);
} }
@ -1302,7 +1302,7 @@ PopupsComposeViewModel.prototype.addDropboxAttachment = function (oDropboxFile)
var bResult = false; var bResult = false;
oAttachment.uploading(false); oAttachment.uploading(false);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result) if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{ {
if (oData.Result[oAttachment.id]) if (oData.Result[oAttachment.id])

View file

@ -78,6 +78,11 @@ class Message
*/ */
private $oReplyTo; private $oReplyTo;
/**
* @var \MailSo\Mime\EmailCollection
*/
private $oDeliveredTo;
/** /**
* @var \MailSo\Mime\EmailCollection * @var \MailSo\Mime\EmailCollection
*/ */
@ -201,6 +206,7 @@ class Message
$this->oFrom = null; $this->oFrom = null;
$this->oSender = null; $this->oSender = null;
$this->oReplyTo = null; $this->oReplyTo = null;
$this->oDeliveredTo = null;
$this->oTo = null; $this->oTo = null;
$this->oCc = null; $this->oCc = null;
$this->oBcc = null; $this->oBcc = null;
@ -416,6 +422,14 @@ class Message
return $this->oReplyTo; return $this->oReplyTo;
} }
/**
* @return \MailSo\Mime\EmailCollection
*/
public function DeliveredTo()
{
return $this->oDeliveredTo;
}
/** /**
* @return \MailSo\Mime\EmailCollection * @return \MailSo\Mime\EmailCollection
*/ */
@ -503,7 +517,7 @@ class Message
{ {
return $this->aThreads; return $this->aThreads;
} }
/** /**
* @param array $aThreads * @param array $aThreads
*/ */
@ -535,7 +549,7 @@ class Message
{ {
return $this->iParentThread; return $this->iParentThread;
} }
/** /**
* @param int $iParentThread * @param int $iParentThread
*/ */
@ -621,6 +635,7 @@ class Message
$this->oSender = $oHeaders->GetAsEmailCollection(\MailSo\Mime\Enumerations\Header::SENDER, $bCharsetAutoDetect); $this->oSender = $oHeaders->GetAsEmailCollection(\MailSo\Mime\Enumerations\Header::SENDER, $bCharsetAutoDetect);
$this->oReplyTo = $oHeaders->GetAsEmailCollection(\MailSo\Mime\Enumerations\Header::REPLY_TO, $bCharsetAutoDetect); $this->oReplyTo = $oHeaders->GetAsEmailCollection(\MailSo\Mime\Enumerations\Header::REPLY_TO, $bCharsetAutoDetect);
$this->oDeliveredTo = $oHeaders->GetAsEmailCollection(\MailSo\Mime\Enumerations\Header::DELIVERED_TO, $bCharsetAutoDetect);
$this->sInReplyTo = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::IN_REPLY_TO); $this->sInReplyTo = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::IN_REPLY_TO);
$this->sReferences = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::REFERENCES); $this->sReferences = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::REFERENCES);
@ -687,7 +702,7 @@ class Message
{ {
$this->sReadReceipt = \trim($oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_CONFIRM_READING_TO)); $this->sReadReceipt = \trim($oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_CONFIRM_READING_TO));
} }
$sDraftInfo = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_DRAFT_INFO); $sDraftInfo = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_DRAFT_INFO);
if (0 < \strlen($sDraftInfo)) if (0 < \strlen($sDraftInfo))
{ {
@ -766,7 +781,7 @@ class Message
{ {
$sTextCharset = $sCharset; $sTextCharset = $sCharset;
} }
$sTextCharset = \MailSo\Base\Utils::NormalizeCharset($sTextCharset, true); $sTextCharset = \MailSo\Base\Utils::NormalizeCharset($sTextCharset, true);
$sText = \MailSo\Base\Utils::DecodeEncodingValue($sText, $oPart->MailEncodingName()); $sText = \MailSo\Base\Utils::DecodeEncodingValue($sText, $oPart->MailEncodingName());

View file

@ -21,6 +21,7 @@ class Header
const REPLY_TO = 'Reply-To'; const REPLY_TO = 'Reply-To';
const SENDER = 'Sender'; const SENDER = 'Sender';
const RETURN_PATH = 'Return-Path'; const RETURN_PATH = 'Return-Path';
const DELIVERED_TO = 'Delivered-To';
const MESSAGE_ID = 'Message-ID'; const MESSAGE_ID = 'Message-ID';
const IN_REPLY_TO = 'In-Reply-To'; const IN_REPLY_TO = 'In-Reply-To';
@ -43,7 +44,7 @@ class Header
const MIME_VERSION = 'Mime-Version'; const MIME_VERSION = 'Mime-Version';
const X_MAILER = 'X-Mailer'; const X_MAILER = 'X-Mailer';
const X_MSMAIL_PRIORITY = 'X-MSMail-Priority'; const X_MSMAIL_PRIORITY = 'X-MSMail-Priority';
const IMPORTANCE = 'Importance'; const IMPORTANCE = 'Importance';
const X_PRIORITY = 'X-Priority'; const X_PRIORITY = 'X-Priority';

View file

@ -6081,7 +6081,7 @@ class Actions
$aResult = array( $aResult = array(
\RainLoop\Enumerations\Capa::PREM, \RainLoop\Enumerations\Capa::PREM,
\RainLoop\Enumerations\Capa::FILTERS // \RainLoop\Enumerations\Capa::FILTERS
); );
if ($oConfig->Get('webmail', 'allow_additional_accounts', false)) if ($oConfig->Get('webmail', 'allow_additional_accounts', false))
@ -6989,6 +6989,7 @@ class Actions
'Cc' => $this->responseObject($mResponse->Cc(), $sParent, $aParameters), 'Cc' => $this->responseObject($mResponse->Cc(), $sParent, $aParameters),
'Bcc' => $this->responseObject($mResponse->Bcc(), $sParent, $aParameters), 'Bcc' => $this->responseObject($mResponse->Bcc(), $sParent, $aParameters),
'Sender' => $this->responseObject($mResponse->Sender(), $sParent, $aParameters), 'Sender' => $this->responseObject($mResponse->Sender(), $sParent, $aParameters),
'DeliveredTo' => $this->responseObject($mResponse->DeliveredTo(), $sParent, $aParameters),
'Priority' => $mResponse->Priority(), 'Priority' => $mResponse->Priority(),
'Threads' => $mResponse->Threads(), 'Threads' => $mResponse->Threads(),
'ThreadsLen' => $mResponse->ThreadsLen(), 'ThreadsLen' => $mResponse->ThreadsLen(),

View file

@ -6502,6 +6502,7 @@ function MessageModel()
this.cc = []; this.cc = [];
this.bcc = []; this.bcc = [];
this.replyTo = []; this.replyTo = [];
this.deliveredTo = [];
this.newForAnimation = ko.observable(false); this.newForAnimation = ko.observable(false);
@ -6543,7 +6544,7 @@ function MessageModel()
} }
return sClass; return sClass;
}, this); }, this);
this.fullFormatDateValue = ko.computed(function () { this.fullFormatDateValue = ko.computed(function () {
return MessageModel.calculateFullFromatDateValue(this.dateTimeStampInUTC()); return MessageModel.calculateFullFromatDateValue(this.dateTimeStampInUTC());
}, this); }, this);
@ -6579,7 +6580,7 @@ function MessageModel()
this.sMessageId = ''; this.sMessageId = '';
this.sInReplyTo = ''; this.sInReplyTo = '';
this.sReferences = ''; this.sReferences = '';
this.parentUid = ko.observable(0); this.parentUid = ko.observable(0);
this.threads = ko.observableArray([]); this.threads = ko.observableArray([]);
this.threadsLen = ko.observable(0); this.threadsLen = ko.observable(0);
@ -6588,7 +6589,7 @@ function MessageModel()
this.lastInCollapsedThread = ko.observable(false); this.lastInCollapsedThread = ko.observable(false);
this.lastInCollapsedThreadLoading = ko.observable(false); this.lastInCollapsedThreadLoading = ko.observable(false);
this.threadsLenResult = ko.computed(function () { this.threadsLenResult = ko.computed(function () {
var iCount = this.threadsLen(); var iCount = this.threadsLen();
return 0 === this.parentUid() && 0 < iCount ? iCount + 1 : ''; return 0 === this.parentUid() && 0 < iCount ? iCount + 1 : '';
@ -6719,6 +6720,7 @@ MessageModel.prototype.clear = function ()
this.cc = []; this.cc = [];
this.bcc = []; this.bcc = [];
this.replyTo = []; this.replyTo = [];
this.deliveredTo = [];
this.newForAnimation(false); this.newForAnimation(false);
@ -6739,7 +6741,7 @@ MessageModel.prototype.clear = function ()
this.isHtml(false); this.isHtml(false);
this.hasImages(false); this.hasImages(false);
this.attachments([]); this.attachments([]);
this.isPgpSigned(false); this.isPgpSigned(false);
this.isPgpEncrypted(false); this.isPgpEncrypted(false);
this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.None); this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.None);
@ -6786,7 +6788,7 @@ MessageModel.prototype.initByJson = function (oJsonMessage)
this.uid = oJsonMessage.Uid; this.uid = oJsonMessage.Uid;
this.hash = oJsonMessage.Hash; this.hash = oJsonMessage.Hash;
this.requestHash = oJsonMessage.RequestHash; this.requestHash = oJsonMessage.RequestHash;
this.size(Utils.pInt(oJsonMessage.Size)); this.size(Utils.pInt(oJsonMessage.Size));
this.from = MessageModel.initEmailsFromJson(oJsonMessage.From); this.from = MessageModel.initEmailsFromJson(oJsonMessage.From);
@ -6794,6 +6796,7 @@ MessageModel.prototype.initByJson = function (oJsonMessage)
this.cc = MessageModel.initEmailsFromJson(oJsonMessage.Cc); this.cc = MessageModel.initEmailsFromJson(oJsonMessage.Cc);
this.bcc = MessageModel.initEmailsFromJson(oJsonMessage.Bcc); this.bcc = MessageModel.initEmailsFromJson(oJsonMessage.Bcc);
this.replyTo = MessageModel.initEmailsFromJson(oJsonMessage.ReplyTo); this.replyTo = MessageModel.initEmailsFromJson(oJsonMessage.ReplyTo);
this.deliveredTo = MessageModel.initEmailsFromJson(oJsonMessage.DeliveredTo);
this.subject(oJsonMessage.Subject); this.subject(oJsonMessage.Subject);
this.dateTimeStampInUTC(Utils.pInt(oJsonMessage.DateTimeStampInUTC)); this.dateTimeStampInUTC(Utils.pInt(oJsonMessage.DateTimeStampInUTC));
@ -6809,7 +6812,7 @@ MessageModel.prototype.initByJson = function (oJsonMessage)
this.initFlagsByJson(oJsonMessage); this.initFlagsByJson(oJsonMessage);
this.computeSenderEmail(); this.computeSenderEmail();
bResult = true; bResult = true;
} }
@ -7291,6 +7294,7 @@ MessageModel.prototype.populateByMessageListItem = function (oMessage)
this.cc = oMessage.cc; this.cc = oMessage.cc;
this.bcc = oMessage.bcc; this.bcc = oMessage.bcc;
this.replyTo = oMessage.replyTo; this.replyTo = oMessage.replyTo;
this.deliveredTo = oMessage.deliveredTo;
this.unseen(oMessage.unseen()); this.unseen(oMessage.unseen());
this.flagged(oMessage.flagged()); this.flagged(oMessage.flagged());
@ -7384,7 +7388,7 @@ MessageModel.prototype.showInternalImages = function (bLazy)
bLazy = Utils.isUnd(bLazy) ? false : bLazy; bLazy = Utils.isUnd(bLazy) ? false : bLazy;
var self = this; var self = this;
$('[data-x-src-cid]', this.body).each(function () { $('[data-x-src-cid]', this.body).each(function () {
var oAttachment = self.findAttachmentByCid($(this).attr('data-x-src-cid')); var oAttachment = self.findAttachmentByCid($(this).attr('data-x-src-cid'));
@ -7402,7 +7406,7 @@ MessageModel.prototype.showInternalImages = function (bLazy)
} }
} }
}); });
$('[data-x-src-location]', this.body).each(function () { $('[data-x-src-location]', this.body).each(function () {
var oAttachment = self.findAttachmentByContentLocation($(this).attr('data-x-src-location')); var oAttachment = self.findAttachmentByContentLocation($(this).attr('data-x-src-location'));
@ -7410,7 +7414,7 @@ MessageModel.prototype.showInternalImages = function (bLazy)
{ {
oAttachment = self.findAttachmentByCid($(this).attr('data-x-src-location')); oAttachment = self.findAttachmentByCid($(this).attr('data-x-src-location'));
} }
if (oAttachment && oAttachment.download) if (oAttachment && oAttachment.download)
{ {
if (bLazy && $(this).is('img')) if (bLazy && $(this).is('img'))
@ -7500,7 +7504,7 @@ MessageModel.prototype.fetchDataToDom = function ()
this.isRtl(!!this.body.data('rl-is-rtl')); this.isRtl(!!this.body.data('rl-is-rtl'));
this.isHtml(!!this.body.data('rl-is-html')); this.isHtml(!!this.body.data('rl-is-html'));
this.hasImages(!!this.body.data('rl-has-images')); this.hasImages(!!this.body.data('rl-has-images'));
this.plainRaw = Utils.pString(this.body.data('rl-plain-raw')); this.plainRaw = Utils.pString(this.body.data('rl-plain-raw'));
if (RL.data().capaOpenPGP()) if (RL.data().capaOpenPGP())
@ -7558,7 +7562,7 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function ()
if (oValidSysKey) if (oValidSysKey)
{ {
sPlain = mPgpMessage.getText(); sPlain = mPgpMessage.getText();
this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success); this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);
this.pgpSignedVerifyUser(oValidSysKey.user); this.pgpSignedVerifyUser(oValidSysKey.user);
@ -8545,12 +8549,12 @@ function PopupsComposeViewModel()
this.identities = RL.data().identities; this.identities = RL.data().identities;
this.currentIdentityID = ko.observable(''); this.currentIdentityID = ko.observable('');
this.currentIdentityString = ko.observable(''); this.currentIdentityString = ko.observable('');
this.currentIdentityResultEmail = ko.observable(''); this.currentIdentityResultEmail = ko.observable('');
this.identitiesOptions = ko.computed(function () { this.identitiesOptions = ko.computed(function () {
var aList = [{ var aList = [{
'optValue': oRainLoopData.accountEmail(), 'optValue': oRainLoopData.accountEmail(),
'optText': this.formattedFrom(false) 'optText': this.formattedFrom(false)
@ -8564,11 +8568,11 @@ function PopupsComposeViewModel()
}); });
return aList; return aList;
}, this); }, this);
ko.computed(function () { ko.computed(function () {
var var
sResult = '', sResult = '',
sResultEmail = '', sResultEmail = '',
@ -8601,7 +8605,7 @@ function PopupsComposeViewModel()
this.currentIdentityString(sResult); this.currentIdentityString(sResult);
this.currentIdentityResultEmail(sResultEmail); this.currentIdentityResultEmail(sResultEmail);
return sResult; return sResult;
}, this); }, this);
@ -8618,7 +8622,7 @@ function PopupsComposeViewModel()
this.resizer.subscribe(function () { this.resizer.subscribe(function () {
this.editorResizeThrottle(); this.editorResizeThrottle();
}, this); }, this);
this.canBeSended = ko.computed(function () { this.canBeSended = ko.computed(function () {
return !this.sending() && return !this.sending() &&
!this.saving() && !this.saving() &&
@ -8632,10 +8636,10 @@ function PopupsComposeViewModel()
}, this); }, this);
this.deleteCommand = Utils.createCommand(this, function () { this.deleteCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]); RL.deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]);
kn.hideScreenPopup(PopupsComposeViewModel); kn.hideScreenPopup(PopupsComposeViewModel);
}, function () { }, function () {
return this.isDraftFolderMessage(); return this.isDraftFolderMessage();
}); });
@ -8788,13 +8792,13 @@ function PopupsComposeViewModel()
'multiselect': false 'multiselect': false
}); });
} }
return true; return true;
}, function () { }, function () {
return this.dropboxEnabled(); return this.dropboxEnabled();
}); });
this.driveEnabled = ko.observable(false); this.driveEnabled = ko.observable(false);
this.driveCommand = Utils.createCommand(this, function () { this.driveCommand = Utils.createCommand(this, function () {
@ -8810,7 +8814,7 @@ function PopupsComposeViewModel()
this.bDisabeCloseOnEsc = true; this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.Compose; this.sDefaultKeyScope = Enums.KeyState.Compose;
Knoin.constructorEnd(this); Knoin.constructorEnd(this);
} }
@ -8875,7 +8879,7 @@ PopupsComposeViewModel.prototype.findIdentityIdByMessage = function (sComposeTyp
oIDs[oItem.email()] = oItem['id']; oIDs[oItem.email()] = oItem['id'];
}); });
} }
oIDs[RL.data().accountEmail()] = RL.data().accountEmail(); oIDs[RL.data().accountEmail()] = RL.data().accountEmail();
if (oMessage) if (oMessage)
@ -8889,7 +8893,7 @@ PopupsComposeViewModel.prototype.findIdentityIdByMessage = function (sComposeTyp
case Enums.ComposeType.ReplyAll: case Enums.ComposeType.ReplyAll:
case Enums.ComposeType.Forward: case Enums.ComposeType.Forward:
case Enums.ComposeType.ForwardAsAttachment: case Enums.ComposeType.ForwardAsAttachment:
_.find(_.union(oMessage.to, oMessage.cc, oMessage.bcc), fFindHelper); _.find(_.union(oMessage.to, oMessage.cc, oMessage.bcc, oMessage.deliveredTo), fFindHelper);
break; break;
case Enums.ComposeType.Draft: case Enums.ComposeType.Draft:
_.find(_.union(oMessage.from, oMessage.replyTo), fFindHelper); _.find(_.union(oMessage.from, oMessage.replyTo), fFindHelper);
@ -8933,7 +8937,7 @@ PopupsComposeViewModel.prototype.formattedFrom = function (bHeaderResult)
PopupsComposeViewModel.prototype.sendMessageResponse = function (sResult, oData) PopupsComposeViewModel.prototype.sendMessageResponse = function (sResult, oData)
{ {
var var
bResult = false, bResult = false,
sMessage = '' sMessage = ''
; ;
@ -8948,7 +8952,7 @@ PopupsComposeViewModel.prototype.sendMessageResponse = function (sResult, oData)
Utils.delegateRun(this, 'closeCommand'); Utils.delegateRun(this, 'closeCommand');
} }
} }
if (this.modalVisibility() && !bResult) if (this.modalVisibility() && !bResult)
{ {
if (oData && Enums.Notification.CantSaveMessage === oData.ErrorCode) if (oData && Enums.Notification.CantSaveMessage === oData.ErrorCode)
@ -9097,7 +9101,7 @@ PopupsComposeViewModel.prototype.editor = function (fOnInit)
PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToEmails) PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToEmails)
{ {
kn.routeOff(); kn.routeOff();
var var
self = this, self = this,
sFrom = '', sFrom = '',
@ -9168,7 +9172,7 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
{ {
case Enums.ComposeType.Empty: case Enums.ComposeType.Empty:
break; break;
case Enums.ComposeType.Reply: case Enums.ComposeType.Reply:
this.to(fEmailArrayToStringLineHelper(oMessage.replyEmails(oExcludeEmail))); this.to(fEmailArrayToStringLineHelper(oMessage.replyEmails(oExcludeEmail)));
this.subject(Utils.replySubjectAdd('Re', sSubject)); this.subject(Utils.replySubjectAdd('Re', sSubject));
@ -9349,7 +9353,7 @@ PopupsComposeViewModel.prototype.onFocus = function ()
{ {
this.oEditor.focus(); this.oEditor.focus();
} }
this.triggerForResize(); this.triggerForResize();
}; };
@ -9376,7 +9380,7 @@ PopupsComposeViewModel.prototype.onBuild = function ()
{ {
this.initUploader(); this.initUploader();
var var
self = this, self = this,
oScript = null oScript = null
; ;
@ -9395,7 +9399,7 @@ PopupsComposeViewModel.prototype.onBuild = function ()
self.sendCommand(); self.sendCommand();
return false; return false;
}); });
key('esc', Enums.KeyState.Compose, function () { key('esc', Enums.KeyState.Compose, function () {
self.tryToClosePopup(); self.tryToClosePopup();
return false; return false;
@ -9411,7 +9415,7 @@ PopupsComposeViewModel.prototype.onBuild = function ()
oScript.type = 'text/javascript'; oScript.type = 'text/javascript';
oScript.src = 'https://www.dropbox.com/static/api/1/dropins.js'; oScript.src = 'https://www.dropbox.com/static/api/1/dropins.js';
$(oScript).attr('id', 'dropboxjs').attr('data-app-key', RL.settingsGet('DropboxApiKey')); $(oScript).attr('id', 'dropboxjs').attr('data-app-key', RL.settingsGet('DropboxApiKey'));
document.body.appendChild(oScript); document.body.appendChild(oScript);
} }
@ -9754,7 +9758,7 @@ PopupsComposeViewModel.prototype.addDropboxAttachment = function (oDropboxFile)
var bResult = false; var bResult = false;
oAttachment.uploading(false); oAttachment.uploading(false);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result) if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{ {
if (oData.Result[oAttachment.id]) if (oData.Result[oAttachment.id])

File diff suppressed because one or more lines are too long