Пример #1
0
        internal static bool ResubmitApprovedMessage(MessageItem messageItem, TransportMailItem transportMailItem, string approverAddress)
        {
            DateTime   utcNow     = DateTime.UtcNow;
            HeaderList headerList = (transportMailItem.RootPart != null) ? transportMailItem.RootPart.Headers : null;

            if (!ModerationHelper.RestoreOriginalMessage(messageItem, transportMailItem, TraceHelper.ModeratedTransportTracer, TraceHelper.MessageProbeActivityId))
            {
                return(false);
            }
            transportMailItem.RootPart.Headers.RemoveAll("X-MS-Exchange-Organization-Approval-Approved");
            TextHeader textHeader = (TextHeader)Header.Create("X-MS-Exchange-Organization-Approval-Approved");

            textHeader.Value = (string)transportMailItem.Recipients[0].Email;
            foreach (MailRecipient mailRecipient in transportMailItem.Recipients)
            {
                if (mailRecipient.Status == Status.Ready)
                {
                    textHeader.Value = (string)mailRecipient.Email;
                    break;
                }
            }
            transportMailItem.RootPart.Headers.AppendChild(textHeader);
            if (transportMailItem.RootPart.Headers.FindFirst("X-MS-Exchange-Organization-Moderation-SavedArrivalTime") == null)
            {
                Header header = transportMailItem.RootPart.Headers.FindFirst("X-MS-Exchange-Organization-OriginalArrivalTime");
                string value  = null;
                if (header != null)
                {
                    value = header.Value;
                }
                if (!string.IsNullOrEmpty(value))
                {
                    transportMailItem.RootPart.Headers.AppendChild(new AsciiTextHeader("X-MS-Exchange-Organization-Moderation-SavedArrivalTime", value));
                }
            }
            TextHeader textHeader2     = (TextHeader)Header.Create("X-Moderation-Data");
            ExDateTime?valueAsNullable = messageItem.GetValueAsNullable <ExDateTime>(MessageItemSchema.ApprovalDecisionTime);

            if (valueAsNullable != null)
            {
                textHeader2.Value = valueAsNullable.ToString();
                transportMailItem.RootPart.Headers.AppendChild(textHeader2);
            }
            if (headerList != null)
            {
                Header[] array = headerList.FindAll(HeaderId.Received);
                foreach (Header header2 in array)
                {
                    Header header3 = Header.Create(HeaderId.Received);
                    header2.CopyTo(header3);
                    transportMailItem.RootPart.Headers.PrependChild(header3);
                }
            }
            transportMailItem.RootPart.Headers.RemoveAll("X-MS-Exchange-Organization-OriginalArrivalTime");
            transportMailItem.RootPart.Headers.AppendChild(new AsciiTextHeader("X-MS-Exchange-Organization-OriginalArrivalTime", Util.FormatOrganizationalMessageArrivalTime(utcNow)));
            transportMailItem.UpdateDirectionalityAndScopeHeaders();
            transportMailItem.UpdateCachedHeaders();
            MessageTrackingLog.TrackReceiveForApprovalRelease(transportMailItem, approverAddress, messageItem.InternetMessageId);
            return(true);
        }
