protected override void BuildAttachments(BodyConversionCallbacks callbacks, InboundConversionOptions optionsForSmime)
        {
            RightsManagedMessageItem rightsManagedMessageItem  = this.originalItem as RightsManagedMessageItem;
            RightsManagedMessageItem rightsManagedMessageItem2 = this.newItem as RightsManagedMessageItem;

            base.CopyAttachments(callbacks, rightsManagedMessageItem.ProtectedAttachmentCollection, rightsManagedMessageItem2.ProtectedAttachmentCollection, false, this.parameters.TargetFormat == BodyFormat.TextPlain, optionsForSmime);
        }
        internal void PopulateContents()
        {
            BodyConversionCallbacks callbacks = this.GetCallbacks();

            this.BuildBody(callbacks);
            this.BuildAttachments(callbacks, this.parameters.ConversionOptionsForSmime);
        }
        protected override void BuildBody(BodyConversionCallbacks callbacks)
        {
            RightsManagedMessageItem rightsManagedMessageItem  = this.originalItem as RightsManagedMessageItem;
            RightsManagedMessageItem rightsManagedMessageItem2 = this.newItem as RightsManagedMessageItem;

            ReplyForwardCommon.CopyBodyWithPrefix(rightsManagedMessageItem.ProtectedBody, rightsManagedMessageItem2.ProtectedBody, this.parameters, callbacks);
        }
        protected BodyConversionCallbacks GetCallbacksInternal(Body defaultItemBody, AttachmentCollection defaultAttachmentCollection)
        {
            BodyConversionCallbacks result = default(BodyConversionCallbacks);

            if (this.parameters.HtmlCallbacks != null)
            {
                result.HtmlCallback = this.parameters.HtmlCallbacks;
            }
            else
            {
                DefaultHtmlCallbacks defaultHtmlCallbacks = new DefaultHtmlCallbacks(defaultAttachmentCollection.CoreAttachmentCollection, defaultItemBody, true);
                if (this.parameters.ConversionOptionsForSmime != null && !this.parameters.ConversionOptionsForSmime.IgnoreImceaDomain && this.parameters.ConversionOptionsForSmime.ImceaEncapsulationDomain != null)
                {
                    defaultHtmlCallbacks.SetContentIdDomain(this.parameters.ConversionOptionsForSmime.ImceaEncapsulationDomain);
                }
                defaultHtmlCallbacks.ClearingEmptyLinks = true;
                defaultHtmlCallbacks.RemoveLinksToNonImageAttachments = true;
                result.HtmlCallback = defaultHtmlCallbacks;
            }
            if (this.parameters.RtfCallbacks != null)
            {
                result.RtfCallback = this.parameters.RtfCallbacks;
            }
            else if (this.parameters.TargetFormat == BodyFormat.ApplicationRtf && this.originalItem.Body.Format == BodyFormat.TextHtml)
            {
                result.RtfCallback = new DefaultRtfCallbacks(defaultAttachmentCollection.CoreAttachmentCollection, defaultItemBody, true);
            }
            return(result);
        }
Esempio n. 5
0
        private void BuildMeetingMessageBody(BodyConversionCallbacks callbacks)
        {
            BodyReadConfiguration  configuration          = new BodyReadConfiguration(this.originalItem.Body.RawFormat);
            BodyWriteConfiguration bodyWriteConfiguration = new BodyWriteConfiguration(this.originalItem.Body.RawFormat);

            bodyWriteConfiguration.SetTargetFormat(this.parameters.TargetFormat, this.originalItem.Body.Charset);
            if (!string.IsNullOrEmpty(this.parameters.BodyPrefix))
            {
                bodyWriteConfiguration.AddInjectedText(this.parameters.BodyPrefix, null, this.parameters.BodyPrefixFormat);
            }
            if (callbacks.HtmlCallback != null)
            {
                bodyWriteConfiguration.HtmlCallback = callbacks.HtmlCallback;
                bodyWriteConfiguration.HtmlFlags    = HtmlStreamingFlags.FilterHtml;
            }
            if (callbacks.RtfCallback != null)
            {
                bodyWriteConfiguration.RtfCallback = callbacks.RtfCallback;
            }
            using (TextReader textReader = this.originalItem.Body.OpenTextReader(configuration))
            {
                using (TextWriter textWriter = this.newItem.Body.OpenTextWriter(bodyWriteConfiguration))
                {
                    Util.StreamHandler.CopyText(textReader, textWriter);
                }
            }
        }
