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

More debug options

This commit is contained in:
Patrick Simpson 2017-02-08 16:54:47 +01:00
parent 7e05792d8c
commit 3117418785
2 changed files with 21 additions and 9 deletions

View File

@ -118,6 +118,15 @@ namespace Acacia.Features.GAB
}
private static readonly BoolOption OPTION_PROCESS_MESSAGE = new BoolOption("ProcessMessage", true);
[AcaciaOption("If disabled, existing contacts are not deleted when a chunk is processed. " +
"This should only be disabled for debug purposes.")]
public bool ProcessMessageDeleteExisting
{
get { return GetOption(OPTION_PROCESS_MESSAGE_DELETE_EXISTING); }
set { SetOption(OPTION_PROCESS_MESSAGE_DELETE_EXISTING, value); }
}
private static readonly BoolOption OPTION_PROCESS_MESSAGE_DELETE_EXISTING = new BoolOption("ProcessMessageDeleteExisting", true);
[AcaciaOption("If disabled, contacts are not created from incoming GAB messages. " +
"This should only be disabled for debug purposes.")]
public bool CreateContacts

View File

@ -268,18 +268,21 @@ namespace Acacia.Features.GAB
_feature?.BeginProcessing();
try
{
// Delete the old contacts from this chunk
using (ISearch<IItem> search = Contacts.Search<IItem>())
if (_feature.ProcessMessageDeleteExisting)
{
search.AddField(PROP_SEQUENCE, true).SetOperation(SearchOperation.Equal, index.numberOfChunks);
search.AddField(PROP_CHUNK, true).SetOperation(SearchOperation.Equal, index.chunk);
foreach (IItem oldItem in search.Search())
// Delete the old contacts from this chunk
using (ISearch<IItem> search = Contacts.Search<IItem>())
{
// TODO: Search should handle this, like folder enumeration
using (oldItem)
search.AddField(PROP_SEQUENCE, true).SetOperation(SearchOperation.Equal, index.numberOfChunks);
search.AddField(PROP_CHUNK, true).SetOperation(SearchOperation.Equal, index.chunk);
foreach (IItem oldItem in search.Search())
{
Logger.Instance.Trace(this, "Deleting GAB entry: {0}", oldItem.Subject);
oldItem.Delete();
// TODO: Search should handle this, like folder enumeration
using (oldItem)
{
Logger.Instance.Trace(this, "Deleting GAB entry: {0}", oldItem.Subject);
oldItem.Delete();
}
}
}
}