Пример #2
0
        // Token: 0x0600048E RID: 1166 RVA: 0x00020938 File Offset: 0x0001EB38
        private bool ShouldSkipItem(object[] itemProperties)
        {
            string itemClass = itemProperties[this.propertyIndexHolder.ItemClassIndex] as string;

            if (this.IsConflictableItem(itemClass))
            {
                if (!base.ElcAssistant.ELCAssistantCalendarTaskRetentionEnabled)
                {
                    return(true);
                }
                ExDateTime?exDateTime = itemProperties[this.propertyIndexHolder.LastModifiedTime] as ExDateTime?;
                if (exDateTime == null)
                {
                    exDateTime = (itemProperties[this.propertyIndexHolder.CreationTimeIndex] as ExDateTime?);
                }
                if (exDateTime == null)
                {
                    PropertySynchronizerBase.Tracer.TraceDebug <ItemPropertySynchronizer>((long)this.GetHashCode(), "{0}: Item does not have PR_CREATION_TIME or PR_LAST_MODIFICATION_TIME.  Skipping.", this);
                    return(true);
                }
                if (ExDateTime.Compare(ExDateTime.GetNow(null), exDateTime.Value, TimeSpan.FromMinutes((double)base.ElcAssistant.ELCAssistantCalendarTaskRetentionProcessingTimeInMinutes)) == 0)
                {
                    return(true);
                }
            }
            return(false);
        }
        internal static ExDateTime?GetWallClockTime(PropertyBag.BasicPropertyStore propertyBag, GuidIdPropertyDefinition utcTimeProperty, PropertyTagPropertyDefinition legacyUtcTimeProperty, NativeStorePropertyDefinition[] timeZoneBlobPropertyDefinitions)
        {
            ExDateTime?normalizedTime = StartTimeProperty.GetNormalizedTime(propertyBag, utcTimeProperty, legacyUtcTimeProperty);

            if (normalizedTime == null)
            {
                return(null);
            }
            byte[] array = null;
            foreach (NativeStorePropertyDefinition propertyDefinition in timeZoneBlobPropertyDefinitions)
            {
                array = propertyBag.GetValueOrDefault <byte[]>(propertyDefinition);
                if (array != null)
                {
                    break;
                }
            }
            if (array == null)
            {
                ExTraceGlobals.StorageTracer.TraceWarning(0L, "Could not determine suitable time zone");
            }
            ExTimeZone exTimeZone = StartWallClockProperty.FindBestMatchingTimeZone(array);

            if (exTimeZone != null)
            {
                return(new ExDateTime?(exTimeZone.ConvertDateTime(normalizedTime.Value)));
            }
            return(new ExDateTime?(normalizedTime.Value));
        }
Пример #4
0
        protected ExDateTime?FetchDateTime(string name)
        {
            ExDateTime?result;

            lock (this.lockObject)
            {
                object obj2 = this.customSyncState[name];
                if (obj2 == null)
                {
                    result = null;
                }
                else if (obj2 is NullableData <DateTimeData, ExDateTime> )
                {
                    ExDateTime?data = ((NullableData <DateTimeData, ExDateTime>)obj2).Data;
                    result = data;
                }
                else
                {
                    if (!(obj2 is DateTimeData))
                    {
                        throw new AirSyncPermanentException(false)
                              {
                                  ErrorStringForProtocolLogger = "CorruptDateTimeObjectInSyncState"
                              };
                    }
                    ExDateTime?exDateTime = new ExDateTime?(((DateTimeData)obj2).Data);
                    result = exDateTime;
                }
            }
            return(result);
        }
Пример #5
0
        internal static ExDateTime?GetNormalizedTime(PropertyBag.BasicPropertyStore propertyBag, GuidIdPropertyDefinition utcTimeProperty, PropertyTagPropertyDefinition legacyUtcTimeProperty)
        {
            ExDateTime?valueAsNullable = propertyBag.GetValueAsNullable <ExDateTime>(utcTimeProperty);

            if (valueAsNullable == null)
            {
                if (legacyUtcTimeProperty != null)
                {
                    valueAsNullable = propertyBag.GetValueAsNullable <ExDateTime>(legacyUtcTimeProperty);
                }
                if (valueAsNullable == null)
                {
                    return(null);
                }
            }
            ExDateTime exDateTime = ExTimeZone.UtcTimeZone.ConvertDateTime(valueAsNullable.Value);

            byte[]     valueOrDefault = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.TimeZoneDefinitionStart);
            ExTimeZone legacyTimeZone;

            if (O12TimeZoneFormatter.TryParseTimeZoneBlob(valueOrDefault, string.Empty, out legacyTimeZone))
            {
                exDateTime = TimeZoneHelper.NormalizeUtcTime(exDateTime, legacyTimeZone);
            }
            exDateTime = StartTimeProperty.DynamicAdjustForAllDayEvent(propertyBag, exDateTime, utcTimeProperty == InternalSchema.MapiEndTime);
            return(new ExDateTime?(propertyBag.TimeZone.ConvertDateTime(exDateTime)));
        }
 private static bool IsValidComparisonFilter(ComparisonFilter comparisonFilter, ref ExDateTime?start, ref ExDateTime?end)
 {
     if (comparisonFilter == null)
     {
         return(false);
     }
     if (comparisonFilter.PropertyValue is ExDateTime)
     {
         ExDateTime value = (ExDateTime)comparisonFilter.PropertyValue;
         if (comparisonFilter.Property == CalendarItemInstanceSchema.EndTime && comparisonFilter.ComparisonOperator == ComparisonOperator.GreaterThanOrEqual)
         {
             if (start != null)
             {
                 return(false);
             }
             start = new ExDateTime?(value);
         }
         if (comparisonFilter.Property == CalendarItemInstanceSchema.StartTime && comparisonFilter.ComparisonOperator == ComparisonOperator.LessThanOrEqual)
         {
             if (end != null)
             {
                 return(false);
             }
             end = new ExDateTime?(value);
         }
     }
     return(true);
 }
