// Token: 0x06002FC3 RID: 12227 RVA: 0x00115F1C File Offset: 0x0011411C
 public static bool RenderMeetingPlainTextBody(TextWriter output, Item item, UserContext userContext, bool doSignature)
 {
     if (output == null)
     {
         throw new ArgumentNullException("output");
     }
     if (userContext == null)
     {
         throw new ArgumentNullException("userContext");
     }
     if (item == null)
     {
         return(false);
     }
     if (item.Body == null)
     {
         return(false);
     }
     if (item.Body.Size > 0L)
     {
         BodyConversionUtilities.ConvertAndOutputBody(output, item.Body, Markup.PlainText, null);
         return(true);
     }
     if (doSignature && userContext.UserOptions.AutoAddSignature && userContext.IsFeatureEnabled(Feature.Signature))
     {
         output.Write("\n\n\n");
         Utilities.HtmlEncode(userContext.UserOptions.SignatureText, output);
     }
     return(false);
 }
        // Token: 0x06002FBF RID: 12223 RVA: 0x00115BA4 File Offset: 0x00113DA4
        public static void GeneratePrintMessageBody(Item item, TextWriter writer, OwaContext owaContext, bool isEmbeddedItem, string embeddedItemUrl, bool forceAllowWebBeacon, bool forceEnableItemLink)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("context");
            }
            UserContext           userContext = owaContext.UserContext;
            WebBeaconFilterLevels filterWebBeaconsAndHtmlForms = userContext.Configuration.FilterWebBeaconsAndHtmlForms;
            bool flag = JunkEmailUtilities.IsJunkOrPhishing(item, isEmbeddedItem, forceEnableItemLink, userContext);
            OwaSafeHtmlCallbackBase callBack;

            if (!flag)
            {
                if (filterWebBeaconsAndHtmlForms == WebBeaconFilterLevels.DisableFilter || forceAllowWebBeacon || (!Utilities.IsPublic(item) && Utilities.IsWebBeaconsAllowed(item)))
                {
                    callBack = new OwaSafeHtmlAllowWebBeaconCallbacks(item, userContext.IsPublicLogon, isEmbeddedItem, embeddedItemUrl, owaContext, false);
                }
                else
                {
                    callBack = new OwaSafeHtmlOutboundCallbacks(item, userContext.IsPublicLogon, isEmbeddedItem, embeddedItemUrl, false, owaContext, false);
                }
            }
            else
            {
                callBack = new OwaSafeHtmlOutboundCallbacks(item, userContext.IsPublicLogon, isEmbeddedItem, embeddedItemUrl, true, owaContext, false);
            }
            BodyConversionUtilities.RenderReadBody(writer, item, callBack, flag);
        }
        // Token: 0x06002FC1 RID: 12225 RVA: 0x00115CE8 File Offset: 0x00113EE8
        internal static void ConvertAndOutputBody(TextWriter output, Body body, Markup markup, OwaSafeHtmlCallbackBase callBack)
        {
            try
            {
                BodyReadConfiguration bodyReadConfiguration = null;
                switch (markup)
                {
                case Markup.Html:
                    bodyReadConfiguration = new BodyReadConfiguration(BodyFormat.TextHtml, "utf-8");
                    bodyReadConfiguration.SetHtmlOptions(HtmlStreamingFlags.FilterHtml, callBack);
                    break;

                case Markup.PlainText:
                    bodyReadConfiguration = new BodyReadConfiguration(BodyFormat.TextPlain, "utf-8");
                    break;
                }
                if (bodyReadConfiguration != null)
                {
                    using (TextReader textReader = body.OpenTextReader(bodyReadConfiguration))
                    {
                        BodyConversionUtilities.HtmlEncodeAndOutputBody(output, textReader);
                    }
                }
            }
            catch (InvalidCharsetException innerException)
            {
                throw new OwaBodyConversionFailedException("Body Conversion Failed", innerException);
            }
            catch (ConversionFailedException innerException2)
            {
                throw new OwaBodyConversionFailedException("Body Conversion Failed", innerException2);
            }
        }
Exemple #4
0
        protected void LoadMessageBodyIntoStream(TextWriter writer)
        {
            bool flag = BodyConversionUtilities.GenerateEditableMessageBodyAndRenderInfobarMessages(this.calendarItemBase, writer, this.newItemType, base.OwaContext, ref this.shouldPromptUserForUnblockingOnFormLoad, ref this.hasInlineImages, this.infobar, base.IsRequestCallbackForWebBeacons, this.bodyMarkup);

            if (flag)
            {
                this.calendarItemBase.Load();
            }
        }
Exemple #5
0
 protected void LoadMessageBodyIntoStream(TextWriter writer)
 {
     if (this.IsRestrictedButIrmFeatureDisabledOrDecryptionFailed)
     {
         this.RenderAlternateBodyForIrm(writer);
         return;
     }
     BodyConversionUtilities.GeneratePrintMessageBody(this.message, writer, base.OwaContext, base.IsEmbeddedItem, base.IsEmbeddedItem ? base.RenderEmbeddedUrl() : null, base.ForceAllowWebBeacon, base.ForceEnableItemLink);
 }
Exemple #6
0
        private void UpdateBody(MessageItem message, StoreObjectType storeObjectType)
        {
            string text      = (string)base.GetParameter("Body");
            object parameter = base.GetParameter("Text");

            if (text != null && parameter != null)
            {
                Markup markup = ((bool)parameter) ? Markup.PlainText : Markup.Html;
                BodyConversionUtilities.SetBody(message, text, markup, storeObjectType, base.UserContext);
            }
        }
Exemple #7
0
        // Token: 0x0600291A RID: 10522 RVA: 0x000E8D30 File Offset: 0x000E6F30
        protected virtual void LoadMessageBodyIntoStream(TextWriter writer)
        {
            string action        = base.IsPreviewForm ? "Preview" : string.Empty;
            string attachmentUrl = null;

            if (base.IsEmbeddedItemInNonSMimeItem)
            {
                attachmentUrl = base.RenderEmbeddedUrl();
            }
            base.AttachmentLinks = BodyConversionUtilities.GenerateNonEditableMessageBodyAndRenderInfobarMessages(base.Item, writer, base.OwaContext, this.meetingPageWriter.FormInfobar, base.ForceAllowWebBeacon, base.ForceEnableItemLink, base.Item.ClassName, action, string.Empty, base.IsEmbeddedItemInNonSMimeItem, attachmentUrl);
        }
