Esempio n. 1
0
        public void GenerateReportBody(Stream outputStream, out Charset charset)
        {
            this.CheckDisposed("GenerateReportBody");
            if (outputStream == null)
            {
                throw new ArgumentNullException("outputStream");
            }
            CultureInfo cultureInfo;

            ReportMessage.GenerateReportBody(this, outputStream, out cultureInfo, out charset);
        }
Esempio n. 2
0
        internal static Stream GenerateReportBody(MessageItem message, DsnHumanReadableWriter dsnWriter, HeaderList headerList, out CultureInfo cultureInfo, out Charset charset)
        {
            MemoryStream memoryStream = new MemoryStream(ReportMessage.EstimateGeneratedBodySize(message));

            if (ObjectClass.IsDsn(message.ClassName))
            {
                ReportMessage.GenerateDsnBody(message, memoryStream, dsnWriter, headerList, out cultureInfo, out charset);
            }
            else
            {
                ReportMessage.GenerateReportBody(message, memoryStream, out cultureInfo, out charset);
            }
            return(memoryStream);
        }
Esempio n. 3
0
        public static MessageItem CreateNotReadNotification(MessageItem originalItem)
        {
            ExDateTime  utcNow      = ExDateTime.UtcNow;
            MessageItem messageItem = MessageItem.CreateInMemory(StoreObjectSchema.ContentConversionProperties);

            messageItem.ClassName = ObjectClass.MakeReportClassName(originalItem.ClassName, "IPNNRN");
            messageItem.SafeSetProperty(InternalSchema.ReportTime, utcNow);
            Participant participant = originalItem.ReadReceiptAddressee;

            if (null == participant)
            {
                if (null != originalItem.Sender)
                {
                    participant = originalItem.Sender;
                }
                else
                {
                    participant = originalItem.From;
                }
            }
            messageItem.Recipients.Add(participant, RecipientItemType.To);
            foreach (KeyValuePair <PropertyDefinition, PropertyDefinition> keyValuePair in RuleMessageUtils.NrnPropertyMap)
            {
                messageItem.SafeSetProperty(keyValuePair.Key, originalItem.TryGetProperty(keyValuePair.Value));
            }
            BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextHtml, originalItem.Body.RawCharset.Name);
            CultureInfo            formatProvider;

            using (Stream stream = messageItem.Body.OpenWriteStream(configuration))
            {
                Charset charset;
                ReportMessage.GenerateReportBody(messageItem, stream, out formatProvider, out charset);
            }
            messageItem.SafeSetProperty(InternalSchema.Subject, ServerStrings.NotRead.ToString(formatProvider) + originalItem.TryGetProperty(InternalSchema.Subject));
            byte[] parentBytes = originalItem.TryGetProperty(InternalSchema.ConversationIndex) as byte[];
            messageItem.SafeSetProperty(InternalSchema.ConversationIndex, ConversationIndex.CreateFromParent(parentBytes).ToByteArray());
            messageItem.SafeSetProperty(InternalSchema.ConversationTopic, StoreObject.SafePropertyValue(originalItem.TryGetProperty(InternalSchema.ConversationTopic), typeof(string), StoreObject.SafePropertyValue(originalItem.TryGetProperty(InternalSchema.NormalizedSubjectInternal), typeof(string), null)));
            messageItem.SafeSetProperty(InternalSchema.IsReadReceiptRequested, false);
            messageItem.SafeSetProperty(InternalSchema.IsDeliveryReceiptRequested, false);
            messageItem.SafeSetProperty(InternalSchema.IsNonDeliveryReceiptRequested, false);
            messageItem.SafeSetProperty(InternalSchema.NonReceiptReason, 0);
            messageItem.SafeSetProperty(InternalSchema.DiscardReason, 1);
            messageItem.SafeSetProperty(InternalSchema.OriginalDeliveryTime, utcNow);
            return(messageItem);
        }