Пример #7
0
 private static bool ValidateDateRanges(ref ExDateTime?startDate, ref ExDateTime?endDate)
 {
     if (startDate != null && endDate != null && startDate.Value > endDate.Value)
     {
         return(false);
     }
     if (startDate == null)
     {
         if (endDate == null)
         {
             startDate = new ExDateTime?(ExDateTime.Now.AddDays(-80.0));
         }
         else
         {
             startDate = new ExDateTime?(endDate.Value.AddDays(-80.0));
         }
     }
     if (endDate == null)
     {
         endDate = new ExDateTime?(startDate.Value.AddDays(80.0));
     }
     if (!startDate.Value.HasTimeZone)
     {
         startDate = new ExDateTime?(new ExDateTime(ExTimeZone.CurrentTimeZone, startDate.Value.UtcTicks));
     }
     if (!endDate.Value.HasTimeZone)
     {
         endDate = new ExDateTime?(new ExDateTime(ExTimeZone.CurrentTimeZone, endDate.Value.UtcTicks));
     }
     return(true);
 }
Пример #8
0
        // Token: 0x060025AB RID: 9643 RVA: 0x000DA3B0 File Offset: 0x000D85B0
        private void AddResponseMessageInfobarToRequestMessage(Infobar infobar)
        {
            Strings.IDs?ds = null;
            switch (this.sharingMessage.SharingResponseType)
            {
            case SharingResponseType.Allowed:
                ds = new Strings.IDs?(-310218305);
                break;

            case SharingResponseType.Denied:
                ds = new Strings.IDs?(1130758124);
                break;
            }
            if (ds != null)
            {
                ExDateTime?sharingResponseTime = this.sharingMessage.SharingResponseTime;
                string     text  = string.Empty;
                string     text2 = string.Empty;
                if (sharingResponseTime != null)
                {
                    text  = sharingResponseTime.Value.ToString(this.userContext.UserOptions.DateFormat);
                    text2 = sharingResponseTime.Value.ToString(this.userContext.UserOptions.TimeFormat);
                }
                SanitizedHtmlString messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(ds.Value), new object[]
                {
                    text,
                    text2
                });
                infobar.AddMessage(messageHtml, InfobarMessageType.Informational);
            }
        }
Пример #9
0
 protected static Restriction CreateOneOrTwoTimesRestrictions(ExDateTime?before, ExDateTime?after)
 {
     Restriction[] array = null;
     if (before != null && after != null)
     {
         array = new Restriction[2];
     }
     if (before != null)
     {
         Restriction restriction = Condition.CreateDateTimePropertyRestriction(PropTag.MessageDeliveryTime, before.Value, Restriction.RelOp.LessThan);
         if (after == null)
         {
             return(restriction);
         }
         array[0] = restriction;
     }
     if (after != null)
     {
         Restriction restriction2 = Condition.CreateDateTimePropertyRestriction(PropTag.MessageDeliveryTime, after.Value, Restriction.RelOp.GreaterThan);
         if (before == null)
         {
             return(restriction2);
         }
         array[1] = restriction2;
     }
     return(Restriction.And(array));
 }
        protected void RenderSelectedDay()
        {
            ExDateTime date       = ExDateTime.Now.Date;
            ExDateTime?exDateTime = null;

            foreach (ExDateTime value in this.days)
            {
                if (value.Date.Equals(date))
                {
                    exDateTime = new ExDateTime?(value);
                    break;
                }
            }
            if (exDateTime == null)
            {
                if (this.viewType == CalendarViewType.Monthly && this.days[0].Year == date.Year && this.days[0].Month == date.Month)
                {
                    exDateTime = new ExDateTime?(date);
                }
                else
                {
                    exDateTime = new ExDateTime?(this.days[0]);
                }
            }
            base.Response.Output.Write("new Date(\"");
            base.Response.Output.Write(DateTimeUtilities.GetJavascriptDate(exDateTime.Value));
            base.Response.Output.Write("\")");
        }