Exemple #8
0
        public void Save()
        {
            bool flag = base.IsParameterSet("Id");

            using (DistributionList distributionList = this.GetDistributionList(new PropertyDefinition[0]))
            {
                if (base.IsParameterSet("dn"))
                {
                    string text = ((string)base.GetParameter("dn")).Trim();
                    if (text.Length > 256)
                    {
                        text = text.Substring(0, 256);
                    }
                    if (!string.Equals(distributionList.DisplayName, text))
                    {
                        distributionList.DisplayName = text;
                    }
                }
                if (base.IsParameterSet("notes"))
                {
                    string text2 = (string)base.GetParameter("notes");
                    if (text2 != null)
                    {
                        BodyConversionUtilities.SetBody(distributionList, text2, Markup.PlainText, base.UserContext);
                    }
                }
                distributionList.Clear();
                RecipientInfo[] array = (RecipientInfo[])base.GetParameter("Itms");
                EditDistributionListEventHandler.AddMembersToDL(distributionList, array, this.CheckDuplicateItems(array));
                Utilities.SaveItem(distributionList, flag);
                distributionList.Load();
                if (!flag)
                {
                    this.Writer.Write("<div id=itemId>");
                    this.Writer.Write(Utilities.GetIdAsString(distributionList));
                    this.Writer.Write("</div>");
                }
                this.Writer.Write("<div id=ck>");
                this.Writer.Write(distributionList.Id.ChangeKeyAsBase64String());
                this.Writer.Write("</div>");
                string text3 = EditDistributionListEventHandler.GetTextPropertyValue(distributionList, ContactBaseSchema.FileAs);
                if (string.IsNullOrEmpty(text3))
                {
                    text3 = LocalizedStrings.GetNonEncoded(-1576800949);
                }
                this.Writer.Write("<div id=fa>");
                Utilities.HtmlEncode(text3, this.Writer);
                this.Writer.Write("</div>");
                base.MoveItemToDestinationFolderIfInScratchPad(distributionList);
            }
        }
        // Token: 0x06002AE0 RID: 10976 RVA: 0x000F198C File Offset: 0x000EFB8C
        protected void LoadMessageBodyIntoStream(TextWriter writer)
        {
            if (this.IrmItemHelper != null && this.IrmItemHelper.IsRestrictedButIrmFeatureDisabledOrDecryptionFailed)
            {
                this.IrmItemHelper.RenderAlternateBodyForIrm(writer, false);
                return;
            }
            string action        = base.IsPreviewForm ? "Preview" : string.Empty;
            string attachmentUrl = null;

            if (base.IsEmbeddedItemInNonSMimeItem)
            {
                attachmentUrl = base.RenderEmbeddedUrl();
            }
            base.AttachmentLinks = BodyConversionUtilities.GenerateNonEditableMessageBodyAndRenderInfobarMessages(this.Message, writer, base.OwaContext, this.infobar, base.ForceAllowWebBeacon, base.ForceEnableItemLink, this.Message.ClassName, action, string.Empty, base.IsEmbeddedItemInNonSMimeItem, attachmentUrl);
        }
        // Token: 0x06002FC4 RID: 12228 RVA: 0x00115FB0 File Offset: 0x001141B0
        private static void RenderComposeBody(TextWriter output, Item item, OwaSafeHtmlCallbackBase callBack, UserContext userContext, Markup markup)
        {
            if (item == null)
            {
                return;
            }
            Body body = item.Body;

            if (OwaContext.Current.UserContext.IsIrmEnabled && Utilities.IsIrmRestrictedAndDecrypted(item))
            {
                body = ((RightsManagedMessageItem)item).ProtectedBody;
            }
            if (body != null && body.Size > 0L)
            {
                BodyConversionUtilities.ConvertAndOutputBody(output, body, markup, callBack);
            }
        }
Exemple #11
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.post = base.Initialize <PostItem>(false, new PropertyDefinition[0]);
            Importance importance;

            if (this.post != null)
            {
                base.DeleteExistingDraft = true;
                this.newItemType         = NewItemType.PostReply;
                importance = this.post.Importance;
            }
            else
            {
                base.DeleteExistingDraft = false;
                this.newItemType         = NewItemType.New;
                importance = Importance.Normal;
            }
            this.bodyMarkup         = BodyConversionUtilities.GetBodyFormatOfEditItem(base.Item, this.newItemType, base.UserContext.UserOptions);
            this.addSignatureToBody = base.ShouldAddSignatureToBody(this.bodyMarkup, this.newItemType);
            this.toolbar            = new EditPostToolbar(importance, this.bodyMarkup);
        }
        public void ReportPerformanceExperience()
        {
            base.ResponseContentType = OwaEventContentType.Javascript;
            string      text        = (string)base.GetParameter("s");
            MessageItem messageItem = MessageItem.Create(base.UserContext.MailboxSession, base.UserContext.DraftsFolderId);

            messageItem[ItemSchema.ConversationIndexTracking] = true;
            Markup markup = Markup.Html;

            BodyConversionUtilities.SetBody(messageItem, (string)base.GetParameter("b"), markup, StoreObjectType.Message, base.UserContext);
            messageItem.Recipients.Add(new Participant(null, Globals.ErrorReportAddress, "SMTP"), RecipientItemType.To);
            messageItem.Subject = string.Concat(new string[]
            {
                "Performance Report on ",
                DateTime.UtcNow.ToLocalTime().ToShortDateString(),
                " ",
                DateTime.UtcNow.ToLocalTime().ToShortTimeString(),
                " for ",
                base.OwaContext.UserContext.ExchangePrincipal.MailboxInfo.DisplayName
            });
            messageItem.Save(SaveMode.ResolveConflicts);
            messageItem.Load();
            this.Writer.Write(messageItem.Id.ObjectId.ToBase64String());
        }
Exemple #13
0
        public void Post()
        {
            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "EditPostEventHandler.Post");
            PostItem postItem = null;
            bool     flag     = base.IsParameterSet("Id");

            try
            {
                OwaStoreObjectId owaStoreObjectId = base.GetParameter("fId") as OwaStoreObjectId;
                if (owaStoreObjectId == null)
                {
                    throw new OwaInvalidRequestException("FolderID can not be null. ");
                }
                if (flag)
                {
                    postItem = base.GetRequestItem <PostItem>(new PropertyDefinition[0]);
                }
                else
                {
                    postItem = Utilities.CreateItem <PostItem>(owaStoreObjectId);
                    if (Globals.ArePerfCountersEnabled)
                    {
                        OwaSingleCounters.ItemsCreated.Increment();
                    }
                }
                ExTraceGlobals.MailTracer.TraceDebug((long)this.GetHashCode(), "EditPostEventHandler::Post");
                object parameter = base.GetParameter("Subj");
                if (parameter != null)
                {
                    string subject = (string)parameter;
                    try
                    {
                        postItem.Subject = subject;
                        string text  = postItem.TryGetProperty(ItemSchema.ConversationTopic) as string;
                        bool   flag2 = text == null;
                        if (!flag || flag2)
                        {
                            postItem.ConversationTopic = postItem.Subject;
                        }
                    }
                    catch (PropertyValidationException ex)
                    {
                        throw new OwaInvalidRequestException(ex.Message, ex);
                    }
                }
                parameter = base.GetParameter("Imp");
                if (parameter != null)
                {
                    postItem.Importance = (Importance)parameter;
                }
                parameter = base.GetParameter("Body");
                object parameter2 = base.GetParameter("Text");
                if (parameter != null && parameter2 != null)
                {
                    Markup markup = ((bool)parameter2) ? Markup.PlainText : Markup.Html;
                    BodyConversionUtilities.SetBody(postItem, (string)parameter, markup, StoreObjectType.Post, base.UserContext);
                }
                postItem[MessageItemSchema.IsDraft] = false;
                Utilities.SetPostSender(postItem, base.UserContext, owaStoreObjectId.IsPublic);
                Utilities.SaveItem(postItem, flag);
                if (flag)
                {
                    base.MoveItemToDestinationFolderIfInScratchPad(postItem);
                }
            }
            finally
            {
                if (postItem != null)
                {
                    postItem.Dispose();
                    postItem = null;
                }
            }
        }
        // Token: 0x06002819 RID: 10265 RVA: 0x000E2E20 File Offset: 0x000E1020
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.infobar.SetInfobarClass("infobarEdit");
            this.infobar.SetShouldHonorHideByDefault(true);
            string queryStringParameter = Utilities.GetQueryStringParameter(base.Request, "a", false);
            string type = base.OwaContext.FormsRegistryContext.Type;

            if (ObjectClass.IsMeetingResponse(type))
            {
                this.isNew = string.Equals(queryStringParameter, "New", StringComparison.OrdinalIgnoreCase);
                if (this.isNew)
                {
                    this.newItemType = NewItemType.New;
                }
                base.Item = base.Initialize <MeetingResponse>(EditMeetingResponse.prefetchProperties);
                MeetingMessage meetingMessage = (MeetingMessage)base.Item;
                if (meetingMessage.From != null)
                {
                    this.isSendOnBehalfOf = (string.CompareOrdinal(base.UserContext.ExchangePrincipal.LegacyDn, meetingMessage.From.EmailAddress) != 0);
                }
                this.InitializeMeetingResponse();
            }
            else if (ObjectClass.IsMeetingRequest(type))
            {
                this.itemType = StoreObjectType.MeetingRequest;
                this.isNew    = string.Equals(queryStringParameter, "Forward", StringComparison.OrdinalIgnoreCase);
                if (this.isNew)
                {
                    this.newItemType = NewItemType.Forward;
                }
                base.Item = base.Initialize <MeetingRequest>(EditMeetingResponse.prefetchProperties);
            }
            else
            {
                if (!ObjectClass.IsMeetingCancellation(type))
                {
                    ExTraceGlobals.CalendarDataTracer.TraceDebug <string>((long)this.GetHashCode(), "Unsupported item type '{0}' for edit meeting page", type);
                    throw new OwaInvalidRequestException(string.Format("Unsupported item type '{0}' for edit meeting page", type));
                }
                this.itemType = StoreObjectType.MeetingCancellation;
                this.isNew    = string.Equals(queryStringParameter, "Forward", StringComparison.OrdinalIgnoreCase);
                if (this.isNew)
                {
                    this.newItemType = NewItemType.Forward;
                }
                this.infobar.AddMessage(SanitizedHtmlString.FromStringId(-161808760), InfobarMessageType.Informational);
                base.Item = base.Initialize <MeetingCancellation>(EditMeetingResponse.prefetchProperties);
            }
            base.DeleteExistingDraft = this.isNew;
            if (!this.isNew && base.Item is MessageItem)
            {
                MessageItem messageItem = (MessageItem)base.Item;
                if (messageItem.GetValueOrDefault <bool>(MessageItemSchema.HasBeenSubmitted))
                {
                    messageItem.AbortSubmit();
                }
            }
            this.bodyMarkup          = BodyConversionUtilities.GetBodyFormatOfEditItem(base.Item, this.newItemType, base.UserContext.UserOptions);
            this.toolbar             = new EditMessageToolbar(((MeetingMessage)base.Item).Importance, this.bodyMarkup);
            this.toolbar.ToolbarType = (base.IsPreviewForm ? ToolbarType.Preview : ToolbarType.Form);
            this.toolbar.IsComplianceButtonAllowedInForm = false;
            this.messageRecipientWell = new MessageRecipientWell((MeetingMessage)base.Item);
            this.showBcc = this.messageRecipientWell.HasRecipients(RecipientWellType.Bcc);
        }
