// Token: 0x060000FF RID: 255 RVA: 0x00005C38 File Offset: 0x00003E38 protected override void HandleEventInternal(MapiEvent mapiEvent, MailboxSession session, StoreObject item, List <KeyValuePair <string, object> > customDataToLog) { CachedState cachedState = AssistantsService.CachedObjectsList.GetCachedState(mapiEvent.MailboxGuid); MailboxData mailboxData = (MailboxData)cachedState.State[3]; if (mailboxData == null) { mailboxData = new MailboxData(session); Interlocked.Exchange(ref cachedState.State[3], mailboxData); } if (BodyTagProcessor.IsEventInteresting(mapiEvent)) { BodyTagProcessor.HandleEventInternal(session, item); return; } if (ActionsProcessor.IsEventInteresting(mapiEvent)) { ActionsProcessor.HandleEventInternal(mapiEvent, session, item, mailboxData); Interlocked.Exchange(ref cachedState.State[3], mailboxData); return; } if (SentItemsProcessor.IsEventInteresting(mapiEvent, mailboxData)) { SentItemsProcessor.HandleEventInternal(mapiEvent, session, item, mailboxData); Interlocked.Exchange(ref cachedState.State[3], mailboxData); return; } if (LicensingProcessor.IsEventInteresting(mapiEvent, mailboxData)) { LicensingProcessor.HandleEventInternal(session, item); return; } if (InferenceProcessor.IsEventInteresting(mapiEvent, mailboxData)) { InferenceProcessor.HandleEventInternal(mapiEvent, session, item, mailboxData, customDataToLog); } }
// Token: 0x06000114 RID: 276 RVA: 0x00006EAC File Offset: 0x000050AC private static void HandleSmsMessage(MailboxSession session, Item item, MailboxData mailboxData, ConversationIndexTrackingEx indexTrackingEx) { MessageItem messageItem = item as MessageItem; if (messageItem == null) { SentItemsProcessor.Tracer.TraceDebug(0L, "{0}: the SMS message is not MessageItem", new object[] { TraceContext.Get() }); return; } RecipientCollection recipients = messageItem.Recipients; if (recipients.Count == 0) { return; } using (SmsRecipientInfoCache smsRecipientInfoCache = SmsRecipientInfoCache.Create(session, SentItemsProcessor.Tracer)) { Dictionary <ConversationIndex, Recipient> dictionary = new Dictionary <ConversationIndex, Recipient>(recipients.Count); for (int i = recipients.Count - 1; i >= 0; i--) { Recipient recipient = recipients[i]; Participant participant = recipient.Participant; if (!(participant == null) && !string.IsNullOrEmpty(participant.EmailAddress)) { string text = null; if (string.Equals(participant.RoutingType, "MOBILE", StringComparison.OrdinalIgnoreCase)) { text = participant.EmailAddress; smsRecipientInfoCache.AddRecipient(participant); } else if (string.Equals(participant.RoutingType, "SMTP", StringComparison.OrdinalIgnoreCase)) { ProxyAddress proxyAddress; if (SmtpProxyAddress.TryDeencapsulate(participant.EmailAddress, out proxyAddress) && string.Equals(proxyAddress.PrefixString, "MOBILE", StringComparison.OrdinalIgnoreCase)) { text = proxyAddress.AddressString; } smsRecipientInfoCache.AddRecipient(new Participant(participant.DisplayName, text, "MOBILE")); } if (text != null) { ConversationIndex conversationIndex = ConversationIndex.GenerateFromPhoneNumber(text); if (!(conversationIndex == ConversationIndex.Empty)) { recipients.RemoveAt(i); if (!dictionary.ContainsKey(conversationIndex)) { dictionary.Add(conversationIndex, recipient); } } } } } if (recipients.Count > 0) { messageItem.Save(SaveMode.ResolveConflicts); messageItem.Load(); } int num = 0; foreach (KeyValuePair <ConversationIndex, Recipient> keyValuePair in dictionary) { num++; AggregationBySmsItemClassProcessor.ChunkSmsConversation(XSOFactory.Default, session, keyValuePair.Key, indexTrackingEx); if (num < dictionary.Count || recipients.Count > 0) { SentItemsProcessor.CloneSmsItem(session, messageItem, mailboxData, keyValuePair.Value, keyValuePair.Key); } else { recipients.Add(keyValuePair.Value); SentItemsProcessor.SaveSmsItem(messageItem, keyValuePair.Key); messageItem.Load(); } } smsRecipientInfoCache.Commit(); } }
// 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: 0x06000132 RID: 306 RVA: 0x000079B8 File Offset: 0x00005BB8 internal static bool IsEventInteresting(MapiEvent mapiEvent, MailboxData mailboxData) { return(VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Inference.InferenceEventBasedAssistant.Enabled&& (InferenceProcessor.IsInferenceProcessingNeeded(mapiEvent) || InferenceProcessor.IsOutlookActivityProcessingNeeded(mapiEvent, mailboxData))); }
// Token: 0x06000133 RID: 307 RVA: 0x000079F8 File Offset: 0x00005BF8 internal static void HandleEventInternal(MapiEvent mapiEvent, MailboxSession session, StoreObject storeItem, MailboxData mailboxData, List <KeyValuePair <string, object> > customDataToLog) { InferenceProcessor.Log(customDataToLog, "InferenceDiagnostics", mapiEvent.ToString()); Exception ex = null; try { ArgumentValidator.ThrowIfNull("session", session); if (storeItem == null) { InferenceProcessor.Log(customDataToLog, "InferenceDiagnostics", "NullStoreItem"); } else { MessageItem messageItem = storeItem as MessageItem; if (messageItem == null) { InferenceProcessor.Log(customDataToLog, "InferenceDiagnostics", "StoreItemIsNotMessageItem"); } else { if (InferenceProcessor.IsInferenceProcessingNeeded(mapiEvent)) { InferenceProcessor.Log(customDataToLog, "InferenceDiagnostics", "InferenceProcessingNeeded"); if (!messageItem.GetValueOrDefault <bool>(ItemSchema.InferenceProcessingNeeded, false)) { return; } try { messageItem.DeleteProperties(new PropertyDefinition[] { ItemSchema.InferenceProcessingNeeded }); InferenceProcessingActions valueOrDefault = (InferenceProcessingActions)messageItem.GetValueOrDefault <long>(ItemSchema.InferenceProcessingActions, 0L); messageItem.DeleteProperties(new PropertyDefinition[] { ItemSchema.InferenceProcessingActions }); if (valueOrDefault.HasFlag(InferenceProcessingActions.ProcessImplicitMarkAsNotClutter)) { InferenceProcessor.HandleImplicitMarkAsNotClutter(mapiEvent, session, messageItem, customDataToLog); goto IL_1C6; } throw new ArgumentException("No actionable flag is set on InferenceProcessingActions, but InferenceProcessingNeeded is true"); } finally { if (messageItem.IsDirty) { messageItem.Save(SaveMode.ResolveConflicts); } } } if (InferenceProcessor.IsOutlookActivityProcessingNeeded(mapiEvent, mailboxData)) { InferenceProcessor.Log(customDataToLog, "InferenceDiagnostics", "ProcessOutlookActivity"); if (session.IsDefaultFolderType(messageItem.ParentId) != DefaultFolderType.Inbox) { InferenceProcessor.Log(customDataToLog, "InferenceDiagnostics", "ActivityItemNotInExpectedFolder"); return; } try { int num = OutlookActivityProcessor.Process(session, messageItem); InferenceProcessor.Log(customDataToLog, "NumOfOutlookActivityItemsProcessed", num); } catch (OutlookActivityParsingException value) { InferenceProcessor.Log(customDataToLog, "OutlookActivityParsingException", value); } using (Folder folder = Folder.Bind(session, DefaultFolderType.Inbox)) { folder.DeleteObjects(DeleteItemFlags.HardDelete, new StoreId[] { messageItem.Id }); goto IL_1C6; } } throw new ArgumentException("We should not get an event that's not interested by InferenceProcessor" + mapiEvent.ToString()); IL_1C6 :; } } } catch (Exception ex2) { ex = ex2; } finally { if (ex != null) { InferenceProcessor.Log(customDataToLog, "Exception", ex.ToString()); } InferenceProcessor.Log(customDataToLog, "InferenceDiagnostics", (ex == null) ? "InvokeSucceeded" : "InvokeFailed"); } }
// Token: 0x06000136 RID: 310 RVA: 0x00007DAC File Offset: 0x00005FAC private static bool IsOutlookActivityProcessingNeeded(MapiEvent mapiEvent, MailboxData mailboxData) { return(ActivityLogHelper.IsActivityLoggingEnabled(false) && CommonConfiguration.Singleton.OutlookActivityProcessingEnabledInEba && mapiEvent.ObjectClass == "IPM.Activity" && mapiEvent.EventFlags.HasFlag(MapiEventFlags.FolderAssociated) && (mailboxData == null || mailboxData.MatchCachedDefaultFolderType(mapiEvent.ParentEntryId) == DefaultFolderType.Inbox) && mapiEvent.EventMask.HasFlag(MapiEventTypeFlags.ObjectCreated) && mapiEvent.ClientType != MapiEventClientTypes.EventBasedAssistants); }
// Token: 0x0600012B RID: 299 RVA: 0x0000745C File Offset: 0x0000565C private static bool IsMessageCreatedInSentItems(MapiEvent mapiEvent, MailboxData mailboxData) { if (mapiEvent.ItemType != ObjectType.MAPI_MESSAGE) { return(false); } if ((mapiEvent.EventFlags & MapiEventFlags.FolderAssociated) != MapiEventFlags.None) { return(false); } if (!mapiEvent.ExtendedEventFlags.Contains(MapiExtendedEventFlags.IrmRestrictedItem)) { return(false); } if (mapiEvent.ItemEntryId == null || mapiEvent.ParentEntryId == null) { LicensingProcessor.Tracer.TraceError(0L, "{0}: Found item without entry Id or parent entry Id", new object[] { TraceContext.Get() }); return(false); } if (!ObjectClass.IsOfClass(mapiEvent.ObjectClass, "IPM.Note")) { return(false); } if (mapiEvent.ClientType == MapiEventClientTypes.Transport) { if ((mapiEvent.EventMask & MapiEventTypeFlags.ObjectCreated) != (MapiEventTypeFlags)0) { if (mailboxData == null) { return(true); } DefaultFolderType defaultFolderType = mailboxData.MatchCachedDefaultFolderType(mapiEvent.ParentEntryId); if (defaultFolderType == DefaultFolderType.SentItems) { LicensingProcessor.Tracer.TraceDebug(0L, "{0}: Found item created in sent items by Transport", new object[] { TraceContext.Get() }); return(true); } } } else if ((mapiEvent.ClientType == MapiEventClientTypes.MOMT || mapiEvent.ClientType == MapiEventClientTypes.User || mapiEvent.ClientType == MapiEventClientTypes.RpcHttp) && (mapiEvent.EventMask & MapiEventTypeFlags.ObjectMoved) != (MapiEventTypeFlags)0) { if (mailboxData == null) { return(true); } DefaultFolderType defaultFolderType2 = mailboxData.MatchCachedDefaultFolderType(mapiEvent.ParentEntryId); DefaultFolderType defaultFolderType3 = mailboxData.MatchCachedDefaultFolderType(mapiEvent.OldParentEntryId); if (defaultFolderType2 == DefaultFolderType.SentItems && defaultFolderType3 == DefaultFolderType.Outbox) { LicensingProcessor.Tracer.TraceDebug(0L, "{0}: Found item moved to sent items by Outlook", new object[] { TraceContext.Get() }); return(true); } } return(false); }
// Token: 0x06000129 RID: 297 RVA: 0x000073FB File Offset: 0x000055FB public static bool IsEventInteresting(MapiEvent mapiEvent, MailboxData mailboxData) { return(LicensingProcessor.IsMessageCreatedInSentItems(mapiEvent, mailboxData)); }
// 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() }); } }
// Token: 0x0600010F RID: 271 RVA: 0x00006A18 File Offset: 0x00004C18 private static bool MergeDuplicateActionItems(MailboxSession session, ConversationActionItem actionItem, MailboxData mailboxData) { ActionsProcessor.Tracer.TraceDebug(0L, "{0}: Calling ActionsProcessor.MergeDuplicateActionItems", new object[] { TraceContext.Get() }); ConversationId conversationId = actionItem.ConversationId; int totalActionItemCount; IList <StoreId> list = ConversationActionItem.QueryConversationActionsFolder(session, conversationId, 10, out totalActionItemCount); mailboxData.UpdateConversationActionsEnabledStatus(totalActionItemCount); if (list == null || list.Count <= 1) { ActionsProcessor.Tracer.TraceDebug <object, int>(0L, "{0}: No duplicates found. Count = {1}", TraceContext.Get(), (list != null) ? list.Count : -1); return(false); } StoreId[] array = new StoreId[list.Count - 1]; bool result = false; for (int i = 1; i < list.Count; i++) { if (list[i].Equals(actionItem.Id)) { result = true; } array[i - 1] = list[i]; } ActionsProcessor.Tracer.TraceDebug <object, int>(0L, "{0}: Attempting to delete {1} duplicates...", TraceContext.Get(), array.Length); session.Delete(DeleteItemFlags.HardDelete, array); return(result); }