// Token: 0x06000A39 RID: 2617 RVA: 0x00043718 File Offset: 0x00041918
        public bool IsEventInteresting(MapiEvent mapiEvent)
        {
            if (ObjectType.MAPI_MESSAGE != mapiEvent.ItemType)
            {
                return(false);
            }
            if (((MapiEventTypeFlags.ObjectCreated | MapiEventTypeFlags.ObjectModified | MapiEventTypeFlags.ObjectMoved | MapiEventTypeFlags.ObjectCopied) & mapiEvent.EventMask) == (MapiEventTypeFlags)0)
            {
                return(false);
            }
            if (!ObjectClass.IsSmsMessage(mapiEvent.ObjectClass))
            {
                return(false);
            }
            MailboxData fromCache = MailboxData.GetFromCache(mapiEvent.MailboxGuid);

            if (fromCache == null)
            {
                return(true);
            }
            StoreObjectId storeObjectId = null;

            using (fromCache.CreateReadLock())
            {
                storeObjectId = fromCache.DefaultOutboxFolderId;
            }
            if (storeObjectId == null)
            {
                return(false);
            }
            StoreObjectId objB  = (mapiEvent.ParentEntryId == null || mapiEvent.ParentEntryId.Length == 0) ? null : StoreObjectId.FromProviderSpecificId(mapiEvent.ParentEntryId);
            StoreObjectId objB2 = (mapiEvent.OldParentEntryId == null || mapiEvent.OldParentEntryId.Length == 0) ? null : StoreObjectId.FromProviderSpecificId(mapiEvent.OldParentEntryId);

            return((((MapiEventTypeFlags.ObjectCreated | MapiEventTypeFlags.ObjectModified | MapiEventTypeFlags.ObjectCopied) & mapiEvent.EventMask) == (MapiEventTypeFlags)0 || object.Equals(storeObjectId, objB)) && ((MapiEventTypeFlags.ObjectMoved & mapiEvent.EventMask) == (MapiEventTypeFlags)0 || object.Equals(storeObjectId, objB2) || object.Equals(storeObjectId, objB)));
        }