Exemple #15
0
 protected void LoadMessageBodyIntoStream()
 {
     BodyConversionUtilities.RenderMeetingPlainTextBody(base.Response.Output, base.Item, base.UserContext, false);
 }
Exemple #16
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     if (this.IsPageCacheable)
     {
         Utilities.MakePageCacheable(base.Response);
     }
     else
     {
         Utilities.MakePageNoCacheNoStore(base.Response);
     }
     this.InitializeMessage();
     if (this.PageSupportSmime && this.message != null && Utilities.IsSMime(this.message))
     {
         if (!Utilities.IsSMimeFeatureUsable(base.OwaContext))
         {
             throw new OwaNeedsSMimeControlToEditDraftException(LocalizedStrings.GetNonEncoded(-1507367759));
         }
         if (Utilities.IsFlagSet((int)base.ClientSMimeControlStatus, 1))
         {
             throw new OwaNeedsSMimeControlToEditDraftException(LocalizedStrings.GetNonEncoded(-872682934));
         }
         if (Utilities.IsFlagSet((int)base.ClientSMimeControlStatus, 2))
         {
             throw new OwaNeedsSMimeControlToEditDraftException(LocalizedStrings.GetNonEncoded(-1103993212));
         }
         if (!Utilities.CheckSMimeEditFormBasicRequirement(base.ClientSMimeControlStatus, base.OwaContext))
         {
             throw new OwaNeedsSMimeControlToEditDraftException(LocalizedStrings.GetNonEncoded(-1507367759));
         }
     }
     if (!base.UserContext.IsIrmEnabled && this.message != null && Utilities.IsIrmRestricted(this.message))
     {
         SanitizedHtmlString sanitizedHtmlString = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(1049269714), new object[]
         {
             Utilities.GetOfficeDownloadAnchor(Microsoft.Exchange.Data.Storage.BodyFormat.TextPlain, base.UserContext.UserCulture)
         });
         throw new OwaCannotEditIrmDraftException(sanitizedHtmlString.ToString());
     }
     if (this.message != null)
     {
         string action = base.OwaContext.FormsRegistryContext.Action;
         string state  = base.OwaContext.FormsRegistryContext.State;
         if (string.CompareOrdinal(action, "Reply") == 0 || string.CompareOrdinal(action, "ReplyAll") == 0)
         {
             this.newItemType = NewItemType.Reply;
         }
         else if (string.CompareOrdinal(action, "Forward") == 0)
         {
             this.newItemType = NewItemType.Forward;
         }
         else if (string.Equals(action, "Open", StringComparison.OrdinalIgnoreCase) && string.Equals(state, "Draft", StringComparison.OrdinalIgnoreCase))
         {
             this.newItemType = NewItemType.ExplicitDraft;
             if (this.message.GetValueOrDefault <bool>(MessageItemSchema.HasBeenSubmitted))
             {
                 this.message.AbortSubmit();
             }
         }
         else
         {
             this.newItemType         = NewItemType.ImplicitDraft;
             base.DeleteExistingDraft = true;
         }
     }
     else
     {
         this.CreateDraftMessage();
     }
     if (this.message != null && Utilities.IsPublic(this.message))
     {
         throw new OwaInvalidRequestException("No way to open a public message in edit form");
     }
     if (this.IsSMimeControlNeeded && this.PageSupportSmime)
     {
         this.bodyMarkup = Markup.Html;
     }
     else
     {
         this.bodyMarkup = BodyConversionUtilities.GetBodyFormatOfEditItem(base.Item, this.newItemType, base.UserContext.UserOptions);
     }
     this.SetIsOtherFolder();
     this.infobar.SetInfobarClass("infobarEdit");
     this.infobar.SetShouldHonorHideByDefault(true);
     if (this.newItemType != NewItemType.New)
     {
         if (this.newItemType == NewItemType.ExplicitDraft)
         {
             this.infobar.AddMessage(SanitizedHtmlString.FromStringId(-1981719796), InfobarMessageType.Informational);
         }
         InfobarMessageBuilder.AddSensitivity(this.infobar, this.message);
         if (this.newItemType != NewItemType.ImplicitDraft)
         {
             InfobarMessageBuilder.AddCompliance(base.UserContext, this.infobar, this.message, true);
         }
         if (base.UserContext.IsIrmEnabled && this.message != null)
         {
             InfobarMessageBuilder.AddIrmInformation(this.infobar, this.message, false, true, false, this.IsIrmAsAttachment);
         }
         this.recipientWell       = new MessageRecipientWell(this.message);
         this.showBcc             = (this.recipientWell.HasRecipients(RecipientWellType.Bcc) || base.UserContext.UserOptions.AlwaysShowBcc);
         this.showFrom            = (this.recipientWell.HasRecipients(RecipientWellType.From) || base.UserContext.UserOptions.AlwaysShowFrom || this.isOtherFolder);
         this.toolbar             = this.BuildToolbar();
         this.toolbar.ToolbarType = (base.IsPreviewForm ? ToolbarType.Preview : ToolbarType.Form);
         this.addSignatureToBody  = base.ShouldAddSignatureToBody(this.bodyMarkup, this.newItemType);
     }
     else
     {
         this.recipientWell       = new MessageRecipientWell();
         this.showBcc             = base.UserContext.UserOptions.AlwaysShowBcc;
         this.showFrom            = (base.UserContext.UserOptions.AlwaysShowFrom || this.isOtherFolder);
         this.toolbar             = new EditMessageToolbar(Importance.Normal, this.bodyMarkup, this.IsSMimeControlMustUpdate, this.IsSMimeControlNeeded, false, false);
         this.toolbar.ToolbarType = (base.IsPreviewForm ? ToolbarType.Preview : ToolbarType.Form);
     }
     if (base.OwaContext.UserContext.IsFeatureEnabled(Feature.SMime) && this.PageSupportSmime)
     {
         if (this.IsSMimeControlNeeded && Utilities.IsFlagSet((int)base.ClientSMimeControlStatus, 4))
         {
             this.infobar.AddMessage(SanitizedHtmlString.FromStringId(330022834), InfobarMessageType.Informational);
         }
         else if (this.IsSMimeControlMustUpdate)
         {
             this.infobar.AddMessage(SanitizedHtmlString.FromStringId(1697878138), InfobarMessageType.Informational);
         }
         if (Utilities.IsSMimeControlNeededForEditForm(base.ClientSMimeControlStatus, base.OwaContext) && this.ShowFrom)
         {
             this.infobar.AddMessage(SanitizedHtmlString.FromStringId(-1863471683), InfobarMessageType.Informational);
         }
         if (!Utilities.IsFlagSet((int)base.ClientSMimeControlStatus, 1) && !Utilities.IsFlagSet((int)base.ClientSMimeControlStatus, 16) && !base.OwaContext.UserContext.IsExplicitLogonOthersMailbox)
         {
             this.infobar.AddMessage(SanitizedHtmlString.FromStringId(-1908761042), InfobarMessageType.Warning);
         }
     }
     if (this.Message != null && this.IsRemoveRestricted)
     {
         this.toolbar.IsComplianceButtonEnabledInForm = false;
     }
     if (this.ShowFrom && this.IsFromWellRestricted)
     {
         this.infobar.AddMessage(SanitizedHtmlString.FromStringId(885106754), InfobarMessageType.Informational);
     }
     if (this.message != null && this.newItemType == NewItemType.ExplicitDraft && Utilities.IsInArchiveMailbox(base.Item))
     {
         this.toolbar.IsSendButtonEnabledInForm = false;
     }
 }
        // Token: 0x06002FBB RID: 12219 RVA: 0x001156A4 File Offset: 0x001138A4
        public static IList <AttachmentLink> GenerateNonEditableMessageBodyAndRenderInfobarMessages(Item item, TextWriter writer, OwaContext owaContext, Infobar infobar, bool allowWebBeacon, bool forceEnableItemLink, string itemType, string action, string state, bool isEmbedded, string attachmentUrl)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (infobar == null)
            {
                throw new ArgumentNullException("infobar");
            }
            if (owaContext == null)
            {
                throw new ArgumentNullException("context");
            }
            UserContext           userContext = owaContext.UserContext;
            WebBeaconFilterLevels filterWebBeaconsAndHtmlForms = userContext.Configuration.FilterWebBeaconsAndHtmlForms;
            bool flag  = false;
            bool flag2 = false;
            bool flag3 = false;
            bool flag4 = false;

            JunkEmailUtilities.GetJunkEmailPropertiesForItem(item, isEmbedded, forceEnableItemLink, userContext, out flag, out flag2, out flag3, out flag4);
            OwaSafeHtmlOutboundCallbacks owaSafeHtmlOutboundCallbacks;

            if (!flag4)
            {
                if (filterWebBeaconsAndHtmlForms == WebBeaconFilterLevels.DisableFilter || allowWebBeacon || (!Utilities.IsPublic(item) && Utilities.IsWebBeaconsAllowed(item)))
                {
                    owaSafeHtmlOutboundCallbacks = new OwaSafeHtmlAllowWebBeaconCallbacks(item, userContext.IsPublicLogon, isEmbedded, attachmentUrl, owaContext, false);
                }
                else
                {
                    owaSafeHtmlOutboundCallbacks = new OwaSafeHtmlOutboundCallbacks(item, userContext.IsPublicLogon, isEmbedded, attachmentUrl, false, owaContext, false);
                }
            }
            else
            {
                owaSafeHtmlOutboundCallbacks = new OwaSafeHtmlOutboundCallbacks(item, userContext.IsPublicLogon, isEmbedded, attachmentUrl, true, owaContext, false);
            }
            BodyConversionUtilities.RenderReadBody(writer, item, owaSafeHtmlOutboundCallbacks, flag4, userContext.IsIrmEnabled);
            bool flag5 = owaSafeHtmlOutboundCallbacks.HasBlockedImages || owaSafeHtmlOutboundCallbacks.HasBlockedForms;

            if (flag)
            {
                if (flag2)
                {
                    infobar.AddMessage(SanitizedHtmlString.Format("{0} {1}", new object[]
                    {
                        LocalizedStrings.GetNonEncoded(1581910613),
                        LocalizedStrings.GetNonEncoded(-2026026928)
                    }), InfobarMessageType.Phishing);
                }
                else if (userContext.IsJunkEmailEnabled)
                {
                    infobar.AddMessage(SanitizedHtmlString.Format("{0} {1}", new object[]
                    {
                        LocalizedStrings.GetNonEncoded(59853257),
                        LocalizedStrings.GetNonEncoded(-2129859766)
                    }), InfobarMessageType.JunkEmail);
                }
            }
            else if (flag2 && !flag3)
            {
                string s = "<a id=\"aIbBlk\" href=\"#\"" + SanitizedHtmlString.Format("_sIT=\"{0}\" _sAct=\"{1}\" _iSt=\"{2}\" _fPhsh=1 _fAWB={3}", new object[]
                {
                    itemType,
                    action,
                    state,
                    allowWebBeacon ? 1 : 0
                }) + string.Format(CultureInfo.InvariantCulture, ">{0}</a> {1} ", new object[]
                {
                    LocalizedStrings.GetHtmlEncoded(-672110188),
                    LocalizedStrings.GetHtmlEncoded(-1020475744)
                });
                string s2 = string.Format(CultureInfo.InvariantCulture, "<a href=\"#\" " + Utilities.GetScriptHandler("onclick", "opnHlp(\"" + Utilities.JavascriptEncode(Utilities.BuildEhcHref(HelpIdsLight.EmailSafetyLight.ToString())) + "\");") + ">{0}</a>", new object[]
                {
                    LocalizedStrings.GetHtmlEncoded(338562664)
                });
                infobar.AddMessage(SanitizedHtmlString.Format("{0}{1}{2}", new object[]
                {
                    SanitizedHtmlString.FromStringId(1581910613),
                    SanitizedHtmlString.GetSanitizedStringWithoutEncoding(s),
                    SanitizedHtmlString.GetSanitizedStringWithoutEncoding(s2)
                }), InfobarMessageType.Phishing);
            }
            else if (flag5)
            {
                infobar.AddMessage(BodyConversionUtilities.GetWebBeaconBlockedInfobarMessage(filterWebBeaconsAndHtmlForms, SanitizedHtmlString.Format("_sIT=\"{0}\" _sAct=\"{1}\" _iSt=\"{2}\" _fPhsh={3} _fAWB=1", new object[]
                {
                    itemType,
                    action,
                    state,
                    forceEnableItemLink ? 1 : 0
                }).ToString()), InfobarMessageType.Informational);
            }
            if (owaSafeHtmlOutboundCallbacks.HasRtfEmbeddedImages)
            {
                infobar.AddMessage(1338319428, InfobarMessageType.Informational);
            }
            return(owaSafeHtmlOutboundCallbacks.AttachmentLinks);
        }
 // Token: 0x0600280D RID: 10253 RVA: 0x000E2C2D File Offset: 0x000E0E2D
 protected void RenderNotes()
 {
     BodyConversionUtilities.RenderMeetingPlainTextBody(base.Response.Output, base.Item, base.UserContext, false);
 }
        public void Save()
        {
            ExTraceGlobals.TasksCallTracer.TraceDebug((long)this.GetHashCode(), "EditTaskEventHandler.Save");
            bool       flag       = base.IsParameterSet("Id");
            bool       flag2      = false;
            bool       flag3      = false;
            ExDateTime?exDateTime = null;
            Task       task       = this.GetTask(new PropertyDefinition[0]);

            try
            {
                if (!base.IsParameterSet("Id"))
                {
                    OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("fId");
                    if (owaStoreObjectId != null && owaStoreObjectId.IsOtherMailbox)
                    {
                        ADSessionSettings adSettings        = Utilities.CreateScopedADSessionSettings(base.UserContext.LogonIdentity.DomainName);
                        ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromLegacyDN(adSettings, owaStoreObjectId.MailboxOwnerLegacyDN);
                        task[TaskSchema.TaskOwner] = exchangePrincipal.MailboxInfo.DisplayName;
                    }
                    else
                    {
                        task[TaskSchema.TaskOwner] = base.UserContext.ExchangePrincipal.MailboxInfo.DisplayName;
                    }
                }
                if (base.IsParameterSet("subj"))
                {
                    task.Subject = (string)base.GetParameter("subj");
                }
                if (base.IsParameterSet("sd"))
                {
                    task.StartDate = this.GetDateValue("sd");
                }
                if (base.IsParameterSet("dd"))
                {
                    task.DueDate = this.GetDateValue("dd");
                }
                if (base.IsParameterSet("dc"))
                {
                    exDateTime = this.GetDateValue("dc");
                    if (exDateTime != null)
                    {
                        flag2 = true;
                    }
                }
                if (base.IsParameterSet("st"))
                {
                    TaskStatus taskStatus = (TaskStatus)base.GetParameter("st");
                    if (taskStatus == TaskStatus.Completed)
                    {
                        flag2 = true;
                    }
                    else
                    {
                        TaskUtilities.SetIncomplete(task, taskStatus);
                    }
                }
                if (base.IsParameterSet("pri"))
                {
                    task[ItemSchema.Importance] = (Importance)base.GetParameter("pri");
                }
                if (base.IsParameterSet("pc"))
                {
                    double num = (double)((int)base.GetParameter("pc")) / 100.0;
                    if (!flag2 || num != 1.0)
                    {
                        if (num >= 0.0 && num < 1.0)
                        {
                            task.PercentComplete = num;
                        }
                        else if (num == 1.0)
                        {
                            flag2 = true;
                        }
                    }
                }
                if (base.IsParameterSet("rs"))
                {
                    bool flag4 = (bool)base.GetParameter("rs");
                    task[ItemSchema.ReminderIsSet] = flag4;
                    if (flag4 && base.IsParameterSet("rd"))
                    {
                        ExDateTime?dateValue = this.GetDateValue("rd");
                        if (dateValue != null)
                        {
                            task[ItemSchema.ReminderDueBy] = dateValue.Value;
                        }
                    }
                }
                if (base.IsParameterSet("ps"))
                {
                    task[ItemSchema.Sensitivity] = (((bool)base.GetParameter("ps")) ? Sensitivity.Private : Sensitivity.Normal);
                }
                if (base.IsParameterSet("tw"))
                {
                    int num2 = (int)base.GetParameter("tw");
                    if (num2 < 0 || num2 > 1525252319)
                    {
                        throw new OwaInvalidRequestException(LocalizedStrings.GetNonEncoded(-1310086288));
                    }
                    task[TaskSchema.TotalWork] = num2;
                }
                if (base.IsParameterSet("aw"))
                {
                    int num3 = (int)base.GetParameter("aw");
                    if (num3 < 0 || num3 > 1525252319)
                    {
                        throw new OwaInvalidRequestException(LocalizedStrings.GetNonEncoded(210380742));
                    }
                    task[TaskSchema.ActualWork] = num3;
                }
                if (base.IsParameterSet("mi"))
                {
                    task[TaskSchema.Mileage] = (string)base.GetParameter("mi");
                }
                if (base.IsParameterSet("bl"))
                {
                    task[TaskSchema.BillingInformation] = (string)base.GetParameter("bl");
                }
                if (base.IsParameterSet("co"))
                {
                    string   text = (string)base.GetParameter("co");
                    string[] value;
                    if (string.IsNullOrEmpty(text))
                    {
                        value = new string[0];
                    }
                    else
                    {
                        value = new string[]
                        {
                            text
                        };
                    }
                    task[TaskSchema.Companies] = value;
                }
                if (base.IsParameterSet("nt"))
                {
                    string text2 = (string)base.GetParameter("nt");
                    if (text2 != null)
                    {
                        BodyConversionUtilities.SetBody(task, text2, Markup.PlainText, base.UserContext);
                    }
                }
                if (base.IsParameterSet("RcrT"))
                {
                    Recurrence recurrence = base.CreateRecurrenceFromRequest();
                    if ((recurrence != null || task.Recurrence != null) && (recurrence == null || task.Recurrence == null || !recurrence.Equals(task.Recurrence)))
                    {
                        task.Recurrence = recurrence;
                        flag3           = true;
                    }
                }
                if (flag2 && exDateTime == null)
                {
                    if (task.CompleteDate == null)
                    {
                        exDateTime = new ExDateTime?(DateTimeUtilities.GetLocalTime());
                    }
                    else
                    {
                        exDateTime = new ExDateTime?(task.CompleteDate.Value);
                    }
                }
                if (!flag3 && flag2)
                {
                    task.SetStatusCompleted(exDateTime.Value);
                }
                Utilities.SaveItem(task, flag);
                task.Load();
                if (flag3 && flag2)
                {
                    OwaStoreObjectId owaStoreObjectId2 = OwaStoreObjectId.CreateFromStoreObject(task);
                    string           changeKey         = task.Id.ChangeKeyAsBase64String();
                    task.Dispose();
                    task = Utilities.GetItem <Task>(base.UserContext, owaStoreObjectId2, changeKey, TaskUtilities.TaskPrefetchProperties);
                    task.SetStatusCompleted(exDateTime.Value);
                    Utilities.SaveItem(task);
                    task.Load();
                }
                if (!flag)
                {
                    OwaStoreObjectId owaStoreObjectId3 = OwaStoreObjectId.CreateFromStoreObject(task);
                    if (ExTraceGlobals.TasksDataTracer.IsTraceEnabled(TraceType.DebugTrace))
                    {
                        ExTraceGlobals.TasksDataTracer.TraceDebug <string>((long)this.GetHashCode(), "New task item ID is '{0}'", owaStoreObjectId3.ToBase64String());
                    }
                    this.Writer.Write("<div id=itemId>");
                    this.Writer.Write(owaStoreObjectId3.ToBase64String());
                    this.Writer.Write("</div>");
                }
                this.Writer.Write("<div id=ck>");
                this.Writer.Write(task.Id.ChangeKeyAsBase64String());
                this.Writer.Write("</div>");
                base.MoveItemToDestinationFolderIfInScratchPad(task);
            }
            finally
            {
                task.Dispose();
            }
        }
