[KOE-106] Transporting the delivery receipt request in the X-Push-Receipts header.

This commit is contained in:
Patrick Simpson 2017-05-03 14:36:55 +02:00
parent ebc4e807a9
commit 55e4109c8c
3 changed files with 58 additions and 0 deletions

View File

@ -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

View File

@ -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<http://www.gnu.org/licenses/>.
///
/// 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<IMailItem>(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);
}
}
}
}

View File

@ -39,6 +39,7 @@ namespace Acacia.Features
typeof(Signatures.FeatureSignatures),
typeof(DebugSupport.FeatureDebugSupport),
typeof(SyncState.FeatureSyncState),
typeof(DeliveryReceipts.FeatureDeliveryReceipts)
};
}
}