Esempio n. 6
0
 protected override void BuildBody(BodyConversionCallbacks callbacks)
 {
     if (!base.IsResourceDelegationMessage && (this.newItem is MeetingMessage || base.TreatAsMeetingMessage) && !string.IsNullOrEmpty(this.parameters.BodyPrefix))
     {
         this.BuildMeetingMessageBody(callbacks);
         return;
     }
     ReplyForwardCommon.CopyBodyWithPrefix(this.originalItem.Body, this.newItem.Body, this.parameters, callbacks);
 }
Esempio n. 7
0
        protected override void BuildBody(BodyConversionCallbacks callbacks)
        {
            BodyWriteConfiguration bodyWriteConfiguration = new BodyWriteConfiguration(base.Format);

            bodyWriteConfiguration.SetTargetFormat(this.parameters.TargetFormat, this.newItem.Body.Charset);
            if (!string.IsNullOrEmpty(this.parameters.BodyPrefix))
            {
                bodyWriteConfiguration.AddInjectedText(this.parameters.BodyPrefix, null, this.parameters.BodyPrefixFormat);
            }
            using (this.newItem.Body.OpenTextWriter(bodyWriteConfiguration))
            {
            }
        }
Esempio n. 8
0
        protected override void BuildBody(BodyConversionCallbacks callbacks)
        {
            BodyReadConfiguration  configuration          = new BodyReadConfiguration(this.template.Body.RawFormat, this.template.Body.RawCharset.Name);
            BodyWriteConfiguration bodyWriteConfiguration = new BodyWriteConfiguration(this.template.Body.RawFormat, this.template.Body.RawCharset.Name);

            bodyWriteConfiguration.SetTargetFormat(this.template.Body.Format, this.template.Body.Charset);
            using (Stream stream = this.template.Body.OpenReadStream(configuration))
            {
                using (Stream stream2 = this.newItem.Body.OpenWriteStream(bodyWriteConfiguration))
                {
                    Util.StreamHandler.CopyStreamData(stream, stream2);
                }
            }
        }
Esempio n. 9
0
        protected override void BuildBody(BodyConversionCallbacks callbacks)
        {
            string charset = this.originalItem.Body.Charset;

            try
            {
                Charset charset2 = Charset.GetCharset(charset);
                this.newItem[InternalSchema.InternetCpid] = charset2.CodePage;
                this.newItem[InternalSchema.Codepage]     = ConvertUtils.MapItemWindowsCharset(charset2).CodePage;
            }
            catch (InvalidCharsetException)
            {
                ExTraceGlobals.StorageTracer.TraceDebug <string>(0L, "ForwardAsAttachmentCreation::BuildBody. Original message had invalid charset {0}", charset);
            }
        }
Esempio n. 10
0
 protected override void BuildAttachments(BodyConversionCallbacks callbacks, InboundConversionOptions optionsForSmime)
 {
     using (ItemAttachment itemAttachment = this.newItem.AttachmentCollection.Create(AttachmentType.EmbeddedMessage) as ItemAttachment)
     {
         using (Item item = itemAttachment.GetItem(InternalSchema.ContentConversionProperties))
         {
             this.originalItem.Load(InternalSchema.ContentConversionProperties);
             Item.CopyItemContent(this.originalItem, item);
             item.DeleteProperties(new PropertyDefinition[]
             {
                 InternalSchema.EntryId,
                 InternalSchema.MessageStatus,
                 InternalSchema.SubmitFlags,
                 InternalSchema.ReceivedRepresenting,
                 InternalSchema.UrlCompName
             });
             item[InternalSchema.Flags]            = this.originalItem.GetValueOrDefault <MessageFlags>(InternalSchema.Flags);
             item[InternalSchema.HasBeenSubmitted] = false;
             item.SaveFlags |= this.newItem.SaveFlags;
             item.Save(SaveMode.NoConflictResolution);
         }
         itemAttachment.Save();
     }
 }
Esempio n. 11
0
 protected override void BuildAttachments(BodyConversionCallbacks callbacks, InboundConversionOptions optionsForSmime)
 {
 }
