Пример #1
0
 internal void AddDependentAddressCache(InboundAddressCache tnefAddressCache)
 {
     this.tnefRecipientList = tnefAddressCache.recipients;
     base.AddParticipantList(tnefAddressCache.recipients);
     base.ReplyTo.Resync(true);
     tnefAddressCache.ReplyTo.Resync(true);
     if (this.ReplaceMatchingEntries(base.ReplyTo, tnefAddressCache.ReplyTo))
     {
         base.ReplyTo.Resync(true);
     }
     if (base.ReplyTo.Count == 0 && tnefAddressCache.ReplyTo.Count != 0)
     {
         this.propertyBag[InternalSchema.MapiReplyToBlob]  = tnefAddressCache.ReplyTo.Blob;
         this.propertyBag[InternalSchema.MapiReplyToNames] = tnefAddressCache.ReplyTo.Names;
         this.replyTo = null;
     }
     foreach (ConversionItemParticipants.ParticipantDefinitionEntry participantDefinitionEntry in ConversionItemParticipants.ParticipantEntries)
     {
         Participant valueOrDefault = this.propertyBag.GetValueOrDefault <Participant>(participantDefinitionEntry.ParticipantProperty);
         if (valueOrDefault == null)
         {
             valueOrDefault = tnefAddressCache.propertyBag.GetValueOrDefault <Participant>(participantDefinitionEntry.ParticipantProperty);
             if (valueOrDefault != null && (participantDefinitionEntry.IsAlwaysResolvable || this.CanResolveParticipant(valueOrDefault) || valueOrDefault.RoutingType != "EX"))
             {
                 this.propertyBag.SetOrDeleteProperty(participantDefinitionEntry.ParticipantProperty, valueOrDefault);
             }
         }
     }
 }
Пример #2
0
        internal InboundMessageWriter(ICoreItem item, InboundConversionOptions options, MimeMessageLevel messageLevel)
        {
            StorageGlobals.TraceConstructIDisposable(this);
            this.disposeTracker    = this.GetDisposeTracker();
            this.parent            = null;
            this.isTopLevelMessage = (messageLevel == MimeMessageLevel.TopLevelMessage);
            this.SetItem(item, options, false);
            ConversionLimitsTracker conversionLimitsTracker = new ConversionLimitsTracker(options.Limits);
            InboundAddressCache     addressCache            = new InboundAddressCache(options, conversionLimitsTracker, messageLevel);

            this.SetAddressCache(addressCache, true);
            this.SetLimitsTracker(conversionLimitsTracker);
            this.componentType = ConversionComponentType.Message;
        }
Пример #3
0
        private InboundMessageWriter(InboundMessageWriter parent, ICoreItem item)
        {
            StorageGlobals.TraceConstructIDisposable(this);
            this.disposeTracker    = this.GetDisposeTracker();
            this.parent            = parent;
            this.isTopLevelMessage = false;
            this.SetItem(item, parent.ConversionOptions, true);
            ConversionLimitsTracker conversionLimitsTracker = parent.LimitsTracker;

            conversionLimitsTracker.StartEmbeddedMessage();
            InboundAddressCache addressCache = new InboundAddressCache(parent.ConversionOptions, conversionLimitsTracker, MimeMessageLevel.AttachedMessage);

            this.SetAddressCache(addressCache, true);
            this.SetLimitsTracker(conversionLimitsTracker);
            this.componentType = ConversionComponentType.Message;
        }
