1
0
mirror of https://github.com/Kopano-dev/kopano-ol-extension.git synced 2023-10-10 13:37:40 +02:00

[KOE-114] Added extra logging to private appointment modification suppression

This commit is contained in:
Patrick Simpson 2017-06-08 09:29:37 +02:00
parent 2cba8de29e
commit 4e91672227

View File

@ -187,15 +187,21 @@ namespace Acacia.Features.SharedFolders
{ {
if (SuppressModificationsPrivateAppointments && MailEvents != null) if (SuppressModificationsPrivateAppointments && MailEvents != null)
{ {
Logger.Instance.Trace(this, "Setting up private appointment modification suppression");
MailEvents.BeforeDelete += SuppressEventHandler_Delete; MailEvents.BeforeDelete += SuppressEventHandler_Delete;
MailEvents.PropertyChange += SuppressEventHandler_PropertyChange; MailEvents.PropertyChange += SuppressEventHandler_PropertyChange;
MailEvents.Write += SuppressEventHandler_Write; MailEvents.Write += SuppressEventHandler_Write;
} }
else
{
Logger.Instance.Trace(this, "Not setting up private appointment modification suppression");
}
} }
private void SuppressEventHandler_Delete(IItem item, ref bool cancel) private void SuppressEventHandler_Delete(IItem item, ref bool cancel)
{ {
Logger.Instance.Trace(this, "Private appointment: delete");
SuppressEventHandler(item, false, ref cancel); SuppressEventHandler(item, false, ref cancel);
} }
@ -210,6 +216,7 @@ namespace Acacia.Features.SharedFolders
{ {
if (_propertyChangeId == item.EntryID) if (_propertyChangeId == item.EntryID)
return; return;
Logger.Instance.Trace(this, "Private appointment: property change");
_propertyChangeId = item.EntryID; _propertyChangeId = item.EntryID;
} }
@ -217,6 +224,7 @@ namespace Acacia.Features.SharedFolders
{ {
if (_propertyChangeId == item.EntryID) if (_propertyChangeId == item.EntryID)
{ {
Logger.Instance.Trace(this, "Private appointment: write");
SuppressEventHandler(item, true, ref cancel); SuppressEventHandler(item, true, ref cancel);
_propertyChangeId = null; _propertyChangeId = null;
} }
@ -224,20 +232,31 @@ namespace Acacia.Features.SharedFolders
private void SuppressEventHandler(IItem item, bool findInspector, ref bool cancel) private void SuppressEventHandler(IItem item, bool findInspector, ref bool cancel)
{ {
Logger.Instance.Trace(this, "Private appointment: suppress");
// Check if it's an appointment // Check if it's an appointment
IAppointmentItem appointment = item as IAppointmentItem; IAppointmentItem appointment = item as IAppointmentItem;
if (appointment == null) if (appointment == null)
{
Logger.Instance.TraceExtra(this, "Private appointment: suppress: not an appointment");
return; return;
}
// Check if it's private. Confidential is also considered private // Check if it's private. Confidential is also considered private
if (appointment.Sensitivity < Sensitivity.Private) if (appointment.Sensitivity < Sensitivity.Private)
{
Logger.Instance.TraceExtra(this, "Private appointment: suppress: not private");
return; return;
}
// Check if in a shared folder // Check if in a shared folder
using (IFolder parent = item.Parent) using (IFolder parent = item.Parent)
{ {
if (parent == null || !IsSharedFolder(parent)) if (parent == null || !IsSharedFolder(parent))
{
Logger.Instance.TraceExtra(this, "Private appointment: suppress: not in a shared folder");
return; return;
}
} }
if (findInspector) if (findInspector)
@ -256,6 +275,7 @@ namespace Acacia.Features.SharedFolders
} }
// Private appointment in a shared folder, suppress // Private appointment in a shared folder, suppress
Logger.Instance.TraceExtra(this, "Private appointment: suppressing");
cancel = true; cancel = true;
MessageBox.Show(ThisAddIn.Instance.Window, MessageBox.Show(ThisAddIn.Instance.Window,
Properties.Resources.SharedFolders_PrivateEvent_Body, Properties.Resources.SharedFolders_PrivateEvent_Body,