Пример #11
0
        public static ApprovalRequestUpdater.Result TryUpdateExistingApprovalRequest(MessageItem updateMessage)
        {
            updateMessage.Load(ApprovalRequestUpdater.ApprovalRequestUpdateProperties);
            int?       valueAsNullable  = updateMessage.GetValueAsNullable <int>(MessageItemSchema.ApprovalDecision);
            string     valueOrDefault   = updateMessage.GetValueOrDefault <string>(MessageItemSchema.ApprovalDecisionMaker);
            string     valueOrDefault2  = updateMessage.GetValueOrDefault <string>(MessageItemSchema.ApprovalRequestMessageId);
            ExDateTime?valueAsNullable2 = updateMessage.GetValueAsNullable <ExDateTime>(MessageItemSchema.ApprovalDecisionTime);

            if (valueAsNullable == null)
            {
                ApprovalRequestUpdater.diag.TraceDebug(0L, "Invalid update becasue there's no decision.");
                return(ApprovalRequestUpdater.Result.InvalidUpdateMessage);
            }
            if (!ApprovalRequestUpdater.IsDecisionExpiry(valueAsNullable.Value) && string.IsNullOrEmpty(valueOrDefault))
            {
                ApprovalRequestUpdater.diag.TraceDebug(0L, "Invalid update becasue there's no decisionMaker");
                return(ApprovalRequestUpdater.Result.InvalidUpdateMessage);
            }
            if (string.IsNullOrEmpty(valueOrDefault2))
            {
                ApprovalRequestUpdater.diag.TraceDebug(0L, "Invalid update becasue there's no messageId");
                return(ApprovalRequestUpdater.Result.InvalidUpdateMessage);
            }
            if (valueAsNullable2 == null)
            {
                ApprovalRequestUpdater.diag.TraceDebug(0L, "Invalid update becasue there's no decisionTime");
                return(ApprovalRequestUpdater.Result.InvalidUpdateMessage);
            }
            return(ApprovalRequestUpdater.FindAndUpdateExistingApprovalRequest(updateMessage, valueAsNullable.Value, valueOrDefault, valueAsNullable2.Value, valueOrDefault2));
        }
Пример #12
0
        public string GenerateOldWhen()
        {
            ExDateTime?valueAsNullable  = base.GetValueAsNullable <ExDateTime>(InternalSchema.OldStartWhole);
            ExDateTime?valueAsNullable2 = base.GetValueAsNullable <ExDateTime>(InternalSchema.OldEndWhole);

            return(CalendarItem.GenerateWhenForSingleInstance(valueAsNullable, valueAsNullable2).ToString(base.Session.InternalPreferedCulture));
        }
Пример #13
0
        protected override void InternalUpdateSequencingProperties(bool isToAllAttendees, MeetingMessage message, int minSequenceNumber, int?seriesSequenceNumber = null)
        {
            ExDateTime now = ExDateTime.GetNow(base.PropertyBag.ExTimeZone);

            base.OwnerCriticalChangeTime = now;
            int appointmentSequenceNumber     = base.AppointmentSequenceNumber;
            int appointmentLastSequenceNumber = this.AppointmentLastSequenceNumber;
            int valueOrDefault = base.GetValueOrDefault <int>(InternalSchema.CdoSequenceNumber);
            int num            = Math.Max(minSequenceNumber, Math.Max(appointmentSequenceNumber, Math.Max(appointmentLastSequenceNumber, valueOrDefault)));

            if (base.MeetingRequestWasSent)
            {
                base.LocationIdentifierHelperInstance.SetLocationIdentifier(40959U);
                num++;
            }
            if (isToAllAttendees)
            {
                base.LocationIdentifierHelperInstance.SetLocationIdentifier(51573U);
                this[InternalSchema.AppointmentSequenceTime] = now;
                base.AppointmentSequenceNumber = num;
            }
            this.AppointmentLastSequenceNumber = num;
            if (message != null)
            {
                message[InternalSchema.OwnerCriticalChangeTime]   = now;
                message[InternalSchema.AppointmentSequenceNumber] = num;
                ExDateTime?valueAsNullable = base.GetValueAsNullable <ExDateTime>(InternalSchema.AppointmentSequenceTime);
                message[InternalSchema.AppointmentSequenceTime] = ((valueAsNullable != null) ? valueAsNullable.Value : now);
            }
            base.LocationIdentifierHelperInstance.SetLocationIdentifier(37237U, LastChangeAction.UpdateSequenceNumber);
        }
