示例#1
0
        private static bool IsBulkMail(StoreDriverDeliveryEventArgsImpl argsImpl, MiniRecipient recipient)
        {
            bool   result = false;
            string name   = InferenceXsoUtil.IsMicrosoft(recipient) ? "X-Forefront-Antispam-Report-Untrusted" : "X-MS-Exchange-Organization-Antispam-Report";
            Header header = argsImpl.MailItem.Message.MimeDocument.RootPart.Headers.FindFirst(name);
            string data;

            if (header != null && header.TryGetValue(out data))
            {
                result = InferenceCommonUtility.MatchBulkHeader(data);
            }
            return(result);
        }
示例#2
0
        private static OriginalDeliveryFolderInfo GetOriginalDeliveryFolderInfo(StoreDriverDeliveryEventArgsImpl argsImpl)
        {
            StoreObjectId storeObjectId = argsImpl.MailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox);

            if (argsImpl.DeliverToFolder != null)
            {
                StoreObjectId storeObjectId2 = StoreId.GetStoreObjectId(argsImpl.DeliverToFolder);
                if (storeObjectId2 != null && storeObjectId2.ProviderLevelItemId != null)
                {
                    storeObjectId = storeObjectId2;
                }
            }
            return(InferenceXsoUtil.GetOriginalDeliveryFolderInfo(argsImpl.MailboxSession, storeObjectId));
        }
        // Token: 0x0600118E RID: 4494 RVA: 0x000668D4 File Offset: 0x00064AD4
        public override AssistantTaskContext InitialStep(AssistantTaskContext context)
        {
            DateTime             utcNow    = DateTime.UtcNow;
            DateTime?            dateTime  = null;
            DateTime?            dateTime2 = null;
            DateTime?            dateTime3 = null;
            DateTime?            dateTime4 = null;
            Guid                 guid      = Guid.Empty;
            AssistantTaskContext result;

            try
            {
                this.ValidateContext(context);
                guid = context.Args.StoreSession.MailboxGuid;
                ExDateTime?valueOrDefault = context.Args.StoreSession.Mailbox.GetValueOrDefault <ExDateTime?>(MailboxSchema.InferenceTrainingLastAttemptTimestamp, null);
                if (valueOrDefault != null)
                {
                    dateTime = new DateTime?(valueOrDefault.Value.UniversalTime);
                }
                valueOrDefault = context.Args.StoreSession.Mailbox.GetValueOrDefault <ExDateTime?>(MailboxSchema.InferenceTrainingLastSuccessTimestamp, null);
                if (valueOrDefault != null)
                {
                    dateTime2 = new DateTime?(valueOrDefault.Value.UniversalTime);
                }
                valueOrDefault = context.Args.StoreSession.Mailbox.GetValueOrDefault <ExDateTime?>(MailboxSchema.InferenceTruthLoggingLastAttemptTimestamp, null);
                if (valueOrDefault != null)
                {
                    dateTime3 = new DateTime?(valueOrDefault.Value.UniversalTime);
                }
                valueOrDefault = context.Args.StoreSession.Mailbox.GetValueOrDefault <ExDateTime?>(MailboxSchema.InferenceTruthLoggingLastSuccessTimestamp, null);
                if (valueOrDefault != null)
                {
                    dateTime4 = new DateTime?(valueOrDefault.Value.UniversalTime);
                }
                MailboxSession mailboxSession = context.Args.StoreSession as MailboxSession;
                if (mailboxSession == null)
                {
                    string text = "Reason=NonMailboxSession";
                    this.trainingStatusLogger.LogStatus(guid, 4, new DateTime?(utcNow), dateTime, dateTime2, text);
                    this.truthLabelsStatusLogger.LogStatus(mailboxSession.MailboxGuid, 4, new DateTime?(utcNow), dateTime3, dateTime4, text);
                    this.groupingModelTrainingStatusLogger.LogStatus(guid, 4, text);
                    result = null;
                }
                else if (mailboxSession.MailboxOwner.RecipientTypeDetails != RecipientTypeDetails.UserMailbox && mailboxSession.MailboxOwner.RecipientTypeDetails != RecipientTypeDetails.LinkedMailbox)
                {
                    string text2 = string.Format("Reason=NonUserMailbox#Name={0}#Type={1}", mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxSession.MailboxOwner.RecipientTypeDetails.ToString());
                    this.trainingStatusLogger.LogStatus(mailboxSession.MailboxGuid, 4, new DateTime?(utcNow), dateTime, dateTime2, text2);
                    this.truthLabelsStatusLogger.LogStatus(mailboxSession.MailboxGuid, 4, new DateTime?(utcNow), dateTime3, dateTime4, text2);
                    this.groupingModelTrainingStatusLogger.LogStatus(mailboxSession.MailboxGuid, 4, text2);
                    result = null;
                }
                else
                {
                    VariantConfigurationSnapshot flightFeatures = FlightModule.GetFlightFeatures(mailboxSession);
                    Exception           ex;
                    OrganizationContext organizationInformation = this.orgContentExtractor.GetOrganizationInformation(mailboxSession.MailboxOwner, new ADRecipientInfo.TraceDelegate(this.DiagnosticsSession.TraceDebug), new ADRecipientInfo.TraceDelegate(this.DiagnosticsSession.TraceError), ref ex);
                    FolderDataSelectionConfig.RefreshSettings();
                    List <Exception> list = new List <Exception>();
                    if (ex != null)
                    {
                        list.Add(ex);
                    }
                    OutlookActivityManager.SafeProcess(mailboxSession);
                    ActivityHistory      activityHistory      = new ActivityHistory(mailboxSession, utcNow);
                    ModelVersionSelector modelVersionSelector = InferenceXsoUtil.CreateModelVersionSelector(ServerModelConfigurationWrapper.CurrentWrapper, mailboxSession, delegate(string str)
                    {
                        this.DiagnosticsSession.TraceDebug(str, new object[0]);
                    });
                    result = new InferenceTrainingTaskContext(context.MailboxData, context.Job, new AssistantStep(this.TrainStep), new MailboxTrainingState(modelVersionSelector, organizationInformation, activityHistory, utcNow, dateTime, dateTime2, flightFeatures, list), new MailboxTruthLoggingState(utcNow, dateTime3, dateTime4, activityHistory));
                }
            }
            catch (Exception ex2)
            {
                string text3 = string.Format("Reason=InitialStepFailed#Exception={0}", InferenceCommonUtility.StringizeException(ex2));
                this.trainingStatusLogger.LogStatus(guid, 3, new DateTime?(utcNow), dateTime, dateTime2, text3);
                this.truthLabelsStatusLogger.LogStatus(guid, 3, new DateTime?(utcNow), dateTime3, dateTime4, text3);
                this.groupingModelTrainingStatusLogger.LogStatus(guid, 3, text3);
                throw;
            }
            return(result);
        }