Ejemplo n.º 2
0
        // Token: 0x0600097A RID: 2426 RVA: 0x0003F83C File Offset: 0x0003DA3C
        public static void ExcludeDatabase(Guid databaseGuid)
        {
            HashSet <Guid> hashSet = null;

            lock (CalendarNotificationInitiator.mailboxGroups)
            {
                if (CalendarNotificationInitiator.mailboxGroups.ContainsKey(databaseGuid))
                {
                    hashSet = CalendarNotificationInitiator.mailboxGroups[databaseGuid];
                    CalendarNotificationInitiator.mailboxGroups.Remove(databaseGuid);
                }
            }
            if (hashSet == null)
            {
                return;
            }
            foreach (Guid mailboxGuid in hashSet)
            {
                MailboxData fromCache = MailboxData.GetFromCache(mailboxGuid);
                if (fromCache != null)
                {
                    using (fromCache.CreateWriteLock())
                    {
                        fromCache.Settings.Text  = null;
                        fromCache.Settings.Voice = null;
                        using (fromCache.Actions.SyncObj.CreateWriteLock())
                        {
                            CalendarNotificationInitiator.StopAll(fromCache);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 // Token: 0x060009E3 RID: 2531 RVA: 0x00041404 File Offset: 0x0003F604
 public bool IsEventInteresting(MapiEvent mapiEvent)
 {
     if (this.IsMailboxCreatedOrConnected(mapiEvent) || this.IsMailboxDeletedOrDisconnected(mapiEvent))
     {
         return(true);
     }
     if (ObjectType.MAPI_MESSAGE != mapiEvent.ItemType)
     {
         return(false);
     }
     if (this.OwaUserOptionConfigurationObjectClass.Equals(mapiEvent.ObjectClass, StringComparison.InvariantCultureIgnoreCase) || this.TextMessagingAccountConfigurationObjectClass.Equals(mapiEvent.ObjectClass, StringComparison.InvariantCultureIgnoreCase) || this.TextNotificationConfigurationObjectClass.Equals(mapiEvent.ObjectClass, StringComparison.InvariantCultureIgnoreCase) || this.VoiceNotificationConfigurationObjectClass.Equals(mapiEvent.ObjectClass, StringComparison.InvariantCultureIgnoreCase))
     {
         return(true);
     }
     if (this.WorkingHoursConfigurationObjectClass.Equals(mapiEvent.ObjectClass, StringComparison.InvariantCultureIgnoreCase))
     {
         MailboxData fromCache = MailboxData.GetFromCache(mapiEvent.MailboxGuid);
         if (fromCache == null || fromCache.DefaultCalendarFolderId == null)
         {
             return(true);
         }
         using (fromCache.CreateReadLock())
         {
             if (object.Equals(StoreObjectId.DummyId, fromCache.DefaultCalendarFolderId))
             {
                 return(true);
             }
             return(ArrayComparer <byte> .Comparer.Equals(mapiEvent.ParentEntryId, fromCache.DefaultCalendarFolderId.ProviderLevelItemId));
         }
         return(false);
     }
     return(false);
 }
Ejemplo n.º 4
0
 // Token: 0x06000987 RID: 2439 RVA: 0x0003FE34 File Offset: 0x0003E034
 private static void NotificationStillEnabled(UserSettings settings, InfoFromUserMailboxSession info)
 {
     try
     {
         ExDateTime  userNow     = settings.TimeZone.ExTimeZone.ConvertDateTime(ExDateTime.Now);
         MailboxData mailboxData = MailboxData.CreateFromUserSettings(settings, info);
         if (mailboxData != null)
         {
             try
             {
                 MailboxData fromCache = MailboxData.GetFromCache(mailboxData.MailboxGuid);
                 if (fromCache == null)
                 {
                     CalendarNotificationInitiator.EnableUser(ref mailboxData, userNow);
                     return;
                 }
                 if (Utils.AreInterestedFieldsEqual(mailboxData.Settings, fromCache.Settings))
                 {
                     return;
                 }
                 using (fromCache.CreateReadLock())
                 {
                     using (fromCache.Actions.SyncObj.CreateWriteLock())
                     {
                         CalendarNotificationInitiator.StopEmittingReminder(fromCache);
                         CalendarNotificationInitiator.StopEmittingSummary(fromCache);
                     }
                 }
                 CalendarNotificationInitiator.UpdateCacheAndInitiateEmittings(ref mailboxData, userNow);
             }
             finally
             {
                 if (mailboxData != null)
                 {
                     mailboxData.Dispose();
                     mailboxData = null;
                 }
             }
         }
         ExTraceGlobals.AssistantTracer.TraceDebug <string>((long)typeof(CalendarNotificationInitiator).GetHashCode(), "notif changed, user: {0}", settings.LegacyDN);
     }
     catch (Exception ex)
     {
         if (!CalendarNotificationAssistant.TryHandleException((long)typeof(CalendarNotificationInitiator).GetHashCode(), "handling changing", settings.LegacyDN, ex))
         {
             throw;
         }
     }
 }
        // Token: 0x0600091C RID: 2332 RVA: 0x0003D638 File Offset: 0x0003B838
        public bool IsEventInteresting(MapiEvent mapiEvent)
        {
            if (ObjectType.MAPI_MESSAGE != mapiEvent.ItemType)
            {
                return(false);
            }
            bool flag = ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(mapiEvent.ObjectClass);

            if (!flag && ((MapiEventTypeFlags.NewMail & mapiEvent.EventMask) == (MapiEventTypeFlags)0 || (!ObjectClass.IsMeetingRequest(mapiEvent.ObjectClass) && !ObjectClass.IsMeetingCancellation(mapiEvent.ObjectClass))))
            {
                return(false);
            }
            MailboxData fromCache = MailboxData.GetFromCache(mapiEvent.MailboxGuid);

            if (fromCache == null)
            {
                return(false);
            }
            StoreObjectId storeObjectId = null;

            using (fromCache.CreateReadLock())
            {
                if (!NotificationFactories.Instance.IsInterestedInCalendarChangeEvent(fromCache.Settings))
                {
                    ExTraceGlobals.AssistantTracer.TraceDebug <string>((long)this.GetHashCode(), "Calendar change event is uninteresting to {0}", fromCache.Settings.LegacyDN);
                    return(false);
                }
                storeObjectId = fromCache.DefaultCalendarFolderId;
                if (storeObjectId == null)
                {
                    return(false);
                }
            }
            if (flag)
            {
                if (((MapiEventTypeFlags.ObjectCreated | MapiEventTypeFlags.ObjectDeleted | MapiEventTypeFlags.ObjectModified | MapiEventTypeFlags.ObjectCopied) & mapiEvent.EventMask) != (MapiEventTypeFlags)0 && !object.Equals(storeObjectId, StoreObjectId.FromProviderSpecificId(mapiEvent.ParentEntryId)))
                {
                    return(false);
                }
                if ((MapiEventTypeFlags.ObjectMoved & mapiEvent.EventMask) != (MapiEventTypeFlags)0 && !object.Equals(storeObjectId, StoreObjectId.FromProviderSpecificId(mapiEvent.ParentEntryId)) && !object.Equals(storeObjectId, StoreObjectId.FromProviderSpecificId(mapiEvent.OldParentEntryId)))
                {
                    return(false);
                }
            }
            return(true);
        }
        // Token: 0x06000926 RID: 2342 RVA: 0x0003DDB4 File Offset: 0x0003BFB4
        internal void HandleEvent(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item)
        {
            MailboxData fromCache = MailboxData.GetFromCache(mapiEvent.MailboxGuid);

            if (fromCache == null)
            {
                return;
            }
            using (fromCache.CreateReadLock())
            {
                ExDateTime eventTime = new ExDateTime(fromCache.Settings.TimeZone.ExTimeZone, mapiEvent.CreateTime);
                try
                {
                    if (ObjectClass.IsMeetingMessage(mapiEvent.ObjectClass))
                    {
                        CalendarChangeProcessor.HandleMeetingEvent(eventTime, fromCache, mapiEvent, itemStore, item);
                    }
                    else if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(mapiEvent.ObjectClass))
                    {
                        CalendarChangeProcessor.HandleCalendarEvent(eventTime, fromCache, mapiEvent, itemStore, item);
                    }
                    else
                    {
                        ExTraceGlobals.AssistantTracer.TraceDebug <IExchangePrincipal, MapiEvent>((long)this.GetHashCode(), "why runs to here?! unhandled event for user {0}, event: {1}", itemStore.MailboxOwner, mapiEvent);
                    }
                }
                catch (ConnectionFailedTransientException arg)
                {
                    ExTraceGlobals.AssistantTracer.TraceDebug <IExchangePrincipal, MapiEvent, ConnectionFailedTransientException>((long)this.GetHashCode(), "Exception is caught for user {0} when processing event: {1}\n{2}", itemStore.MailboxOwner, mapiEvent, arg);
                }
                catch (AdUserNotFoundException arg2)
                {
                    ExTraceGlobals.AssistantTracer.TraceDebug <IExchangePrincipal, MapiEvent, AdUserNotFoundException>((long)this.GetHashCode(), "Exception is caught for user {0} when processing event: {1}\n{2}", itemStore.MailboxOwner, mapiEvent, arg2);
                }
            }
        }
        // Token: 0x06000A3A RID: 2618 RVA: 0x0004380C File Offset: 0x00041A0C
        public void HandleEvent(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item)
        {
            if (MailboxData.GetFromCache(mapiEvent.MailboxGuid) == null)
            {
                using (MailboxData.CachedStateWriter cachedStateWriter = new MailboxData.CachedStateWriter(mapiEvent.MailboxGuid))
                {
                    if (cachedStateWriter.Get() == null)
                    {
                        MailboxData mailboxData = new MailboxData(itemStore);
                        cachedStateWriter.Set(mailboxData);
                    }
                }
            }
            MessageItem messageItem = item as MessageItem;

            if (messageItem == null)
            {
                return;
            }
            int?valueAsNullable = messageItem.GetValueAsNullable <int>(ItemSchema.InternetMessageIdHash);

            if (valueAsNullable == null)
            {
                return;
            }
            string valueOrDefault = messageItem.GetValueOrDefault <string>(ItemSchema.InternetMessageId, null);

            if (string.IsNullOrEmpty(valueOrDefault))
            {
                return;
            }
            int?valueAsNullable2 = messageItem.GetValueAsNullable <int>(MessageItemSchema.TextMessageDeliveryStatus);

            if (valueAsNullable2 == null)
            {
                return;
            }
            List <IStorePropertyBag> list = new List <IStorePropertyBag>(1);

            using (Folder folder = Folder.Bind(itemStore, DefaultFolderType.SentItems))
            {
                using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, null, new SortBy[]
                {
                    new SortBy(ItemSchema.InternetMessageIdHash, SortOrder.Ascending)
                }, new PropertyDefinition[]
                {
                    ItemSchema.InternetMessageIdHash,
                    ItemSchema.Id,
                    ItemSchema.InternetMessageId,
                    MessageItemSchema.TextMessageDeliveryStatus
                }))
                {
                    if (!queryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.InternetMessageIdHash, valueAsNullable)))
                    {
                        return;
                    }
                    bool flag = false;
                    while (!flag)
                    {
                        IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(1);
                        if (propertyBags == null || 0 >= propertyBags.Length)
                        {
                            break;
                        }
                        for (int i = 0; i < propertyBags.Length; i++)
                        {
                            int?num = propertyBags[i].TryGetProperty(ItemSchema.InternetMessageIdHash) as int?;
                            if (num == null)
                            {
                                break;
                            }
                            if (num.Value != valueAsNullable)
                            {
                                flag = true;
                                break;
                            }
                            string a = propertyBags[i].TryGetProperty(ItemSchema.InternetMessageId) as string;
                            if (string.Equals(a, valueOrDefault))
                            {
                                list.Add(propertyBags[i]);
                            }
                        }
                    }
                }
            }
            foreach (IStorePropertyBag storePropertyBag in list)
            {
                int?num2 = storePropertyBag.TryGetProperty(MessageItemSchema.TextMessageDeliveryStatus) as int?;
                if (num2 == null || !(num2 >= valueAsNullable2))
                {
                    VersionedId versionedId = storePropertyBag.TryGetProperty(ItemSchema.Id) as VersionedId;
                    if (versionedId != null && versionedId.ObjectId != null)
                    {
                        using (MessageItem messageItem2 = MessageItem.Bind(itemStore, versionedId.ObjectId))
                        {
                            messageItem2.OpenAsReadWrite();
                            messageItem2.SetProperties(TextMessageDeliveryStatusProcessor.propertyDeliveryStatus, new object[]
                            {
                                valueAsNullable2
                            });
                            messageItem2.Save(SaveMode.ResolveConflicts);
                        }
                    }
                }
            }
        }