Esempio n. 1
0
 // 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");
 }
Esempio n. 2
0
        // Token: 0x06000B47 RID: 2887 RVA: 0x000487EC File Offset: 0x000469EC
        protected override void InvokeInternal(InvokeArgs invokeArgs, List <KeyValuePair <string, object> > customDataToLog)
        {
            MailboxSession mailboxSession = invokeArgs.StoreSession as MailboxSession;

            if (mailboxSession == null)
            {
                JunkEmailOptionsCommiterAssistant.Tracer.TraceError((long)this.GetHashCode(), "invokeArgs.StoreSession has to be an MailboxSession; it cannot be be null or PublicFolderSession.");
                throw new ArgumentNullException("mailboxSession");
            }
            Guid mailboxGuid = mailboxSession.MailboxOwner.MailboxInfo.MailboxGuid;

            if (!mailboxSession.Capabilities.CanHaveJunkEmailRule)
            {
                JunkEmailOptionsCommiterAssistant.Tracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "Skipping mailbox {0} (GUID: {1}) because it cannot have a junk e-mail rule.  Possibly an alternate mailbox.", mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxGuid);
                try
                {
                    MailboxTagging.TagFinishedProcessing(mailboxSession);
                }
                catch (StoragePermanentException arg)
                {
                    JunkEmailOptionsCommiterAssistant.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;
            }
            try
            {
                JunkEmailOptionsCommiterAssistant.Tracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "Updating safe/block lists of mailbox {0} (GUID: {1})", mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxGuid);
                this.UpdateSafeLists(mailboxSession);
                JunkEmailOptionsCommiterAssistant.Tracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "Update of mailbox {0} (GUID: {1}) was successful", mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxGuid);
                try
                {
                    MailboxTagging.TagFinishedProcessing(mailboxSession);
                }
                catch (StoragePermanentException arg2)
                {
                    JunkEmailOptionsCommiterAssistant.Tracer.TraceError <string, Guid, StoragePermanentException>((long)this.GetHashCode(), "Failed at tagging mailbox {0} (GUID: {1}).  Exception: {2}", mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxSession.MailboxGuid, arg2);
                }
            }
            catch (TransientException exception)
            {
                this.HandleExceptionAtUpdatingSafeList(exception, true, mailboxSession);
            }
            catch (JunkEmailValidationException exception2)
            {
                this.HandleExceptionAtUpdatingSafeList(exception2, false, mailboxSession);
            }
            catch (DataSourceOperationException exception3)
            {
                this.HandleExceptionAtUpdatingSafeList(exception3, false, mailboxSession);
            }
            catch (StoragePermanentException exception4)
            {
                this.HandleExceptionAtUpdatingSafeList(exception4, false, mailboxSession);
            }
            catch (DataValidationException exception5)
            {
                this.HandleExceptionAtUpdatingSafeList(exception5, false, mailboxSession);
            }
        }
Esempio n. 3
0
 // Token: 0x06000B49 RID: 2889 RVA: 0x00048A0C File Offset: 0x00046C0C
 private void HandleExceptionAtUpdatingSafeList(Exception exception, bool transient, MailboxSession mailboxSession)
 {
     JunkEmailOptionsCommiterAssistant.Tracer.TraceError <string, Guid, Exception>((long)this.GetHashCode(), "Update of mailbox {0} (GUID: {1}) failed with an exception: {2}", mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxSession.MailboxGuid, exception);
     this.skippedMailboxes.Add(mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxSession.MailboxGuid);
     try
     {
         if (transient)
         {
             MailboxTagging.TagForRetry(mailboxSession);
         }
         else
         {
             MailboxTagging.TagFinishedProcessing(mailboxSession);
         }
     }
     catch (StoragePermanentException arg)
     {
         JunkEmailOptionsCommiterAssistant.Tracer.TraceError <string, Guid, StoragePermanentException>((long)this.GetHashCode(), "Failed at tagging mailbox {0} (GUID: {1}).  Exception: {2}", mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxSession.MailboxGuid, arg);
     }
     throw new SkipException(exception);
 }