Пример #14
0
        public static ExDateTime?ToEcpExDateTime(this string dateTimeString, string parseFormat)
        {
            if (dateTimeString.IsNullOrBlank())
            {
                return(null);
            }
            ExDateTime?result;

            try
            {
                if (EacRbacPrincipal.Instance.UserTimeZone != null)
                {
                    result = new ExDateTime?(ExDateTime.ParseExact(EacRbacPrincipal.Instance.UserTimeZone, dateTimeString, parseFormat, CultureInfo.InvariantCulture));
                }
                else
                {
                    int browserTimeZoneOffsetMinutes = EcpDateTimeHelper.GetBrowserTimeZoneOffsetMinutes();
                    result = new ExDateTime?(ExDateTime.ParseExact(ExTimeZone.UtcTimeZone, dateTimeString, parseFormat, CultureInfo.InvariantCulture).AddMinutes((double)browserTimeZoneOffsetMinutes));
                }
            }
            catch (FormatException ex)
            {
                ExTraceGlobals.EventLogTracer.TraceError <string, string>(0, 0L, "Fail to parse the date time string: {0}. Got the exception of '{1}'.", dateTimeString, ex.Message);
                result = null;
            }
            return(result);
        }
        public static void SaveMailboxSyncStatus(IMailboxSession session, ExDateTime?nextReplicationTime, MailboxAssociationProcessingFlags?mailboxAssociationProcessingFlags)
        {
            ArgumentValidator.ThrowIfNull("session", session);
            bool flag = false;

            if (nextReplicationTime != null)
            {
                LocalAssociationStore.Tracer.TraceDebug <ExDateTime?>(0L, "LocalAssociationStore::SaveMailboxSyncStatus. Setting NextReplicationTime = {0}", nextReplicationTime);
                session.Mailbox[MailboxSchema.MailboxAssociationNextReplicationTime] = nextReplicationTime;
                flag = true;
            }
            if (mailboxAssociationProcessingFlags != null)
            {
                LocalAssociationStore.Tracer.TraceDebug <MailboxAssociationProcessingFlags?>(0L, "LocalAssociationStore::SaveMailboxSyncStatus. Setting ProcessingFlags = {0}", mailboxAssociationProcessingFlags);
                session.Mailbox[MailboxSchema.MailboxAssociationProcessingFlags] = mailboxAssociationProcessingFlags;
                flag = true;
            }
            if (flag)
            {
                LocalAssociationStore.Tracer.TraceDebug(0L, "LocalAssociationStore::SaveMailboxSyncStatus. Saving and reloading mailbox table.");
                session.Mailbox.Save();
                session.Mailbox.Load();
                return;
            }
            LocalAssociationStore.Tracer.TraceDebug(0L, "LocalAssociationStore::SaveMailboxSyncStatus. No changes were detected.");
        }
Пример #16
0
        protected List <StoreObjectId> GetFilteredItemIds(StoreObjectId localFolderId, DateTime?createdBefore, Func <IStorePropertyBag, bool> filter)
        {
            HashSet <StoreObjectId> localItemIds = this.GetLocalItemIds(localFolderId);
            List <StoreObjectId>    list         = new List <StoreObjectId>();

            foreach (IConversationTreeNode conversationTreeNode in this.ConversationTree)
            {
                foreach (IStorePropertyBag storePropertyBag in conversationTreeNode.StorePropertyBags)
                {
                    StoreObjectId objectId = ((VersionedId)storePropertyBag.TryGetProperty(ItemSchema.Id)).ObjectId;
                    if (localItemIds.Contains(objectId))
                    {
                        if (createdBefore != null && createdBefore != null)
                        {
                            ExDateTime?exDateTime = storePropertyBag.TryGetProperty(ItemSchema.ReceivedTime) as ExDateTime?;
                            if (exDateTime == null || (exDateTime.Value.UniversalTime - createdBefore.Value.ToUniversalTime()).TotalSeconds > 1.0)
                            {
                                continue;
                            }
                        }
                        if (filter == null || filter(storePropertyBag))
                        {
                            list.Add(objectId);
                        }
                    }
                }
            }
            return(list);
        }
