private void ProcessConversationActions(ConversationId conversationId, StoreDriverDeliveryEventArgsImpl argsImpl)
        {
            MailboxSession mailboxSession = argsImpl.MailboxSession;

            try
            {
                StoreId storeId = ConversationActionItem.QueryConversationActionsFolder(mailboxSession, conversationId);
                if (storeId != null)
                {
                    using (ConversationActionItem conversationActionItem = ConversationActionItem.Bind(mailboxSession, storeId))
                    {
                        ConversationsProcessingAgent.tracer.TraceDebug <ConversationId>((long)this.GetHashCode(), "Found CAT item for message with CID = {0}", conversationId);
                        if (!conversationActionItem.IsCorrectVersion())
                        {
                            ConversationsProcessingAgent.tracer.TraceDebug <int, ConversationId>((long)this.GetHashCode(), "Found CAT item with major version {0} for message with CID = {1}", conversationActionItem.ConversationActionVersionMajor, conversationId);
                        }
                        else
                        {
                            StoreId targetFolderId = conversationActionItem.TargetFolderId;
                            if (targetFolderId != null)
                            {
                                argsImpl.DeliverToFolder    = targetFolderId;
                                argsImpl.ShouldSkipMoveRule = true;
                                ConversationsProcessingAgent.tracer.TraceDebug((long)this.GetHashCode(), "Applied move action to item");
                            }
                            List <string> categoriesForItem = conversationActionItem.GetCategoriesForItem(argsImpl.ReplayItem.TryGetProperty(ItemSchema.Categories) as string[]);
                            if (categoriesForItem != null)
                            {
                                argsImpl.PropertiesForAllMessageCopies[ItemSchema.Categories] = categoriesForItem.ToArray();
                                ConversationsProcessingAgent.tracer.TraceDebug((long)this.GetHashCode(), "Applied categorize action to item");
                            }
                            if (conversationActionItem.AlwaysClutterOrUnclutterValue != null)
                            {
                                if (argsImpl.SharedPropertiesBetweenAgents == null)
                                {
                                    argsImpl.SharedPropertiesBetweenAgents = new Dictionary <PropertyDefinition, object>();
                                }
                                argsImpl.SharedPropertiesBetweenAgents[ItemSchema.InferenceConversationClutterActionApplied] = conversationActionItem.AlwaysClutterOrUnclutterValue.Value;
                                ConversationsProcessingAgent.tracer.TraceDebug((long)this.GetHashCode(), "Applied clutter action to item");
                            }
                            conversationActionItem.Save(SaveMode.ResolveConflicts);
                        }
                    }
                }
            }
            catch (ObjectNotFoundException arg)
            {
                ConversationsProcessingAgent.tracer.TraceError <ObjectNotFoundException>((long)this.GetHashCode(), "Exception - {0}", arg);
            }
        }
        // Token: 0x06000113 RID: 275 RVA: 0x00006C64 File Offset: 0x00004E64
        internal static void HandleEventInternal(MapiEvent mapiEvent, MailboxSession session, StoreObject storeItem, MailboxData mailboxData)
        {
            SentItemsProcessor.Tracer.TraceDebug(0L, "{0}: Calling SentItemsProcessor.HandleEventInternal", new object[]
            {
                TraceContext.Get()
            });
            Item item = (Item)storeItem;

            if (item == null)
            {
                SentItemsProcessor.Tracer.TraceError(0L, "{0}: HandleEventInternal received null item", new object[]
                {
                    TraceContext.Get()
                });
                return;
            }
            if (ObjectClass.IsSmsMessage(item.ClassName))
            {
                try
                {
                    ConversationIndexTrackingEx conversationIndexTrackingEx = ConversationIndexTrackingEx.Create();
                    SentItemsProcessor.HandleSmsMessage(session, item, mailboxData, conversationIndexTrackingEx);
                    SentItemsProcessor.Tracer.TraceDebug <object, ConversationIndexTrackingEx>(0L, "{0}: ChunkSmsConversation traces: {1}", TraceContext.Get(), conversationIndexTrackingEx);
                }
                catch (ObjectNotFoundException)
                {
                    SentItemsProcessor.Tracer.TraceDebug(0L, "{0}: ObjectNotFoundException thrown while processing SMS item in Sent Items folder", new object[]
                    {
                        TraceContext.Get()
                    });
                }
                return;
            }
            try
            {
                ConversationId valueOrDefault = item.GetValueOrDefault <ConversationId>(ItemSchema.ConversationId);
                if (valueOrDefault == null)
                {
                    SentItemsProcessor.Tracer.TraceError(0L, "{0}: Found item without conversation id", new object[]
                    {
                        TraceContext.Get()
                    });
                }
                else
                {
                    int             totalActionItemCount;
                    IList <StoreId> list    = ConversationActionItem.QueryConversationActionsFolder(session, valueOrDefault, 1, out totalActionItemCount);
                    StoreId         storeId = (list != null) ? list[0] : null;
                    mailboxData.UpdateConversationActionsEnabledStatus(totalActionItemCount);
                    if (storeId == null)
                    {
                        SentItemsProcessor.Tracer.TraceDebug <object, ConversationId>(0L, "{0}: No action item associated found for message with conversation Id = {1}", TraceContext.Get(), valueOrDefault);
                    }
                    else
                    {
                        using (ConversationActionItem conversationActionItem = ConversationActionItem.Bind(session, storeId))
                        {
                            if (conversationActionItem.IsCorrectVersion())
                            {
                                if (conversationActionItem.AlwaysCategorizeValue != null)
                                {
                                    List <string> categoriesForItem = conversationActionItem.GetCategoriesForItem(item.TryGetProperty(ItemSchema.Categories) as string[]);
                                    if (categoriesForItem != null)
                                    {
                                        SentItemsProcessor.Tracer.TraceDebug(0L, "{0}: Processed categories on item", new object[]
                                        {
                                            TraceContext.Get()
                                        });
                                        item.SafeSetProperty(ItemSchema.Categories, categoriesForItem.ToArray());
                                        item.Save(SaveMode.ResolveConflicts);
                                        item.Load();
                                    }
                                }
                                conversationActionItem.Save(SaveMode.ResolveConflicts);
                            }
                        }
                    }
                }
            }
            catch (ObjectNotFoundException)
            {
                SentItemsProcessor.Tracer.TraceDebug(0L, "{0}: ObjectNotFoundException thrown while processing action item", new object[]
                {
                    TraceContext.Get()
                });
            }
        }
 // Token: 0x0600010E RID: 270 RVA: 0x00006844 File Offset: 0x00004A44
 internal static void HandleEventInternal(MapiEvent mapiEvent, MailboxSession session, StoreObject storeItem, MailboxData mailboxData)
 {
     ActionsProcessor.Tracer.TraceDebug(0L, "{0}: Calling ActionsProcessor.HandleEventInternal", new object[]
     {
         TraceContext.Get()
     });
     try
     {
         StoreObjectId conversationActionsFolderId = ConversationActionItem.GetConversationActionsFolderId(session, false);
         if (conversationActionsFolderId != null)
         {
             if (ArrayComparer <byte> .Comparer.Equals(mapiEvent.ParentEntryId, conversationActionsFolderId.ProviderLevelItemId))
             {
                 ConversationActionItem conversationActionItem = storeItem as ConversationActionItem;
                 if (conversationActionItem == null)
                 {
                     ActionsProcessor.Tracer.TraceError(0L, "{0}: HandleEventInternal received null item", new object[]
                     {
                         TraceContext.Get()
                     });
                 }
                 else if (conversationActionItem.IsCorrectVersion())
                 {
                     bool flag = ActionsProcessor.MergeDuplicateActionItems(session, conversationActionItem, mailboxData);
                     if (flag)
                     {
                         ActionsProcessor.Tracer.TraceDebug(0L, "{0}: Item being processed got deleted by merging duplicates", new object[]
                         {
                             TraceContext.Get()
                         });
                     }
                     else
                     {
                         ActionsProcessor.Tracer.TraceDebug <object, ConversationId>(0L, "{0}: Processing conversation action item with conversation id = {1}", TraceContext.Get(), conversationActionItem.ConversationId);
                         AggregateOperationResult result = conversationActionItem.ProcessItems(ConversationAction.AlwaysMove | ConversationAction.AlwaysDelete | ConversationAction.AlwaysCategorize);
                         ActionsProcessor.TraceAggregateOperationResult(result);
                         conversationActionItem.Save(SaveMode.ResolveConflicts);
                     }
                 }
             }
         }
     }
     catch (CorruptDataException)
     {
         ActionsProcessor.Tracer.TraceDebug(0L, "{0}: CorruptDataException thrown while processing action item", new object[]
         {
             TraceContext.Get()
         });
         byte[] valueOrDefault = storeItem.GetValueOrDefault <byte[]>(ItemSchema.ConversationIndex, new byte[0]);
         Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_CorruptConversationActionItem, null, new object[]
         {
             session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(),
             BitConverter.ToString(valueOrDefault)
         });
     }
     catch (ObjectNotFoundException)
     {
         ActionsProcessor.Tracer.TraceDebug(0L, "{0}: ObjectNotFoundException thrown while processing action item", new object[]
         {
             TraceContext.Get()
         });
     }
 }