// Token: 0x060022C1 RID: 8897 RVA: 0x000C69B8 File Offset: 0x000C4BB8 public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action) { if (owaContext == null) { throw new ArgumentNullException("owaContext"); } applicationElement = ApplicationElement.NotSet; type = string.Empty; action = string.Empty; state = string.Empty; Item item = null; Item item2 = null; Item item3 = null; bool flag = false; BodyFormat bodyFormat = BodyFormat.TextPlain; PreFormActionResponse result; try { HttpContext httpContext = owaContext.HttpContext; UserContext userContext = owaContext.UserContext; PreFormActionResponse preFormActionResponse = new PreFormActionResponse(httpContext.Request, new string[] { "cb", "smime" }); item = ReplyForwardUtilities.GetItemForRequest(owaContext, out item2); if (item != null && !ItemUtility.IsForwardSupported(item)) { throw new OwaInvalidRequestException("Forwarding of such a type item is not supported."); } CalendarItemBase calendarItemBase = item as CalendarItemBase; if (item is Task || item is ContactBase || (calendarItemBase != null && !calendarItemBase.IsMeeting)) { item3 = ReplyForwardUtilities.CreateForwardMessageWithItemAttached(item, userContext); preFormActionResponse.Action = "New"; preFormActionResponse.AddParameter("exdltdrft", "1"); } else { bool flag2 = false; string queryStringParameter = Utilities.GetQueryStringParameter(httpContext.Request, "smime", false); RightsManagedMessageDecryptionStatus decryptionStatus = RightsManagedMessageDecryptionStatus.FeatureDisabled; if (userContext.IsIrmEnabled) { try { flag = Utilities.IrmDecryptForReplyForward(owaContext, ref item, ref item2, ref bodyFormat, out decryptionStatus); } catch (RightsManagementPermanentException exception) { decryptionStatus = RightsManagedMessageDecryptionStatus.CreateFromException(exception); } } if (!flag) { bodyFormat = ReplyForwardUtilities.GetReplyForwardBodyFormat(item, userContext); } bool flag3 = Utilities.IsSMimeControlNeededForEditForm(queryStringParameter, owaContext); flag2 = ((flag3 && Utilities.IsSMime(item)) || flag); bool flag4 = userContext.IsSmsEnabled && ObjectClass.IsSmsMessage(owaContext.FormsRegistryContext.Type); ReplyForwardFlags replyForwardFlags = ReplyForwardFlags.None; if (flag2) { replyForwardFlags |= ReplyForwardFlags.DropBody; } if (flag4 || flag) { replyForwardFlags |= ReplyForwardFlags.DropHeader; } StoreObjectId parentFolderId = Utilities.GetParentFolderId(item2, item); item3 = ReplyForwardUtilities.CreateForwardItem(flag3 ? BodyFormat.TextHtml : bodyFormat, item, replyForwardFlags, userContext, parentFolderId); if (flag) { item3.AttachmentCollection.RemoveAll(); using (ItemAttachment itemAttachment = item3.AttachmentCollection.AddExistingItem(item)) { itemAttachment.Save(); goto IL_205; } } if (Utilities.IsIrmRestrictedAndNotDecrypted(item)) { ReplyForwardUtilities.SetAlternateIrmBody(item3, flag3 ? BodyFormat.TextHtml : bodyFormat, userContext, parentFolderId, decryptionStatus, ObjectClass.IsVoiceMessage(item.ClassName)); item3.AttachmentCollection.RemoveAll(); } IL_205: preFormActionResponse.Action = "Forward"; if (flag2) { preFormActionResponse.AddParameter("srcId", Utilities.GetItemIdQueryString(httpContext.Request)); if (Utilities.GetQueryStringParameter(httpContext.Request, "cb", false) == null && Utilities.IsWebBeaconsAllowed(item)) { preFormActionResponse.AddParameter("cb", "1"); } } if (flag4) { item3.ClassName = "IPM.Note.Mobile.SMS"; } } item3.Save(SaveMode.ResolveConflicts); item3.Load(); ReplyForwardUtilities.DeleteLevelOneAttachments(item3, userContext); preFormActionResponse.ApplicationElement = ApplicationElement.Item; preFormActionResponse.Type = item3.ClassName; preFormActionResponse.AddParameter("id", OwaStoreObjectId.CreateFromStoreObject(item3).ToBase64String()); if (userContext.IsInOtherMailbox(item)) { preFormActionResponse.AddParameter("fOMF", "1"); } if (flag) { preFormActionResponse.AddParameter("fIrmAsAttach", "1"); } result = preFormActionResponse; } finally { if (item != null) { item.Dispose(); item = null; } if (item2 != null) { item2.Dispose(); item2 = null; } if (item3 != null) { item3.Dispose(); item3 = null; } } return(result); }
public static Item CreateForwardItem(BodyFormat bodyFormat, Item item, ReplyForwardFlags flags, UserContext userContext, StoreObjectId parentFolderId) { if (bodyFormat < (BodyFormat)0) { throw new ArgumentOutOfRangeException("bodyFormat", bodyFormat, "bodyFormat has an invalid value"); } if (item == null) { throw new ArgumentNullException("item"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } MessageItem messageItem = null; bool flag = true; try { string text = string.Empty; if (!Utilities.IsFlagSet((int)flags, 2)) { text = ReplyForwardUtilities.CreateReplyForwardHeader(bodyFormat, item, userContext, parentFolderId); } ReplyForwardConfiguration replyForwardConfiguration = new ReplyForwardConfiguration(bodyFormat); replyForwardConfiguration.ConversionOptionsForSmime = Utilities.CreateInboundConversionOptions(userContext); replyForwardConfiguration.AddBodyPrefix(text); MessageItem messageItem2; CalendarItemBase calendarItemBase; if ((messageItem2 = (item as MessageItem)) != null) { messageItem = messageItem2.CreateForward(userContext.MailboxSession, userContext.DraftsFolderId, replyForwardConfiguration); if (!(messageItem2 is MeetingMessage)) { ReplyForwardUtilities.CopyMessageClassificationProperties(item, messageItem, userContext); } ReplyForwardUtilities.SmartReplyOrForward(messageItem2, messageItem, userContext); } else if ((calendarItemBase = (item as CalendarItemBase)) != null) { messageItem = calendarItemBase.CreateForward(userContext.MailboxSession, userContext.DraftsFolderId, replyForwardConfiguration, null, null); } else { PostItem postItem; if ((postItem = (item as PostItem)) == null) { throw new ArgumentException("HTML reply forward headers can only be created for MessageItem or CalendarItemBase or PostItem. "); } messageItem = postItem.CreateForward(userContext.MailboxSession, userContext.DraftsFolderId, replyForwardConfiguration); } if (Globals.ArePerfCountersEnabled) { OwaSingleCounters.ItemsCreated.Increment(); } if (Utilities.IsFlagSet((int)flags, 1)) { ItemUtility.SetItemBody(messageItem, bodyFormat, text); } flag = false; } finally { if (flag && messageItem != null) { messageItem.Dispose(); messageItem = null; } } return(messageItem); }
public static Item CreateReplyAllItem(BodyFormat bodyFormat, Item item, ReplyForwardFlags flags, UserContext userContext, StoreObjectId parentFolderId) { return(ReplyForwardUtilities.CreateReplyOrReplyAllItem(bodyFormat, item, flags, true, userContext, parentFolderId)); }
private static Item CreateReplyOrReplyAllItem(BodyFormat bodyFormat, Item item, ReplyForwardFlags flags, bool replyAll, UserContext userContext, StoreObjectId parentFolderId) { if (bodyFormat < (BodyFormat)0) { throw new ArgumentOutOfRangeException("bodyFormat", bodyFormat, "bodyFormat has an invalid value"); } if (item == null) { throw new ArgumentNullException("item"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } MessageItem messageItem = null; bool flag = true; try { bool flag2 = true; string text = string.Empty; if (!Utilities.IsFlagSet((int)flags, 2)) { text = ReplyForwardUtilities.CreateReplyForwardHeader(bodyFormat, item, userContext, parentFolderId); } ReplyForwardConfiguration replyForwardConfiguration = new ReplyForwardConfiguration(bodyFormat); replyForwardConfiguration.ConversionOptionsForSmime = Utilities.CreateInboundConversionOptions(userContext); replyForwardConfiguration.AddBodyPrefix(text); MessageItem messageItem2; CalendarItemBase calendarItemBase; PostItem postItem; if ((messageItem2 = (item as MessageItem)) != null) { if (replyAll) { messageItem = messageItem2.CreateReplyAll(userContext.MailboxSession, userContext.DraftsFolderId, replyForwardConfiguration); } else { messageItem = messageItem2.CreateReply(userContext.MailboxSession, userContext.DraftsFolderId, replyForwardConfiguration); } ReplyForwardUtilities.SmartReplyOrForward(messageItem2, messageItem, userContext); ReplyForwardUtilities.CopyMessageClassificationProperties(item, messageItem, userContext); } else if ((calendarItemBase = (item as CalendarItemBase)) != null) { if (calendarItemBase.IsMeeting) { if (replyAll) { messageItem = calendarItemBase.CreateReplyAll(userContext.MailboxSession, userContext.DraftsFolderId, replyForwardConfiguration); } else { messageItem = calendarItemBase.CreateReply(userContext.MailboxSession, userContext.DraftsFolderId, replyForwardConfiguration); } } else { flag2 = false; } } else if ((postItem = (item as PostItem)) != null) { if (replyAll) { messageItem = postItem.CreateReplyAll(userContext.MailboxSession, userContext.DraftsFolderId, replyForwardConfiguration); } else { messageItem = postItem.CreateReply(userContext.MailboxSession, userContext.DraftsFolderId, replyForwardConfiguration); } } else { flag2 = false; } if (!flag2) { throw new OwaOperationNotSupportedException(LocalizedStrings.GetNonEncoded(293574673)); } if (Globals.ArePerfCountersEnabled) { OwaSingleCounters.ItemsCreated.Increment(); } if (Utilities.IsFlagSet((int)flags, 1)) { ItemUtility.SetItemBody(messageItem, bodyFormat, text); } flag = false; } catch (NotSupportedException ex) { ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "Unable to create a Reply or ReplyAll item. Exception {0}", ex.Message); throw new OwaInvalidRequestException("Unable to create a Reply or ReplyAll item."); } finally { if (flag && messageItem != null) { messageItem.Dispose(); messageItem = null; } } return(messageItem); }
public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action) { if (owaContext == null) { throw new ArgumentNullException("owaContext"); } applicationElement = ApplicationElement.NotSet; type = string.Empty; action = string.Empty; state = string.Empty; Item item = null; Item item2 = null; Item item3 = null; bool flag = false; BodyFormat bodyFormat = BodyFormat.TextPlain; PreFormActionResponse result; try { HttpContext httpContext = owaContext.HttpContext; UserContext userContext = owaContext.UserContext; item = ReplyForwardUtilities.GetItemForRequest(owaContext, out item2); RightsManagedMessageDecryptionStatus decryptionStatus = RightsManagedMessageDecryptionStatus.FeatureDisabled; if (userContext.IsIrmEnabled) { try { flag = Utilities.IrmDecryptForReplyForward(owaContext, ref item, ref item2, ref bodyFormat, out decryptionStatus); } catch (RightsManagementPermanentException exception) { decryptionStatus = RightsManagedMessageDecryptionStatus.CreateFromException(exception); } } if (!flag) { bodyFormat = ReplyForwardUtilities.GetReplyForwardBodyFormat(item, userContext); } string queryStringParameter = Utilities.GetQueryStringParameter(httpContext.Request, "smime", false); bool flag2 = Utilities.IsSMimeControlNeededForEditForm(queryStringParameter, owaContext); bool flag3 = userContext.IsSmsEnabled && ObjectClass.IsSmsMessage(owaContext.FormsRegistryContext.Type); bool flag4 = ObjectClass.IsMeetingRequest(owaContext.FormsRegistryContext.Type); bool flag5 = flag3 || (flag2 && Utilities.IsSMime(item)) || flag; ReplyForwardFlags replyForwardFlags = ReplyForwardFlags.None; if (flag5) { replyForwardFlags |= ReplyForwardFlags.DropBody; } if (flag3 || flag) { replyForwardFlags |= ReplyForwardFlags.DropHeader; } StoreObjectId parentFolderId = Utilities.GetParentFolderId(item2, item); item3 = ReplyForwardUtilities.CreateReplyAllItem(flag2 ? BodyFormat.TextHtml : bodyFormat, item, replyForwardFlags, userContext, parentFolderId); if (flag) { using (ItemAttachment itemAttachment = item3.AttachmentCollection.AddExistingItem(item)) { itemAttachment.Save(); goto IL_172; } } if (Utilities.IsIrmRestrictedAndNotDecrypted(item)) { ReplyForwardUtilities.SetAlternateIrmBody(item3, flag2 ? BodyFormat.TextHtml : bodyFormat, userContext, parentFolderId, decryptionStatus, ObjectClass.IsVoiceMessage(item.ClassName)); } IL_172: type = "IPM.Note"; if (flag3) { item3.ClassName = "IPM.Note.Mobile.SMS"; type = "IPM.Note.Mobile.SMS"; ReplyForwardUtilities.RemoveInvalidRecipientsFromSmsMessage((MessageItem)item3); } item3.Save(SaveMode.ResolveConflicts); item3.Load(); PreFormActionResponse preFormActionResponse = new PreFormActionResponse(httpContext.Request, new string[] { "cb", "smime" }); preFormActionResponse.ApplicationElement = ApplicationElement.Item; preFormActionResponse.Type = type; preFormActionResponse.Action = "Reply"; preFormActionResponse.AddParameter("id", OwaStoreObjectId.CreateFromStoreObject(item3).ToBase64String()); if (flag5) { preFormActionResponse.AddParameter("srcId", Utilities.GetItemIdQueryString(httpContext.Request)); if (Utilities.GetQueryStringParameter(httpContext.Request, "cb", false) == null && Utilities.IsWebBeaconsAllowed(item)) { preFormActionResponse.AddParameter("cb", "1"); } } if (userContext.IsInOtherMailbox(item)) { preFormActionResponse.AddParameter("fOMF", "1"); } if (item.GetValueOrDefault <bool>(MessageItemSchema.MessageBccMe) && !flag4) { preFormActionResponse.AddParameter("fRABcc", "1"); } if (flag) { preFormActionResponse.AddParameter("fIrmAsAttach", "1"); } result = preFormActionResponse; } finally { if (item != null) { item.Dispose(); item = null; } if (item2 != null) { item2.Dispose(); item2 = null; } if (item3 != null) { item3.Dispose(); item3 = null; } } return(result); }