private ApprovalEngine.ApprovalProcessResults HandleInitiationMessage(InitiationMessage initiationMessage) { if (initiationMessage.IsMapiInitiator) { if (!this.sender.Equals(this.recipient)) { return(ApprovalEngine.ApprovalProcessResults.Invalid); } } else if (string.Equals("ModeratedTransport", initiationMessage.ApprovalInitiator, StringComparison.OrdinalIgnoreCase)) { this.messageItem[MessageItemSchema.ApprovalApplicationId] = 1; HeaderList headers = this.message.MimeDocument.RootPart.Headers; TextHeader textHeader = headers.FindFirst("X-MS-Exchange-Organization-Moderation-Data") as TextHeader; string value; if (textHeader != null && textHeader.TryGetValue(out value) && !string.IsNullOrEmpty(value)) { this.messageItem[MessageItemSchema.ApprovalApplicationData] = value; } this.StampModeratedTransportExpiry(); } if (initiationMessage.DecisionMakers == null) { return(ApprovalEngine.ApprovalProcessResults.Invalid); } if (InitiationProcessor.CheckDuplicateInitiationAndUpdateIdIfNecessary(this.messageItem)) { return(ApprovalEngine.ApprovalProcessResults.DuplicateInitiation); } InitiationProcessor initiationProcessor = new InitiationProcessor(this.mbxTransportMailItem, initiationMessage, this.messageItem, this.requestCreate, this.recipient); return(initiationProcessor.PrepareApprovalRequestData()); }
internal static bool Get2047CharsetName(TextHeader textHeader, out string charsetName) { DecodingOptions decodingOptions = new DecodingOptions(DecodingFlags.Rfc2047, null); DecodingResults decodingResults; string text; if (textHeader.TryGetValue(decodingOptions, out decodingResults, out text) && EncodingScheme.Rfc2047 == decodingResults.EncodingScheme) { charsetName = decodingResults.CharsetName; return(true); } charsetName = null; return(false); }
internal static string GetHeaderValue(Header header) { TextHeader textHeader = header as TextHeader; if (textHeader != null) { DecodingResults decodingResults; string result; textHeader.TryGetValue(Utility.DecodeOrFallBack, out decodingResults, out result); return(result); } if (header != null) { return(header.Value); } return(null); }
private bool TryGetHeaderValue(string headerName, out string value) { HeaderList headers = this.message.MimeDocument.RootPart.Headers; TextHeader textHeader = headers.FindFirst(headerName) as TextHeader; value = null; if (textHeader == null) { InitiationMessage.diag.TraceDebug <string>((long)this.GetHashCode(), "'{0}' header not found from message.", headerName); return(false); } if (!textHeader.TryGetValue(out value) || string.IsNullOrEmpty(value)) { InitiationMessage.diag.TraceDebug <string>((long)this.GetHashCode(), "'{0}' header cannot be read from message.", headerName); return(false); } return(true); }
private static string GetTextHeaderValue(MbxTransportMailItem rmi, string headerName) { TextHeader textHeader = rmi.RootPart.Headers.FindFirst(headerName) as TextHeader; if (textHeader == null) { ExTraceGlobals.DeliveryAgentTracer.TraceDebug <string>(rmi.RecordId, "Header not found: {0}", headerName); return(null); } DecodingResults decodingResults; string result; if (!textHeader.TryGetValue(DecodingOptions.None, out decodingResults, out result)) { ExTraceGlobals.DeliveryAgentTracer.TraceDebug <string>(rmi.RecordId, "Could not decode the header value for header: {0}", headerName); return(null); } return(result); }