Exemple #20
0
 protected void LoadMessageBodyIntoStream(TextWriter writer)
 {
     BodyConversionUtilities.GeneratePrintMessageBody(this.post, writer, base.OwaContext, base.IsEmbeddedItem, base.IsEmbeddedItem ? base.RenderEmbeddedUrl() : null, base.ForceAllowWebBeacon, base.ForceEnableItemLink);
 }
Exemple #21
0
        public void Save()
        {
            ExTraceGlobals.ContactsCallTracer.TraceDebug((long)this.GetHashCode(), "EditContactItemEventHandler.Save");
            bool flag = base.IsParameterSet("Id");

            using (Contact contact = this.GetContact(new PropertyDefinition[0]))
            {
                this.SetTextPropertyValue(contact, ContactUtilities.GivenName);
                this.SetTextPropertyValue(contact, ContactUtilities.MiddleName);
                this.SetTextPropertyValue(contact, ContactUtilities.SurName);
                this.SetFileAsValue(contact);
                this.SetTextPropertyValue(contact, ContactUtilities.Title);
                this.SetTextPropertyValue(contact, ContactUtilities.CompanyName);
                this.SetTextPropertyValue(contact, ContactUtilities.Manager);
                this.SetTextPropertyValue(contact, ContactUtilities.AssistantName);
                this.SetTextPropertyValue(contact, ContactUtilities.Department);
                this.SetTextPropertyValue(contact, ContactUtilities.OfficeLocation);
                this.SetTextPropertyValue(contact, ContactUtilities.YomiFirstName);
                this.SetTextPropertyValue(contact, ContactUtilities.YomiLastName);
                this.SetTextPropertyValue(contact, ContactUtilities.CompanyYomi);
                this.SetTextPropertyValue(contact, ContactUtilities.BusinessPhoneNumber);
                this.SetTextPropertyValue(contact, ContactUtilities.HomePhone);
                this.SetTextPropertyValue(contact, ContactUtilities.MobilePhone);
                for (int i = 0; i < ContactUtilities.PhoneNumberProperties.Length; i++)
                {
                    this.SetTextPropertyValue(contact, ContactUtilities.PhoneNumberProperties[i]);
                }
                this.SetEmailPropertyValue(contact, ContactUtilities.Email1EmailAddress);
                this.SetEmailPropertyValue(contact, ContactUtilities.Email2EmailAddress);
                this.SetEmailPropertyValue(contact, ContactUtilities.Email3EmailAddress);
                this.SetTextPropertyValue(contact, ContactUtilities.IMAddress);
                this.SetTextPropertyValue(contact, ContactUtilities.WebPage);
                int num = (int)base.GetParameter(ContactUtilities.PostalAddressId.Id);
                contact[ContactUtilities.PostalAddressId.PropertyDefinition] = num;
                this.SetTextPropertyValue(contact, ContactUtilities.WorkAddressStreet);
                this.SetTextPropertyValue(contact, ContactUtilities.WorkAddressCity);
                this.SetTextPropertyValue(contact, ContactUtilities.WorkAddressState);
                this.SetTextPropertyValue(contact, ContactUtilities.WorkAddressPostalCode);
                this.SetTextPropertyValue(contact, ContactUtilities.WorkAddressCountry);
                this.SetTextPropertyValue(contact, ContactUtilities.HomeStreet);
                this.SetTextPropertyValue(contact, ContactUtilities.HomeCity);
                this.SetTextPropertyValue(contact, ContactUtilities.HomeState);
                this.SetTextPropertyValue(contact, ContactUtilities.HomePostalCode);
                this.SetTextPropertyValue(contact, ContactUtilities.HomeCountry);
                this.SetTextPropertyValue(contact, ContactUtilities.OtherStreet);
                this.SetTextPropertyValue(contact, ContactUtilities.OtherCity);
                this.SetTextPropertyValue(contact, ContactUtilities.OtherState);
                this.SetTextPropertyValue(contact, ContactUtilities.OtherPostalCode);
                this.SetTextPropertyValue(contact, ContactUtilities.OtherCountry);
                string text = (string)base.GetParameter("notes");
                if (text != null)
                {
                    BodyConversionUtilities.SetBody(contact, text, Markup.PlainText, base.UserContext);
                }
                string textPropertyValue = EditContactItemEventHandler.GetTextPropertyValue(contact, ContactBaseSchema.FileAs);
                if (string.IsNullOrEmpty(textPropertyValue) && !string.IsNullOrEmpty(contact.Company))
                {
                    contact[ContactUtilities.FileAsId.PropertyDefinition] = FileAsMapping.Company;
                }
                Utilities.SaveItem(contact);
                contact.Load();
                if (!flag)
                {
                    if (ExTraceGlobals.ContactsDataTracer.IsTraceEnabled(TraceType.DebugTrace))
                    {
                        ExTraceGlobals.ContactsDataTracer.TraceDebug <string>((long)this.GetHashCode(), "New contact item ID is '{0}'", contact.Id.ObjectId.ToBase64String());
                    }
                    this.Writer.Write("<div id=itemId>");
                    this.Writer.Write(Utilities.GetIdAsString(contact));
                    this.Writer.Write("</div>");
                }
                this.Writer.Write("<div id=ck>");
                this.Writer.Write(contact.Id.ChangeKeyAsBase64String());
                this.Writer.Write("</div>");
                string text2 = EditContactItemEventHandler.GetTextPropertyValue(contact, ContactBaseSchema.FileAs);
                if (string.IsNullOrEmpty(text2))
                {
                    text2 = LocalizedStrings.GetNonEncoded(-1873027801);
                }
                this.Writer.Write("<div id=fa>");
                Utilities.HtmlEncode(text2, this.Writer);
                this.Writer.Write("</div>");
                base.MoveItemToDestinationFolderIfInScratchPad(contact);
            }
        }
 // Token: 0x06002FC8 RID: 12232 RVA: 0x0011610F File Offset: 0x0011430F
 internal static void SetBody(Item item, string body, Markup markup, UserContext userContext)
 {
     BodyConversionUtilities.SetBody(item, body, markup, StoreObjectType.Unknown, userContext);
 }
        // Token: 0x06002FBE RID: 12222 RVA: 0x00115A4C File Offset: 0x00113C4C
        public static bool GenerateEditableMessageBodyAndRenderInfobarMessages(Item item, TextWriter writer, NewItemType newItemType, OwaContext owaContext, ref bool shouldPromptUserOnFormLoad, ref bool hasInlineImages, Infobar infobar, bool allowWebBeacon, Markup markup)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (infobar == null)
            {
                throw new ArgumentNullException("infobar");
            }
            if (owaContext == null)
            {
                throw new ArgumentNullException("context");
            }
            UserContext userContext = owaContext.UserContext;
            OwaSafeHtmlOutboundCallbacks owaSafeHtmlOutboundCallbacks = null;
            WebBeaconFilterLevels        filterWebBeaconsAndHtmlForms = userContext.Configuration.FilterWebBeaconsAndHtmlForms;
            bool flag = false;

            if (item != null)
            {
                flag = JunkEmailUtilities.IsJunkOrPhishing(item, false, userContext);
                if (!flag)
                {
                    if (filterWebBeaconsAndHtmlForms == WebBeaconFilterLevels.DisableFilter || allowWebBeacon || (!Utilities.IsPublic(item) && Utilities.IsWebBeaconsAllowed(item)))
                    {
                        owaSafeHtmlOutboundCallbacks = new OwaSafeHtmlAllowWebBeaconCallbacks(item, userContext.IsPublicLogon, owaContext, true);
                    }
                    else if (filterWebBeaconsAndHtmlForms != WebBeaconFilterLevels.DisableFilter && (newItemType == NewItemType.Reply || newItemType == NewItemType.Forward || newItemType == NewItemType.ExplicitDraft || newItemType == NewItemType.PostReply) && !allowWebBeacon)
                    {
                        owaSafeHtmlOutboundCallbacks = new OwaSafeHtmlRemoveWebBeaconCallbacks(item, userContext.IsPublicLogon, owaContext, true);
                    }
                    else
                    {
                        owaSafeHtmlOutboundCallbacks = new OwaSafeHtmlOutboundCallbacks(item, userContext.IsPublicLogon, false, owaContext, true);
                    }
                }
                else
                {
                    owaSafeHtmlOutboundCallbacks = new OwaSafeHtmlOutboundCallbacks(item, userContext.IsPublicLogon, true, owaContext, true);
                }
            }
            if (flag)
            {
                markup = Markup.PlainText;
            }
            BodyConversionUtilities.RenderComposeBody(writer, item, owaSafeHtmlOutboundCallbacks, userContext, markup);
            if (owaSafeHtmlOutboundCallbacks != null)
            {
                hasInlineImages = owaSafeHtmlOutboundCallbacks.HasInlineImages;
            }
            if (item != null)
            {
                if (!flag && (owaSafeHtmlOutboundCallbacks.HasBlockedImages || owaSafeHtmlOutboundCallbacks.HasBlockedForms))
                {
                    if (filterWebBeaconsAndHtmlForms == WebBeaconFilterLevels.UserFilterChoice)
                    {
                        shouldPromptUserOnFormLoad = true;
                    }
                    else if (filterWebBeaconsAndHtmlForms == WebBeaconFilterLevels.ForceFilter)
                    {
                        infobar.AddMessage(SanitizedHtmlString.FromStringId(-1196115124), InfobarMessageType.Informational, "divIbImg");
                    }
                }
                if (owaSafeHtmlOutboundCallbacks.HasRtfEmbeddedImages)
                {
                    infobar.AddMessage(1338319428, InfobarMessageType.Informational);
                }
                if (!ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(item.ClassName))
                {
                    return(owaSafeHtmlOutboundCallbacks.ApplyAttachmentsUpdates(item));
                }
            }
            return(false);
        }