Пример #4
0
        internal static bool ICalToItem(Stream iCalStream, Item item, InboundAddressCache addressCache, bool suppressBodyPromotion, string charsetName, out LocalizedString errorMessage)
        {
            IList <LocalizedString> list = new List <LocalizedString>();
            string             text;
            IEnumerable <Item> enumerable = CalendarDocument.InternalICalToItems(iCalStream, charsetName, addressCache, suppressBodyPromotion ? new uint?(0U) : null, false, () => item, list, out text);
            bool flag = false;

            using (IEnumerator <Item> enumerator = enumerable.GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Item item2 = enumerator.Current;
                    if (item2.Validate().Length != 0)
                    {
                        ExTraceGlobals.ICalTracer.TraceDebug(0L, "CalendarDocument::ICalToItem. Validation error for promoted item.");
                        list.Add(ServerStrings.ValidationFailureAfterPromotion(string.Empty));
                    }
                    flag = (list.Count == 0);
                }
            }
            if (!flag)
            {
                CalendarDocument.AttachICalToItem(iCalStream, item);
            }
            if (list.Count == 0)
            {
                errorMessage = LocalizedString.Empty;
            }
            else if (list.Count == 1)
            {
                errorMessage = list[0];
            }
            else
            {
                errorMessage = LocalizedString.Join(Environment.NewLine, list.Cast <object>().ToArray <object>());
            }
            return(flag);
        }
Пример #5
0
 private void SetAddressCache(InboundAddressCache addressCache, bool ownsCache)
 {
     this.conversionAddressCache = addressCache;
     this.ownsAddressCache       = ownsCache;
 }
Пример #6
0
        internal static IEnumerable <Item> InternalICalToItems(Stream iCalStream, string charsetName, InboundAddressCache addressCache, uint?maxBodyLength, bool hasExceptionPromotion, Func <Item> getItem, IList <LocalizedString> errorStream, out string calendarName)
        {
            Util.ThrowOnNullArgument(iCalStream, "iCalStream");
            Util.ThrowOnNullArgument(addressCache, "addressCache");
            Util.ThrowOnNullArgument(errorStream, "errorStream");
            bool flag                           = false;
            LocalizedException ex               = null;
            Charset            charset          = Charset.GetCharset(charsetName ?? "utf-8");
            CalendarDocument   calendarDocument = new CalendarDocument();
            IEnumerable <Item> result;

            using (CalendarReader calendarReader = new CalendarReader(new StreamWrapper(iCalStream, false), charset.Name, CalendarComplianceMode.Loose))
            {
                ICalInboundContext calInboundContext = new ICalInboundContext(charset, errorStream, addressCache, addressCache.Options, calendarReader, maxBodyLength, hasExceptionPromotion);
                try
                {
                    flag = (calendarDocument.Parse(calInboundContext) && calendarDocument.vCalendar.Validate());
                }
                catch (InvalidCalendarDataException ex2)
                {
                    ex = ex2;
                }
                calendarName = calInboundContext.CalendarName;
                if (!flag)
                {
                    if (ex != null)
                    {
                        ExTraceGlobals.ICalTracer.TraceError <string>((long)calendarDocument.GetHashCode(), "CalendarDocument::InternalICalToItems. Found exception: '{0}'.", ex.Message);
                        errorStream.Add(ex.LocalizedString);
                    }
                    else if (errorStream.Count != 0)
                    {
                        ExTraceGlobals.ICalTracer.TraceError <int>((long)calendarDocument.GetHashCode(), "CalendarDocument::InternalICalToItems. {0} error found.", errorStream.Count);
                        errorStream.Add(ServerStrings.InvalidICalElement("VCALENDAR"));
                    }
                    result = Array <CalendarItemBase> .Empty;
                }
                else
                {
                    result = calendarDocument.vCalendar.Promote(getItem);
                }
            }
            return(result);
        }
Пример #7
0
 public ICalInboundContext(Charset charset, IList <LocalizedString> errorStream, InboundAddressCache addressCache, InboundConversionOptions options, CalendarReader reader, uint?maxBodyLength, bool hasExceptionPromotion) : base(charset, errorStream, addressCache)
 {
     Util.ThrowOnNullArgument(options, "options");
     if (!options.IgnoreImceaDomain)
     {
         Util.ThrowOnNullOrEmptyArgument(options.ImceaEncapsulationDomain, "options.ImceaEncapsulationDomain");
     }
     Util.ThrowOnNullArgument(reader, "reader");
     this.Options               = options;
     this.Reader                = reader;
     this.MaxBodyLength         = maxBodyLength;
     this.HasExceptionPromotion = hasExceptionPromotion;
     this.DeclaredTimeZones     = new Dictionary <string, ExTimeZone>(StringComparer.OrdinalIgnoreCase);
 }