public ApprovalEngine.ApprovalProcessResults Process() { MailboxSession mailboxSession = (MailboxSession)this.messageItem.Session; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox); VersionedId correlatedItem = this.messageItem.VotingInfo.GetCorrelatedItem(defaultFolderId); stopwatch.Stop(); long elapsedMilliseconds = stopwatch.ElapsedMilliseconds; if (correlatedItem == null) { DecisionHandler.diag.TraceDebug((long)this.GetHashCode(), "Initiation message not found"); return(new ApprovalEngine.ApprovalProcessResults(ApprovalEngine.ProcessResult.InitiationNotFoundForDecision, elapsedMilliseconds)); } string existingDecisionMakerAddress; ApprovalStatus? existingApprovalStatus; ExDateTime? existingDecisionTime; DecisionConflict conflict; if (DecisionHandler.ApproveTextList.Contains(this.messageItem.VotingInfo.Response)) { conflict = ApprovalProcessor.ApproveRequest(mailboxSession, correlatedItem.ObjectId, (SmtpAddress)this.sender, this.messageItem.Body, out existingDecisionMakerAddress, out existingApprovalStatus, out existingDecisionTime); } else { conflict = ApprovalProcessor.RejectRequest(mailboxSession, correlatedItem.ObjectId, (SmtpAddress)this.sender, this.messageItem.Body, out existingDecisionMakerAddress, out existingApprovalStatus, out existingDecisionTime); } return(DecisionHandler.GetApprovalProcessResults(conflict, existingDecisionMakerAddress, existingApprovalStatus, existingDecisionTime, elapsedMilliseconds)); }
public static bool TryCreate(MessageItem messageItem, string sender, OrganizationId organizationId, out DecisionHandler decisionHandler) { decisionHandler = null; MessageItem messageItem2; bool flag; if (!DecisionHandler.IsDecision(messageItem, out messageItem2, out flag)) { return(false); } decisionHandler = new DecisionHandler(messageItem2, sender, flag); return(true); }
public ApprovalEngine.ApprovalProcessResults ProcessMessage() { if (!MultilevelAuth.IsInternalMail(this.message)) { return(ApprovalEngine.ApprovalProcessResults.Invalid); } DecisionHandler decisionHandler = null; ApprovalEngine.ApprovalProcessResults result; try { InitiationMessage initiationMessage; NdrOofHandler ndrOofHandler; if (InitiationMessage.TryCreate(this.message, out initiationMessage)) { result = this.HandleInitiationMessage(initiationMessage); } else if (DecisionHandler.TryCreate(this.messageItem, this.sender.ToString(), this.mbxTransportMailItem.OrganizationId, out decisionHandler)) { ApprovalEngine.ApprovalProcessResults approvalProcessResults = decisionHandler.Process(); result = approvalProcessResults; } else if (NdrOofHandler.TryCreate(this.messageItem, out ndrOofHandler)) { result = ndrOofHandler.Process(); } else { result = ApprovalEngine.ApprovalProcessResults.Invalid; } } finally { if (decisionHandler != null) { decisionHandler.Dispose(); } } return(result); }