// Token: 0x06000B35 RID: 2869 RVA: 0x00048468 File Offset: 0x00046668 private void HandleJunkEmailOptionsEvent(MapiEvent mapiEvent, MailboxSession mailboxSession) { if (mapiEvent == null) { throw new ArgumentNullException("mapiEvent"); } if (mailboxSession == null) { throw new ArgumentNullException("mailboxSession"); } if (!JunkEmailOptionsAssistant.IsJunkEmailOptionsEvent(mapiEvent)) { JunkEmailOptionsAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Skipping uninteresting event."); return; } if (!JunkEmailOptionsAssistant.IsUserMailbox(mailboxSession)) { JunkEmailOptionsAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Skipping event: non-user mailbox."); return; } if (mailboxSession.MailboxOwner.MailboxInfo.IsArchive) { JunkEmailOptionsAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Skipping event: archive mailbox."); return; } if (mailboxSession.MailboxOwner.MailboxInfo.IsAggregated) { JunkEmailOptionsAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Skipping event: aggregated mailbox."); return; } if (JunkEmailOptionsAssistant.IsJunkRuleEvent(mapiEvent)) { try { MailboxTagging.TagForProcessing(mailboxSession); } catch (StoragePermanentException arg) { JunkEmailOptionsAssistant.Tracer.TraceError <string, Guid, StoragePermanentException>((long)this.GetHashCode(), "Failed at tagging mailbox {0} (GUID: {1}). Exception: {2}", mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxSession.MailboxGuid, arg); } return; } if (JunkEmailOptionsAssistant.IsMailboxMoveToThisDatabase(mapiEvent)) { MapiExceptionFilter.TryOperation(delegate() { JunkEmailOptionsAssistant.EnsureJunkEmailRule(mailboxSession, mapiEvent); }, (Exception exception, bool transient) => JunkEmailOptionsAssistant.LogFailedToEnsureJunkEmailRule(exception, transient, mailboxSession)); return; } if (JunkEmailOptionsAssistant.IsFolderCreationEvent(mapiEvent)) { MapiExceptionFilter.TryOperation(delegate() { JunkEmailOptionsAssistant.EnsureJunkEmailRule(mailboxSession, mapiEvent); }, (Exception exception, bool transient) => JunkEmailOptionsAssistant.LogFailedToEnsureJunkEmailRule(exception, transient, mailboxSession)); return; } JunkEmailOptionsAssistant.Tracer.TraceError((long)this.GetHashCode(), "HandleJunkEmailOptionsEvent was called under unexpected conditions"); }
// Token: 0x06000B31 RID: 2865 RVA: 0x00048204 File Offset: 0x00046404 private static void EnsureJunkEmailRule(MailboxSession session, MapiEvent mapiEvent) { if (session == null) { throw new ArgumentNullException("session"); } if (mapiEvent == null) { throw new ArgumentNullException("mapiEvent"); } if (!session.Capabilities.CanHaveJunkEmailRule) { JunkEmailOptionsAssistant.Tracer.TraceDebug <Guid>(0L, "Skipping mailbox {0} because it can't have a junk e-mail rule. Possibly an alternate mailbox.", session.MailboxOwner.MailboxInfo.MailboxGuid); return; } JunkEmailOptionsAssistant.Tracer.TraceDebug <Guid>(0L, "Ensuring junk e-mail rule for mailbox {0}", session.MailboxOwner.MailboxInfo.MailboxGuid); StoreObjectId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.Inbox); StoreObjectId defaultFolderId2 = session.GetDefaultFolderId(DefaultFolderType.JunkEmail); if (defaultFolderId == null || defaultFolderId2 == null) { JunkEmailOptionsAssistant.Tracer.TraceDebug <Guid>(0L, "Cannot create junk e-mail rule for mailbox {0} because either the inbox or junk e-mail folder does not exist.", session.MailboxOwner.MailboxInfo.MailboxGuid); return; } if (JunkEmailOptionsAssistant.IsFolderCreationEvent(mapiEvent) && !JunkEmailOptionsAssistant.IsInboxOrJunkFolder(mapiEvent.ItemEntryId, defaultFolderId, defaultFolderId2)) { JunkEmailOptionsAssistant.Tracer.TraceDebug(0L, "Created folder is not Inbox or Junk E-mail folder. Skipping uninteresting event."); return; } JunkEmailRule.JunkEmailStatus junkEmailRuleStatus = session.GetJunkEmailRuleStatus(); if (junkEmailRuleStatus != JunkEmailRule.JunkEmailStatus.None) { return; } JunkEmailOptionsAssistant.Tracer.TraceDebug <Guid>(0L, "Creating and enabling junk e-mail rule for mailbox {0}.", session.MailboxOwner.MailboxInfo.MailboxGuid); JunkEmailRule junkEmailRule = session.JunkEmailRule; junkEmailRule.IsEnabled = true; junkEmailRule.Save(); }
// Token: 0x06000B2C RID: 2860 RVA: 0x0004817D File Offset: 0x0004637D private static bool IsJunkEmailOptionsEvent(MapiEvent mapiEvent) { return(JunkEmailOptionsAssistant.IsJunkRuleEvent(mapiEvent) || JunkEmailOptionsAssistant.IsMailboxMoveSucceededEvent(mapiEvent) || JunkEmailOptionsAssistant.IsFolderCreationEvent(mapiEvent)); }