Esempio n. 12
0
        protected void CopyAttachments(BodyConversionCallbacks callbacks, AttachmentCollection sourceCollection, AttachmentCollection targetCollection, bool copyInlinesOnly, bool targetIsPlainText, InboundConversionOptions optionsForSmime)
        {
            ReadOnlyCollection <AttachmentLink> readOnlyCollection = null;
            bool flag = true;

            if (callbacks.HtmlCallback != null && callbacks.HtmlCallback.AttachmentListInitialized)
            {
                readOnlyCollection = callbacks.HtmlCallback.AttachmentLinks;
                flag = (flag && callbacks.HtmlCallback.ClearInlineOnUnmarkedAttachments);
            }
            if (callbacks.RtfCallback != null && callbacks.RtfCallback.AttachmentListInitialized)
            {
                readOnlyCollection = callbacks.RtfCallback.AttachmentLinks;
                flag = (flag && callbacks.RtfCallback.ClearInlineOnUnmarkedAttachments);
            }
            if (readOnlyCollection == null)
            {
                if (copyInlinesOnly)
                {
                    return;
                }
                using (IEnumerator <AttachmentHandle> enumerator = sourceCollection.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        AttachmentHandle handle = enumerator.Current;
                        using (Attachment attachment = sourceCollection.Open(handle, null))
                        {
                            if (!attachment.IsCalendarException)
                            {
                                using (Attachment attachment2 = attachment.CreateCopy(targetCollection, new BodyFormat?(this.parameters.TargetFormat)))
                                {
                                    attachment2.IsInline = false;
                                    attachment2.Save();
                                }
                            }
                        }
                    }
                    return;
                }
            }
            foreach (AttachmentLink attachmentLink in readOnlyCollection)
            {
                if (!copyInlinesOnly || attachmentLink.IsInline(flag))
                {
                    using (Attachment attachment3 = sourceCollection.Open(attachmentLink.AttachmentId, null))
                    {
                        if (!copyInlinesOnly || !(attachment3 is ReferenceAttachment))
                        {
                            using (Attachment attachment4 = attachment3.CreateCopy(targetCollection, new BodyFormat?(this.parameters.TargetFormat)))
                            {
                                attachmentLink.MakeAttachmentChanges(attachment4, flag);
                                if (targetIsPlainText)
                                {
                                    attachment4.IsInline = false;
                                }
                                attachment4.Save();
                            }
                        }
                    }
                }
            }
        }
Esempio n. 13
0
 protected virtual void BuildBody(BodyConversionCallbacks callbacks)
 {
     ReplyForwardCommon.CopyBodyWithPrefix(this.originalItem.Body, this.newItem.Body, this.parameters, callbacks);
 }
Esempio n. 14
0
 protected abstract void BuildAttachments(BodyConversionCallbacks callbacks, InboundConversionOptions optionsForSmime);
Esempio n. 15
0
 protected override void BuildAttachments(BodyConversionCallbacks callbacks, InboundConversionOptions optionsForSmime)
 {
     base.CopyAttachments(callbacks, this.template.AttachmentCollection, this.newItem.AttachmentCollection, false, this.template.Body.Format == BodyFormat.TextPlain, optionsForSmime);
 }
Esempio n. 16
0
        internal static void CopyBodyWithPrefix(Body sourceBody, Body targetBody, ReplyForwardConfiguration configuration, BodyConversionCallbacks callbacks)
        {
            ReplyForwardCommon.CheckRtf(sourceBody.RawFormat, targetBody.RawFormat);
            BodyReadConfiguration  configuration2         = new BodyReadConfiguration(sourceBody.RawFormat, sourceBody.RawCharset.Name);
            BodyWriteConfiguration bodyWriteConfiguration = new BodyWriteConfiguration(sourceBody.RawFormat, sourceBody.RawCharset.Name);

            bodyWriteConfiguration.SetTargetFormat(configuration.TargetFormat, sourceBody.Charset);
            if (!string.IsNullOrEmpty(configuration.BodyPrefix))
            {
                bodyWriteConfiguration.AddInjectedText(configuration.BodyPrefix, null, configuration.BodyPrefixFormat);
            }
            if (callbacks.HtmlCallback != null || callbacks.RtfCallback != null)
            {
                bodyWriteConfiguration.HtmlCallback = callbacks.HtmlCallback;
                bodyWriteConfiguration.RtfCallback  = callbacks.RtfCallback;
                if (!configuration.ShouldSkipFilterHtmlOnBodyWrite)
                {
                    bodyWriteConfiguration.HtmlFlags = HtmlStreamingFlags.FilterHtml;
                }
            }
            using (Stream stream = sourceBody.OpenReadStream(configuration2))
            {
                using (Stream stream2 = targetBody.OpenWriteStream(bodyWriteConfiguration))
                {
                    Util.StreamHandler.CopyStreamData(stream, stream2);
                }
            }
        }
Esempio n. 17
0
 protected override void BuildAttachments(BodyConversionCallbacks callbacks, InboundConversionOptions optionsForSmime)
 {
     base.CopyAttachments(callbacks, this.originalItem.AttachmentCollection, this.newItem.AttachmentCollection, true, this.parameters.TargetFormat == BodyFormat.TextPlain, optionsForSmime);
 }