Пример #17
0
        private static List <RecurrenceManager.ExceptionSummary> GetExceptionSumaryList(AttachmentCollection attachments)
        {
            List <RecurrenceManager.ExceptionSummary> list = new List <RecurrenceManager.ExceptionSummary>(attachments.Count);

            foreach (AttachmentHandle handle in attachments.GetAllHandles())
            {
                if (CoreAttachmentCollection.IsCalendarException(handle))
                {
                    using (Attachment attachment = attachments.Open(handle, null))
                    {
                        ExDateTime?valueAsNullable = attachment.GetValueAsNullable <ExDateTime>(InternalSchema.AppointmentExceptionStartTime);
                        if (valueAsNullable != null)
                        {
                            ExDateTime?valueAsNullable2 = attachment.GetValueAsNullable <ExDateTime>(InternalSchema.AppointmentExceptionEndTime);
                            if (valueAsNullable2 != null)
                            {
                                ExDateTime utcStart = ExTimeZone.UtcTimeZone.ConvertDateTime(valueAsNullable.Value);
                                ExDateTime utcEnd   = ExTimeZone.UtcTimeZone.ConvertDateTime(valueAsNullable2.Value);
                                list.Add(new RecurrenceManager.ExceptionSummary(handle, utcStart, utcEnd));
                            }
                        }
                    }
                }
            }
            return(list);
        }
Пример #18
0
 internal static ExDateTime?GetUniversalDateTime(ExDateTime?dateTime)
 {
     if (dateTime == null)
     {
         return(null);
     }
     return(new ExDateTime?(dateTime.Value.ToUtc()));
 }
Пример #19
0
 public static Identity ToIdentity(this ExDateTime?dateTimeValue)
 {
     if (dateTimeValue == null)
     {
         return(null);
     }
     return(new Identity(dateTimeValue.ToUserDateTimeGeneralFormatString(), dateTimeValue.ToUserWeekdayDateString()));
 }
 public static string GetValueString(ExDateTime?nullableExDateTime)
 {
     if (nullableExDateTime != null)
     {
         return(nullableExDateTime.Value.ToString(CultureInfo.InvariantCulture));
     }
     return(null);
 }
Пример #21
0
 public static ExDateTime?GetValidExDateTime(ExDateTime?dateTimeValue)
 {
     if (dateTimeValue != null && dateTimeValue.Value == Util.Date1601Utc)
     {
         return(null);
     }
     return(dateTimeValue);
 }
Пример #22
0
        // Token: 0x06000957 RID: 2391 RVA: 0x0003EB14 File Offset: 0x0003CD14
        public void UpdateOldFields(MeetingRequest mtgReq)
        {
            ExDateTime?oldStartTime = null;
            ExDateTime?oldEndTime   = null;

            CalendarInfo.GetOldFields(mtgReq, out oldStartTime, out oldEndTime);
            this.UpdateOldFields(oldStartTime, oldEndTime);
        }
Пример #23
0
 public static string ToUserDateTimeGeneralFormatString(this ExDateTime?exDateTimeValue)
 {
     if (exDateTimeValue == null)
     {
         return(string.Empty);
     }
     return(exDateTimeValue.Value.ToUserDateTimeGeneralFormatString());
 }
 private DateTime GetStartDate(ExDateTime?startDate)
 {
     if (startDate == null)
     {
         startDate = new ExDateTime?(ExDateTime.Now.AddDays(-2.0));
     }
     return(startDate.Value.Date.UniversalTime);
 }
 // Token: 0x060010E8 RID: 4328 RVA: 0x00045CD4 File Offset: 0x00043ED4
 private string DateTimeToString(ExDateTime?dateTime)
 {
     if (dateTime == null)
     {
         return(string.Empty);
     }
     return(dateTime.Value.UtcTicks.ToString(CultureInfo.InvariantCulture));
 }
