Beispiel #1
0
 public AttachmentWellInfo(AttachmentCollection collection, Attachment attachment, bool isJunkOrPhishing)
 {
     this.collection   = collection;
     this.attachmentId = attachment.Id;
     if (isJunkOrPhishing)
     {
         this.attachmentLevel = AttachmentPolicy.Level.Block;
     }
     else
     {
         this.attachmentLevel = AttachmentLevelLookup.GetAttachmentLevel(attachment, UserContextManager.GetUserContext());
     }
     this.attachmentType = attachment.AttachmentType;
     this.fileName       = attachment.FileName;
     if (this.attachmentType == AttachmentType.EmbeddedMessage)
     {
         using (Item itemAsReadOnly = ((ItemAttachment)attachment).GetItemAsReadOnly(null))
         {
             this.displayName = AttachmentUtility.GetEmbeddedAttachmentDisplayName(itemAsReadOnly);
         }
         this.fileExtension = ".msg";
     }
     else
     {
         this.displayName   = attachment.DisplayName;
         this.fileExtension = ((attachment.FileExtension == null) ? string.Empty : attachment.FileExtension);
     }
     this.isInline       = attachment.IsInline;
     this.attachmentSize = attachment.Size;
     this.attachmentName = AttachmentUtility.CalculateAttachmentName(this.displayName, this.fileName);
     this.mimeType       = AttachmentUtility.CalculateContentType(attachment);
     this.textCharset    = attachment.TextCharset;
 }
        // Token: 0x0600071C RID: 1820 RVA: 0x00037B9C File Offset: 0x00035D9C
        private void ProcessAttachment(Attachment attachment, HttpContext httpContext, BlockStatus blockStatus)
        {
            if (attachment == null)
            {
                throw new ArgumentNullException("attachment");
            }
            OwaContext  owaContext  = OwaContext.Get(httpContext);
            UserContext userContext = owaContext.UserContext;
            Stream      stream      = null;

            try
            {
                StreamAttachmentBase streamAttachment = AttachmentUtility.GetStreamAttachment(attachment);
                if (streamAttachment == null)
                {
                    ExTraceGlobals.AttachmentHandlingTracer.TraceError((long)this.GetHashCode(), "AttachmentHandler.ProcessAttachment: attachment is not derived from AttachmentStream");
                }
                else
                {
                    AttachmentPolicy.Level attachmentLevel = AttachmentLevelLookup.GetAttachmentLevel(streamAttachment, userContext);
                    if (attachmentLevel == AttachmentPolicy.Level.Block)
                    {
                        Utilities.TransferToErrorPage(owaContext, LocalizedStrings.GetNonEncoded(-2000404449), LocalizedStrings.GetNonEncoded(-615885395));
                    }
                    else
                    {
                        string fileName = AttachmentUtility.CalculateAttachmentName(streamAttachment.DisplayName, streamAttachment.FileName);
                        string text     = streamAttachment.FileExtension;
                        if (text == null)
                        {
                            text = string.Empty;
                        }
                        string empty       = string.Empty;
                        bool   contentType = this.GetContentType(httpContext, streamAttachment, attachmentLevel, out empty);
                        bool   isInline    = this.GetIsInline(streamAttachment, attachmentLevel);
                        stream = AttachmentUtility.GetStream(streamAttachment);
                        if (stream == null)
                        {
                            ExTraceGlobals.AttachmentHandlingTracer.TraceError((long)this.GetHashCode(), "AttachmentHandler.ProcessAttachment: Image conversion of OLE attachment failure");
                        }
                        else
                        {
                            AttachmentHandler.SendDocumentContentToHttpStream(httpContext, stream, fileName, text, empty, isInline, streamAttachment.TextCharset, blockStatus, attachmentLevel, contentType);
                        }
                    }
                }
            }
            finally
            {
                if (stream != null)
                {
                    stream.Dispose();
                }
            }
        }
Beispiel #3
0
 public AttachmentWellInfo(OwaStoreObjectId owaConversationId, AttachmentInfo attachmentInfo, bool isJunkOrPhishing)
 {
     this.messageId    = OwaStoreObjectId.CreateFromStoreObjectId(attachmentInfo.MessageId, owaConversationId);
     this.attachmentId = attachmentInfo.AttachmentId;
     if (isJunkOrPhishing)
     {
         this.attachmentLevel = AttachmentPolicy.Level.Block;
     }
     else
     {
         this.attachmentLevel = AttachmentLevelLookup.GetAttachmentLevel(attachmentInfo, UserContextManager.GetUserContext());
     }
     this.attachmentType = attachmentInfo.AttachmentType;
     this.fileName       = attachmentInfo.FileName;
     this.displayName    = attachmentInfo.DisplayName;
     this.isInline       = attachmentInfo.IsInline;
     this.attachmentSize = attachmentInfo.Size;
     this.fileExtension  = attachmentInfo.FileExtension;
     this.attachmentName = AttachmentUtility.CalculateAttachmentName(attachmentInfo.DisplayName, attachmentInfo.FileName);
     this.mimeType       = attachmentInfo.ContentType;
 }
Beispiel #4
0
 public AttachmentWellInfo(AttachmentCollection collection, AttachmentLink attachmentLink, bool isJunkOrPhishing)
 {
     this.collection   = collection;
     this.attachmentId = attachmentLink.AttachmentId;
     if (isJunkOrPhishing)
     {
         this.attachmentLevel = AttachmentPolicy.Level.Block;
     }
     else
     {
         this.attachmentLevel = AttachmentLevelLookup.GetAttachmentLevel(attachmentLink, UserContextManager.GetUserContext());
     }
     this.attachmentType = attachmentLink.AttachmentType;
     this.fileName       = attachmentLink.Filename;
     this.displayName    = attachmentLink.DisplayName;
     this.isInline       = attachmentLink.IsInline(true);
     this.attachmentSize = attachmentLink.Size;
     this.fileExtension  = attachmentLink.FileExtension;
     this.attachmentName = AttachmentUtility.CalculateAttachmentName(attachmentLink.DisplayName, attachmentLink.Filename);
     this.mimeType       = attachmentLink.ContentType;
 }