mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
Added option to disable item event hooking
This commit is contained in:
parent
4dd77097a8
commit
90e0029a8e
@ -194,14 +194,11 @@ namespace Acacia.Features
|
||||
|
||||
#region Event helpers
|
||||
|
||||
private static MailEvents _mailEvents;
|
||||
protected static MailEvents MailEvents
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_mailEvents == null)
|
||||
_mailEvents = new MailEvents(ThisAddIn.Instance);
|
||||
return _mailEvents;
|
||||
return ThisAddIn.Instance.MailEvents;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ namespace Acacia.Features.GAB
|
||||
|
||||
public override void Startup()
|
||||
{
|
||||
if (SuppressModifications)
|
||||
if (SuppressModifications && MailEvents != null)
|
||||
{
|
||||
MailEvents.BeforeDelete += SuppressEventHandler_Delete;
|
||||
MailEvents.Write += SuppressEventHandler_Modify;
|
||||
|
@ -47,15 +47,21 @@ namespace Acacia.Features.ReplyFlags
|
||||
if (ReadEvent)
|
||||
{
|
||||
// As a fallback, add an event handler to update the message when displaying it
|
||||
MailEvents.Read += UpdateReplyStatus;
|
||||
if (MailEvents != null)
|
||||
{
|
||||
MailEvents.Read += UpdateReplyStatus;
|
||||
}
|
||||
}
|
||||
|
||||
if (SendEvents)
|
||||
{
|
||||
// Hook reply and send events to update local state to server
|
||||
MailEvents.Reply += OnReply;
|
||||
MailEvents.ReplyAll += OnReplyAll;
|
||||
MailEvents.Forward += OnForwarded;
|
||||
if (MailEvents != null)
|
||||
{
|
||||
MailEvents.Reply += OnReply;
|
||||
MailEvents.ReplyAll += OnReplyAll;
|
||||
MailEvents.Forward += OnForwarded;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,10 @@ namespace Acacia.Features.SendAs
|
||||
|
||||
public override void Startup()
|
||||
{
|
||||
MailEvents.ItemSend += MailEvents_ItemSend;
|
||||
if (MailEvents != null)
|
||||
{
|
||||
MailEvents.ItemSend += MailEvents_ItemSend;
|
||||
}
|
||||
|
||||
if (SendAsOwner)
|
||||
{
|
||||
@ -57,7 +60,10 @@ namespace Acacia.Features.SendAs
|
||||
_sharedFolders = ThisAddIn.Instance.GetFeature<FeatureSharedFolders>();
|
||||
if (_sharedFolders != null)
|
||||
{
|
||||
MailEvents.Respond += MailEvents_Respond;
|
||||
if (MailEvents != null)
|
||||
{
|
||||
MailEvents.Respond += MailEvents_Respond;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,6 +118,15 @@ namespace Acacia
|
||||
}
|
||||
}
|
||||
|
||||
[AcaciaOption("Enables or disables item event hooking." +
|
||||
"Note that if this is disabled, several features may not work correctly.")]
|
||||
virtual public bool HookItemEvents
|
||||
{
|
||||
get { return GetOption(null, HOOK_ITEM_EVENTS); }
|
||||
set { SetOption(null, HOOK_ITEM_EVENTS, value); }
|
||||
}
|
||||
private static readonly BoolOption HOOK_ITEM_EVENTS = new BoolOption("HookItemEvents", true);
|
||||
|
||||
#region UI Options
|
||||
|
||||
[AcaciaOption("Completely enables or disables modifications to the Outlook UI." +
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Acacia.Features;
|
||||
using Acacia.UI.Outlook;
|
||||
using Acacia.Utils;
|
||||
using Acacia.ZPush;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -16,6 +17,7 @@ namespace Acacia.Stubs
|
||||
NSOutlook.Application RawApp { get; } // TODO: remove
|
||||
|
||||
ZPushWatcher Watcher { get; }
|
||||
MailEvents MailEvents { get; }
|
||||
IEnumerable<Feature> Features { get; }
|
||||
IEnumerable<KeyValuePair<string,string>> COMAddIns { get; }
|
||||
string Version { get; }
|
||||
|
@ -85,6 +85,7 @@ namespace Acacia.Stubs.OutlookWrappers
|
||||
public OutlookUI OutlookUI { get { return _thisAddIn.OutlookUI; } }
|
||||
|
||||
public ZPushWatcher Watcher { get { return _thisAddIn.Watcher; } }
|
||||
public MailEvents MailEvents { get { return _thisAddIn.MailEvents; } }
|
||||
public IEnumerable<Feature> Features { get { return _thisAddIn.Features; } }
|
||||
public IEnumerable<KeyValuePair<string, string>> COMAddIns
|
||||
{
|
||||
|
@ -63,6 +63,22 @@ namespace Acacia
|
||||
private set;
|
||||
}
|
||||
|
||||
private MailEvents _mailEvents;
|
||||
public MailEvents MailEvents
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_mailEvents == null)
|
||||
{
|
||||
if (GlobalOptions.INSTANCE.HookItemEvents)
|
||||
{
|
||||
_mailEvents = new MailEvents(Instance);
|
||||
}
|
||||
}
|
||||
return _mailEvents;
|
||||
}
|
||||
}
|
||||
|
||||
#region Startup / Shutdown
|
||||
|
||||
private void ThisAddIn_Startup(object sender, System.EventArgs args)
|
||||
|
Loading…
Reference in New Issue
Block a user