Пример #26
0
        // Token: 0x060010F3 RID: 4339 RVA: 0x00046BD0 File Offset: 0x00044DD0
        private SyncCalendarItemType GetTypedItem(PropertyDefinition[] xsoRequiredProperties, object[] itemRow, out ExDateTime itemStart)
        {
            itemStart = ExDateTime.MinValue;
            StoreId          itemId           = null;
            string           uid              = null;
            CalendarItemType calendarItemType = CalendarItemType.Single;
            ExDateTime?      startWallClock   = null;
            ExDateTime?      end              = null;
            ExDateTime?      endWallClock     = null;
            Dictionary <PropertyDefinition, object> dictionary = new Dictionary <PropertyDefinition, object>(itemRow.Length);

            for (int i = 0; i < xsoRequiredProperties.Length; i++)
            {
                if (!(itemRow[i] is PropertyError) && !dictionary.ContainsKey(xsoRequiredProperties[i]))
                {
                    if (xsoRequiredProperties[i] == CalendarItemInstanceSchema.StartTime)
                    {
                        itemStart = (ExDateTime)itemRow[i];
                    }
                    else if (xsoRequiredProperties[i] == CalendarItemInstanceSchema.StartWallClock)
                    {
                        startWallClock = new ExDateTime?((ExDateTime)itemRow[i]);
                    }
                    else if (xsoRequiredProperties[i] == CalendarItemInstanceSchema.EndTime)
                    {
                        end = new ExDateTime?((ExDateTime)itemRow[i]);
                    }
                    else if (xsoRequiredProperties[i] == CalendarItemInstanceSchema.EndWallClock)
                    {
                        endWallClock = new ExDateTime?((ExDateTime)itemRow[i]);
                    }
                    else if (xsoRequiredProperties[i] == ItemSchema.Id)
                    {
                        itemId = (VersionedId)itemRow[i];
                    }
                    else if (xsoRequiredProperties[i] == CalendarItemBaseSchema.CalendarItemType)
                    {
                        calendarItemType = (CalendarItemType)itemRow[i];
                    }
                    else if (xsoRequiredProperties[i] == CalendarItemBaseSchema.GlobalObjectId)
                    {
                        uid = new GlobalObjectId((byte[])itemRow[i]).Uid;
                    }
                    dictionary.Add(xsoRequiredProperties[i], itemRow[i]);
                }
            }
            return(new SyncCalendarItemType
            {
                ItemId = itemId,
                UID = uid,
                CalendarItemType = calendarItemType,
                Start = new ExDateTime?(itemStart),
                StartWallClock = startWallClock,
                End = end,
                EndWallClock = endWallClock,
                RowData = dictionary
            });
        }
        private static bool IsTextMessageStuckInOutbox(MailboxSession session, E164Number smsSyncPhoneNumber, ExDateTime oldestBoundary, ExDateTime newestBoundary)
        {
            bool result;

            using (Folder folder = Folder.Bind(session, DefaultFolderType.Outbox))
            {
                if (folder.ItemCount == 0)
                {
                    result = false;
                }
                else
                {
                    using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, null, new SortBy[]
                    {
                        new SortBy(StoreObjectSchema.LastModifiedTime, SortOrder.Ascending)
                    }, new PropertyDefinition[]
                    {
                        StoreObjectSchema.LastModifiedTime,
                        StoreObjectSchema.ItemClass,
                        ItemSchema.SentRepresentingType,
                        ItemSchema.SentRepresentingEmailAddress
                    }))
                    {
                        if (!queryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(ComparisonOperator.GreaterThanOrEqual, StoreObjectSchema.LastModifiedTime, oldestBoundary)))
                        {
                            result = false;
                        }
                        else
                        {
                            while (queryResult.SeekToCondition(SeekReference.OriginCurrent, new ComparisonFilter(ComparisonOperator.Equal, StoreObjectSchema.ItemClass, "IPM.Note.Mobile.SMS")))
                            {
                                IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(1);
                                if (propertyBags == null || propertyBags.Length == 0)
                                {
                                    return(false);
                                }
                                string b = propertyBags[0].TryGetProperty(ItemSchema.SentRepresentingType) as string;
                                if (string.Equals("MOBILE", b, StringComparison.OrdinalIgnoreCase))
                                {
                                    string     number     = propertyBags[0].TryGetProperty(ItemSchema.SentRepresentingEmailAddress) as string;
                                    E164Number e164Number = null;
                                    if (E164Number.TryParse(number, out e164Number) && e164Number.Equals(smsSyncPhoneNumber, true))
                                    {
                                        ExDateTime?exDateTime = propertyBags[0].TryGetProperty(StoreObjectSchema.LastModifiedTime) as ExDateTime?;
                                        if (exDateTime != null)
                                        {
                                            return(exDateTime <= newestBoundary);
                                        }
                                    }
                                }
                            }
                            result = false;
                        }
                    }
                }
            }
            return(result);
        }
