diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Constants.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Constants.cs index 3ad3022..b45f9ef 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Constants.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Constants.cs @@ -83,6 +83,13 @@ namespace Acacia public const string ZPUSH_HEADER_SIGNATURES_HASH = "X-Push-Signatures-Hash"; + #endregion + + #region Delivery receipt requests + + public const string ZPUSH_RECEIPT_REQUESTS = OutlookConstants.NS_TRANSPORT_MESSAGE_HEADERS + "X-Push-Receipts"; + public const string ZPUSH_RECEIPT_REQUEST_DELIVERY = "delivery"; + #endregion #region Capabilities diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DeliveryReceipts/FeatureDeliveryReceipts.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DeliveryReceipts/FeatureDeliveryReceipts.cs new file mode 100644 index 0000000..cbcd366 --- /dev/null +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/DeliveryReceipts/FeatureDeliveryReceipts.cs @@ -0,0 +1,50 @@ +/// Copyright 2017 Kopano b.v. +/// +/// This program is free software: you can redistribute it and/or modify +/// it under the terms of the GNU Affero General Public License, version 3, +/// as published by the Free Software Foundation. +/// +/// This program is distributed in the hope that it will be useful, +/// but WITHOUT ANY WARRANTY; without even the implied warranty of +/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the +/// GNU Affero General Public License for more details. +/// +/// You should have received a copy of the GNU Affero General Public License +/// along with this program.If not, see. +/// +/// Consult LICENSE file for details + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Acacia.Stubs; +using Acacia.Utils; +using Acacia.ZPush; + +namespace Acacia.Features.DeliveryReceipts +{ + [AcaciaOption("Fixes Delivery Receipt Requests in Outlook, which does not transmit them over ActiveSync.")] + public class FeatureDeliveryReceipts : Feature + { + public FeatureDeliveryReceipts() + { + } + + public override void Startup() + { + MailEvents?.ItemSend.Register(MailEvents_ItemSend); + } + + private void MailEvents_ItemSend(IMailItem item, ref bool cancel) + { + bool? wantReport = (bool?)item.GetProperty(OutlookConstants.PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED); + if (wantReport == true) + { + Logger.Instance.Trace(this, "Delivery receipt request: {0}", item.EntryID); + item.SetProperty(Constants.ZPUSH_RECEIPT_REQUESTS, Constants.ZPUSH_RECEIPT_REQUEST_DELIVERY); + } + } + } +} diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/Features.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/Features.cs index 3523c76..96e0ee1 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/Features.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/Features.cs @@ -39,6 +39,7 @@ namespace Acacia.Features typeof(Signatures.FeatureSignatures), typeof(DebugSupport.FeatureDebugSupport), typeof(SyncState.FeatureSyncState), + typeof(DeliveryReceipts.FeatureDeliveryReceipts) }; } }