Exemple #24
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.infobar.SetInfobarClass("infobarEdit");
            this.infobar.SetShouldHonorHideByDefault(true);
            this.calendarItemBase = base.Initialize <CalendarItemBase>(false, new PropertyDefinition[]
            {
                CalendarItemBaseSchema.CalendarItemType,
                StoreObjectSchema.EffectiveRights
            });
            if (this.calendarItemBase != null)
            {
                if (string.Equals(base.OwaContext.FormsRegistryContext.Action, "Open", StringComparison.OrdinalIgnoreCase))
                {
                    this.newItemType = NewItemType.ExplicitDraft;
                }
                else
                {
                    this.newItemType         = NewItemType.ImplicitDraft;
                    base.DeleteExistingDraft = true;
                }
            }
            else
            {
                this.calendarItemBase = Utilities.CreateDraftMeetingRequestFromQueryString(base.UserContext, base.Request, new PropertyDefinition[]
                {
                    StoreObjectSchema.EffectiveRights
                });
                if (this.calendarItemBase != null)
                {
                    this.newItemType         = NewItemType.ImplicitDraft;
                    base.DeleteExistingDraft = true;
                    base.Item = this.calendarItemBase;
                }
            }
            if (this.calendarItemBase != null)
            {
                this.isMeeting = this.calendarItemBase.IsMeeting;
                this.startTime = this.calendarItemBase.StartTime;
                this.endTime   = this.calendarItemBase.EndTime;
                if (this.calendarItemBase.IsAllDayEvent && !this.IsRecurringMaster)
                {
                    this.endTime = this.endTime.IncrementDays(-1);
                }
                this.recipientWell       = new CalendarItemRecipientWell(this.calendarItemBase);
                this.bodyMarkup          = BodyConversionUtilities.GetBodyFormatOfEditItem(this.calendarItemBase, this.newItemType, base.UserContext.UserOptions);
                this.toolbar             = new EditCalendarItemToolbar(this.calendarItemBase, this.isMeeting, this.bodyMarkup, this.IsPublicItem);
                this.toolbar.ToolbarType = (base.IsPreviewForm ? ToolbarType.Preview : ToolbarType.Form);
                this.isBeingCanceled     = (Utilities.GetQueryStringParameter(base.Request, "c", false) != null);
                string queryStringParameter = Utilities.GetQueryStringParameter(base.Request, "er", false);
                if (queryStringParameter != null)
                {
                    if (this.calendarItemBase.CalendarItemType != CalendarItemType.RecurringMaster || !(this.calendarItemBase is CalendarItem))
                    {
                        throw new OwaInvalidRequestException("Invalid calendar item type.  Only recurring masters support specifying an end range");
                    }
                    this.endRange = ExDateTime.MinValue;
                    try
                    {
                        this.endRange = DateTimeUtilities.ParseIsoDate(queryStringParameter, base.UserContext.TimeZone);
                    }
                    catch (OwaParsingErrorException)
                    {
                        ExTraceGlobals.CalendarDataTracer.TraceDebug <string>((long)this.GetHashCode(), "Invalid end range provided on URL '{0}'", queryStringParameter);
                        throw new OwaInvalidRequestException(string.Format("Invalid end range provided on URL '{0}'", queryStringParameter));
                    }
                    if (this.endRange != ExDateTime.MinValue)
                    {
                        CalendarItem calendarItem = (CalendarItem)this.calendarItemBase;
                        this.occurrenceCount = MeetingUtilities.CancelRecurrence(calendarItem, this.endRange);
                        if (this.occurrenceCount == 0)
                        {
                            this.isBeingCanceled = true;
                        }
                    }
                }
                string queryStringParameter2 = Utilities.GetQueryStringParameter(base.Request, "od", false);
                if (queryStringParameter2 != null)
                {
                    try
                    {
                        this.occurrenceDate = DateTimeUtilities.ParseIsoDate(queryStringParameter2, base.UserContext.TimeZone).Date;
                        goto IL_303;
                    }
                    catch (OwaParsingErrorException)
                    {
                        ExTraceGlobals.CalendarDataTracer.TraceDebug <string>((long)this.GetHashCode(), "Invalid occurrence date specified on URL '{0}'", queryStringParameter2);
                        throw new OwaInvalidRequestException(string.Format("Invalid occurrence date provided on URL '{0}'", queryStringParameter2));
                    }
                }
                this.occurrenceDate = DateTimeUtilities.GetLocalTime().Date;
IL_303:
                CalendarUtilities.AddCalendarInfobarMessages(this.infobar, this.calendarItemBase, null, base.UserContext);
                if (this.isBeingCanceled)
                {
                    this.infobar.AddMessage(SanitizedHtmlString.FromStringId(1328030972), InfobarMessageType.Informational);
                }
                this.disableOccurrenceReminderUI = MeetingUtilities.CheckShouldDisableOccurrenceReminderUI(this.calendarItemBase);
                if (this.disableOccurrenceReminderUI && !this.IsPublicItem)
                {
                    this.infobar.AddMessage(SanitizedHtmlString.FromStringId(-891369593), InfobarMessageType.Informational);
                }
                if (!(this.calendarItemBase is CalendarItem))
                {
                    this.recurrenceUtilities = new RecurrenceUtilities(null, base.SanitizingResponse);
                    return;
                }
                if (0 < this.occurrenceCount)
                {
                    EndDateRecurrenceRange range = new EndDateRecurrenceRange(((CalendarItem)this.calendarItemBase).Recurrence.Range.StartDate, this.endRange.IncrementDays(-1));
                    this.recurrenceUtilities = new RecurrenceUtilities(new Recurrence(((CalendarItem)this.calendarItemBase).Recurrence.Pattern, range), base.SanitizingResponse);
                    return;
                }
                this.recurrenceUtilities = new RecurrenceUtilities(((CalendarItem)this.calendarItemBase).Recurrence, base.SanitizingResponse);
                return;
            }
            else
            {
                this.isMeeting = (Utilities.GetQueryStringParameter(base.Request, "mr", false) != null);
                if (this.isMeeting && this.IsPublicItem)
                {
                    throw new OwaInvalidRequestException("Can't create meeting in Owa Public Folders");
                }
                this.isAllDayEvent = (Utilities.GetQueryStringParameter(base.Request, "evt", false) != null);
                bool   flag = Utilities.GetQueryStringParameter(base.Request, "tm", false) != null || this.isAllDayEvent;
                string queryStringParameter3 = Utilities.GetQueryStringParameter(base.Request, "st", false);
                if (queryStringParameter3 != null)
                {
                    try
                    {
                        this.startTime = DateTimeUtilities.ParseIsoDate(queryStringParameter3, base.UserContext.TimeZone);
                    }
                    catch (OwaParsingErrorException)
                    {
                        ExTraceGlobals.CalendarDataTracer.TraceDebug <string>((long)this.GetHashCode(), "Invalid start date provided on URL '{0}'", queryStringParameter3);
                        throw new OwaInvalidRequestException(string.Format("Invalid start date provided on URL '{0}'", queryStringParameter3));
                    }
                }
                if (flag || this.startTime == ExDateTime.MinValue)
                {
                    ExDateTime localTime = DateTimeUtilities.GetLocalTime();
                    if (this.startTime == ExDateTime.MinValue)
                    {
                        this.startTime = new ExDateTime(base.UserContext.TimeZone, localTime.Year, localTime.Month, localTime.Day, localTime.Hour, localTime.Minute, 0);
                    }
                    else
                    {
                        this.startTime = new ExDateTime(base.UserContext.TimeZone, this.startTime.Year, this.startTime.Month, this.startTime.Day, localTime.Hour, localTime.Minute, 0);
                    }
                    if (this.isAllDayEvent && this.startTime.Hour == 23)
                    {
                        if (this.startTime.Minute >= 30)
                        {
                            this.startTime = this.startTime.Date;
                        }
                        else
                        {
                            this.startTime = new ExDateTime(base.UserContext.TimeZone, this.startTime.Year, this.startTime.Month, this.startTime.Day, 23, 0, 0);
                            this.endTime   = new ExDateTime(base.UserContext.TimeZone, this.startTime.Year, this.startTime.Month, this.startTime.Day, 23, 30, 0);
                        }
                    }
                    else if (this.startTime.Minute != 0 && this.startTime.Minute != 30)
                    {
                        this.startTime = this.startTime.AddMinutes((double)(30 - this.startTime.Minute % 30));
                    }
                }
                if (this.endTime == ExDateTime.MinValue)
                {
                    this.endTime = this.startTime.AddMinutes(60.0);
                }
                this.recipientWell       = new CalendarItemRecipientWell();
                this.bodyMarkup          = base.UserContext.UserOptions.ComposeMarkup;
                this.toolbar             = new EditCalendarItemToolbar(null, this.isMeeting, this.bodyMarkup, this.IsPublicItem);
                this.toolbar.ToolbarType = (base.IsPreviewForm ? ToolbarType.Preview : ToolbarType.Form);
                this.recurrenceUtilities = new RecurrenceUtilities(null, base.SanitizingResponse);
                return;
            }
        }
 // Token: 0x06002FBC RID: 12220 RVA: 0x001159B7 File Offset: 0x00113BB7
 public static SanitizedHtmlString GetWebBeaconBlockedInfobarMessage(WebBeaconFilterLevels level)
 {
     return(BodyConversionUtilities.GetWebBeaconBlockedInfobarMessage(level, string.Empty));
 }
        // Token: 0x06002FC9 RID: 12233 RVA: 0x0011611C File Offset: 0x0011431C
        internal static bool SetBody(Item item, string body, Markup markup, StoreObjectType storeObjectType, UserContext userContext)
        {
            bool flag = false;

            switch (markup)
            {
            case Markup.Html:
            {
                string                 targetCharsetName;
                BodyCharsetFlags       bodyCharsetOptions     = BodyConversionUtilities.GetBodyCharsetOptions(userContext, out targetCharsetName);
                BodyFormat             targetFormat           = (storeObjectType != StoreObjectType.CalendarItem && storeObjectType != StoreObjectType.MeetingMessage) ? BodyFormat.TextHtml : BodyFormat.ApplicationRtf;
                BodyWriteConfiguration bodyWriteConfiguration = new BodyWriteConfiguration(BodyFormat.TextHtml);
                bodyWriteConfiguration.SetTargetFormat(targetFormat, targetCharsetName, bodyCharsetOptions);
                OwaSafeHtmlInboundCallbacks owaSafeHtmlInboundCallbacks = null;
                owaSafeHtmlInboundCallbacks = new OwaSafeHtmlInboundCallbacks(item, userContext);
                bodyWriteConfiguration.SetHtmlOptions(HtmlStreamingFlags.None, owaSafeHtmlInboundCallbacks);
                try
                {
                    Body body2 = item.Body;
                    if (userContext.IsIrmEnabled && Utilities.IsIrmDecrypted(item))
                    {
                        body2 = ((RightsManagedMessageItem)item).ProtectedBody;
                    }
                    using (TextWriter textWriter = body2.OpenTextWriter(bodyWriteConfiguration))
                    {
                        textWriter.Write(body);
                    }
                }
                catch (InvalidCharsetException innerException)
                {
                    throw new OwaEventHandlerException(LocalizedStrings.GetNonEncoded(1825027020), LocalizedStrings.GetNonEncoded(1825027020), innerException);
                }
                catch (TextConvertersException innerException2)
                {
                    throw new OwaEventHandlerException(LocalizedStrings.GetNonEncoded(1825027020), LocalizedStrings.GetNonEncoded(1825027020), innerException2);
                }
                Utilities.MakeModifiedCalendarItemOccurrence(item);
                bool flag2 = false;
                if (owaSafeHtmlInboundCallbacks != null)
                {
                    flag2 = owaSafeHtmlInboundCallbacks.AttachmentNeedsSave();
                }
                if (flag2 && !Utilities.IsClearSigned(item))
                {
                    flag = AttachmentUtility.ApplyAttachmentsUpdates(item, owaSafeHtmlInboundCallbacks);
                    item.Load();
                }
                break;
            }

            case Markup.PlainText:
                ItemUtility.SetItemBody(item, BodyFormat.TextPlain, body);
                flag = AttachmentUtility.PromoteInlineAttachments(item);
                if (flag)
                {
                    item.Load();
                }
                break;
            }
            return(flag);
        }
        // Token: 0x06002FC2 RID: 12226 RVA: 0x00115D90 File Offset: 0x00113F90
        public static void RenderReadBody(TextWriter output, Item item, OwaSafeHtmlCallbackBase callBack, bool isJunkOrPhishing, bool isIrmEnabled)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            if (item == null)
            {
                return;
            }
            ReportMessage reportMessage = item as ReportMessage;
            bool          flag          = null != reportMessage;
            Item          item2         = null;

            try
            {
                if (Utilities.IsOpaqueSigned(item))
                {
                    MessageItem messageItem = item as MessageItem;
                    if (messageItem != null && ItemConversion.TryOpenSMimeContent(messageItem, OwaContext.Current.UserContext.Configuration.DefaultAcceptedDomain.DomainName.ToString(), out item2))
                    {
                        item = item2;
                    }
                }
                if (item.Body == null || (flag && item.Body.Size <= 0L))
                {
                    if (flag)
                    {
                        using (MemoryStream memoryStream = new MemoryStream())
                        {
                            Charset charset;
                            reportMessage.GenerateReportBody(memoryStream, out charset);
                            item.OpenAsReadWrite();
                            BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextHtml, charset.Name);
                            using (Stream stream = item.Body.OpenWriteStream(configuration))
                            {
                                memoryStream.Position = 0L;
                                memoryStream.WriteTo(stream);
                            }
                            goto IL_E2;
                        }
                    }
                    return;
                }
IL_E2:
                Body body = item.Body;
                if (isIrmEnabled && Utilities.IsIrmRestrictedAndDecrypted(item))
                {
                    body = ((RightsManagedMessageItem)item).ProtectedBody;
                }
                if (body.Size > 0L)
                {
                    Markup markup = Markup.Html;
                    if (isJunkOrPhishing)
                    {
                        markup = Markup.PlainText;
                    }
                    BodyConversionUtilities.ConvertAndOutputBody(output, body, markup, callBack);
                }
            }
            finally
            {
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
            }
        }