Пример #28
0
        protected UpdateRumInfo(ExDateTime?originalStartTime, IList <Attendee> attendees, CalendarInconsistencyFlag inconsistencyFlag) : base(RumType.Update, originalStartTime, attendees)
        {
            EnumValidator <CalendarInconsistencyFlag> .ThrowIfInvalid(inconsistencyFlag, "inconsistencyFlag");

            this.InconsistencyFlagList = new List <CalendarInconsistencyFlag>(1)
            {
                inconsistencyFlag
            };
        }
        // Token: 0x06000E48 RID: 3656 RVA: 0x00055A2C File Offset: 0x00053C2C
        protected override void InvokeInternal(InvokeArgs invokeArgs, List <KeyValuePair <string, object> > customDataToLog)
        {
            MailboxSession mailboxSession = invokeArgs.StoreSession as MailboxSession;

            if (mailboxSession == null)
            {
                return;
            }
            ADUser aduser = SharingPolicyAssistant.GetADUser(mailboxSession.MailboxOwner, mailboxSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid));

            if (aduser == null)
            {
                return;
            }
            if (ADRecipient.IsSystemMailbox(aduser.RecipientTypeDetails))
            {
                SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal, RecipientTypeDetails>((long)this.GetHashCode(), "{0}: Skipping the mailbox processing as it is a system mailbox. RecipientTypeDetails {1}.", mailboxSession.MailboxOwner, aduser.RecipientTypeDetails);
                return;
            }
            SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "{0}: Begin process mailbox", mailboxSession.MailboxOwner);
            SharingPolicyCache sharingPolicyCache = SharingPolicyCache.Get(aduser);
            bool flag = false;

            if (sharingPolicyCache != null)
            {
                if (!this.IsMailboxNeedingPolicyUpdate(mailboxSession, sharingPolicyCache))
                {
                    return;
                }
                flag = this.ApplyPolicy(mailboxSession, sharingPolicyCache.Policy);
            }
            if (flag)
            {
                SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "{0}: Storing applied policy to mailbox table.", mailboxSession.MailboxOwner);
                SharingPolicyAssistant.UpdateMailboxData(mailboxSession.Mailbox, (aduser.SharingPolicy == null && !sharingPolicyCache.BelongsToDehydratedContainer) ? SharingPolicyCache.DynamicDefaultPolicy.ObjectGuid.ToByteArray() : sharingPolicyCache.Policy.Id.ObjectGuid.ToByteArray(), sharingPolicyCache.Hash);
            }
            else
            {
                SharingPolicyAssistant.Tracer.TraceWarning <IExchangePrincipal>(0L, "{0}: Unable to find sharing policy for this mailbox.", mailboxSession.MailboxOwner);
                ExDateTime?exDateTime = mailboxSession.Mailbox.TryGetProperty(MailboxSchema.LastSharingPolicyAppliedTime) as ExDateTime?;
                byte[]     array      = mailboxSession.Mailbox.TryGetProperty(MailboxSchema.LastSharingPolicyAppliedHash) as byte[];
                if (exDateTime == null || array != null)
                {
                    SharingPolicyAssistant.UpdateMailboxData(mailboxSession.Mailbox, null, null);
                }
                else
                {
                    TimeSpan retryTimeSpan = ExDateTime.UtcNow.Subtract(exDateTime.Value);
                    if (ExDateTime.UtcNow.Subtract(exDateTime.Value) > SharingPolicyAssistant.RetryThresholdLimit)
                    {
                        SharingPolicyAssistant.SubmitInformationalWatson(mailboxSession.MailboxOwner, retryTimeSpan);
                        SharingPolicyAssistant.UpdateMailboxData(mailboxSession.Mailbox, null, null);
                    }
                }
            }
            SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "{0}: End process mailbox", mailboxSession.MailboxOwner);
        }
Пример #30
0
 public static void SetExDateTimeProperty(IPropertyBag item, PropertyDefinition propertyDefinition, ExDateTime?value)
 {
     if (value == null)
     {
         item[propertyDefinition] = Util.Date1601Utc;
         return;
     }
     item[propertyDefinition] = value;
 }