mirror of
				https://github.com/Kopano-dev/kopano-ol-extension.git
				synced 2023-10-10 11:37:40 +00:00 
			
		
		
		
	More debug options
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user