Beispiel #1
0
        private static EnhancedStatusCode TryParseMimeStatusCode(int?mimeStatusCode)
        {
            EnhancedStatusCode result;

            if (mimeStatusCode != null && EnhancedStatusCode.TryParse(DsnMdnUtil.MimeStatusCodeToString(mimeStatusCode.Value), out result))
            {
                return(result);
            }
            return(null);
        }
Beispiel #2
0
        public static EnhancedStatusCode GetMimeDsnRecipientStatusCode(Recipient recipient)
        {
            int mimeDsnRecipientStatusCode = DsnMdnUtil.GetMimeDsnRecipientStatusCode(recipient.GetValueOrDefault <MapiDiagnosticCode>(InternalSchema.NdrDiagnosticCode, MapiDiagnosticCode.NoDiagnostic), recipient.GetValueOrDefault <NdrReasonCode>(InternalSchema.NdrReasonCode));
            EnhancedStatusCode result;

            if ((result = DsnMdnUtil.TryParseMimeStatusCode(recipient.GetValueAsNullable <int>(InternalSchema.NdrStatusCode))) == null)
            {
                result = (DsnMdnUtil.TryParseMimeStatusCode(new int?(mimeDsnRecipientStatusCode)) ?? DsnMdnUtil.TryParseMimeStatusCode(new int?(500)));
            }
            return(result);
        }
Beispiel #3
0
 internal static void CoreObjectUpdateSubjectPrefix(CoreItem coreItem)
 {
     if (coreItem.Session != null)
     {
         string          valueOrDefault = coreItem.PropertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass);
         LocalizedString localizedString;
         if (DsnMdnUtil.TryGetSubjectPrefix(valueOrDefault, out localizedString))
         {
             CultureInfo formatProvider = coreItem.Session.InternalPreferedCulture;
             if (ObjectClass.IsMdn(valueOrDefault))
             {
                 formatProvider = ReportMessage.GetMdnCulture(coreItem);
             }
             coreItem.PropertyBag[InternalSchema.SubjectPrefix] = localizedString.ToString(formatProvider);
         }
     }
 }
Beispiel #4
0
        private static void GenerateDsnBody(MessageItem message, Stream outputStream, DsnHumanReadableWriter dsnWriter, HeaderList headerList, out CultureInfo cultureInfo, out Charset charset)
        {
            message.Load(ReportMessageSchema.Instance.AutoloadProperties);
            MailboxSession          mailboxSession = message.Session as MailboxSession;
            List <DsnRecipientInfo> list           = new List <DsnRecipientInfo>(message.Recipients.Count);
            HashSet <string>        hashSet        = new HashSet <string>();

            foreach (Recipient recipient in message.Recipients)
            {
                list.Add(new DsnRecipientInfo(recipient.Participant.DisplayName, recipient.Participant.EmailAddress, recipient.Participant.RoutingType, DsnMdnUtil.GetMimeDsnRecipientStatusCode(recipient).Value, recipient.GetValueOrDefault <string>(InternalSchema.SupplementaryInfo)));
                string valueOrDefault = recipient.GetValueOrDefault <string>(InternalSchema.RemoteMta);
                if (!string.IsNullOrEmpty(valueOrDefault))
                {
                    hashSet.TryAdd(valueOrDefault);
                }
            }
            StringBuilder stringBuilder = new StringBuilder(hashSet.Count * 20);

            foreach (string value in hashSet)
            {
                stringBuilder.Append(value);
                stringBuilder.Append(", ");
            }
            dsnWriter.CreateDsnHumanReadableBody(outputStream, ReportMessage.GetDsnCultures(mailboxSession, headerList, dsnWriter), message.GetValueOrDefault <string>(InternalSchema.OriginalSubject), list, ReportMessage.GetDsnFlags(message.ClassName), message.GetValueOrDefault <string>(InternalSchema.ReportingMta, string.Empty), (stringBuilder.Length > 0) ? stringBuilder.ToString(0, stringBuilder.Length - ", ".Length) : null, null, headerList, out cultureInfo, out charset);
        }