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

View file

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

View file

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

View file

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

View file

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

View file

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

File diff suppressed because one or more lines are too long