public static bool IsSmsSyncDeviceInactive(UserContext userContext, E164Number smsSyncPhoneNumber, string smsSyncDeviceProtocol, string smsSyncDeviceType, string smsSyncDeviceId, out string deviceName)
        {
            deviceName = null;
            TimeSpan zero  = TimeSpan.Zero;
            TimeSpan zero2 = TimeSpan.Zero;
            TimeSpan zero3 = TimeSpan.Zero;

            TextMessagingUtilities.GetSmsSyncDeviceInactiveDetectionCheckPoints(out zero, out zero2, out zero3);
            ExDateTime utcNow         = ExDateTime.UtcNow;
            ExDateTime oldestBoundary = utcNow - zero;
            ExDateTime newestBoundary = utcNow - zero2;
            ExDateTime boundary       = utcNow - zero3;

            return(TextMessagingUtilities.IsTextMessageStuckInOutbox(userContext.MailboxSession, smsSyncPhoneNumber, oldestBoundary, newestBoundary) || TextMessagingUtilities.TryGetInactiveSmsSyncDeviceName(userContext.MailboxSession, smsSyncPhoneNumber, smsSyncDeviceProtocol, smsSyncDeviceType, smsSyncDeviceId, boundary, out deviceName));
        }
 // Token: 0x06002ADF RID: 10975 RVA: 0x000F1888 File Offset: 0x000EFA88
 protected virtual void AddMessagesToInfobar()
 {
     InfobarMessageBuilder.AddImportance(this.infobar, this.Message);
     InfobarMessageBuilder.AddSensitivity(this.infobar, this.Message);
     InfobarMessageBuilder.AddFlag(this.infobar, this.Message, base.UserContext);
     InfobarMessageBuilder.AddCompliance(base.UserContext, this.infobar, this.Message, false);
     InfobarMessageBuilder.AddDeletePolicyInformation(this.infobar, this.Message, base.UserContext);
     this.AddIrmMessageToInfobar();
     if (!base.IsEmbeddedItem && !this.IsPublicItem)
     {
         InfobarMessageBuilder.AddReadReceiptNotice(base.UserContext, this.infobar, this.Message);
     }
     if (ObjectClass.IsTaskRequest(this.Message.ClassName))
     {
         this.infobar.AddMessage(SanitizedHtmlString.FromStringId(357315796), InfobarMessageType.Informational);
     }
     if (TextMessagingUtilities.NeedToAddUnsyncedMessageInfobar(this.Message.ClassName, this.Message, base.UserContext.MailboxSession))
     {
         this.infobar.AddMessage(SanitizedHtmlString.FromStringId(882347163), InfobarMessageType.Informational);
     }
 }
        private static bool TryGetInactiveSmsSyncDeviceName(MailboxSession session, E164Number smsSyncPhoneNumber, string smsSyncDeviceProtocol, string smsSyncDeviceType, string smsSyncDeviceId, ExDateTime boundary, out string deviceName)
        {
            deviceName = null;
            ExDateTime minValue = ExDateTime.MinValue;

            if (string.IsNullOrEmpty(smsSyncDeviceProtocol) || string.IsNullOrEmpty(smsSyncDeviceType) || string.IsNullOrEmpty(smsSyncDeviceId))
            {
                IEnumerator enumerator = SyncStateStorage.GetEnumerator(session, null);
                using (enumerator as IDisposable)
                {
                    while (enumerator.MoveNext())
                    {
                        object obj = enumerator.Current;
                        using (SyncStateStorage syncStateStorage = (SyncStateStorage)obj)
                        {
                            if (syncStateStorage.DeviceIdentity.IsProtocol("AirSync"))
                            {
                                if (TextMessagingUtilities.TryGetSmsSyncDeviceLastSyncTime(syncStateStorage, smsSyncPhoneNumber, out minValue, out deviceName))
                                {
                                    break;
                                }
                            }
                        }
                    }
                    goto IL_BB;
                }
            }
            DeviceIdentity deviceIdentity = new DeviceIdentity(smsSyncDeviceId, smsSyncDeviceType, smsSyncDeviceProtocol);

            using (SyncStateStorage syncStateStorage2 = SyncStateStorage.Bind(session, deviceIdentity, null))
            {
                if (!TextMessagingUtilities.TryGetSmsSyncDeviceLastSyncTime(syncStateStorage2, smsSyncPhoneNumber, out minValue, out deviceName))
                {
                    return(true);
                }
            }
IL_BB:
            return(minValue <= boundary);
        }
Example #4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            E164Number smsSyncPhoneNumber    = null;
            string     smsSyncDeviceProtocol = null;
            string     smsSyncDeviceType     = null;
            string     smsSyncDeviceId       = null;
            string     text = null;

            this.IsSmsAccountEnabled = TextMessagingUtilities.IsSmsSyncEnabled(base.UserContext, out smsSyncPhoneNumber, out smsSyncDeviceProtocol, out smsSyncDeviceType, out smsSyncDeviceId, out text);
            string text2 = null;

            if (this.IsSmsAccountEnabled && TextMessagingUtilities.IsSmsSyncDeviceInactive(base.UserContext, smsSyncPhoneNumber, smsSyncDeviceProtocol, smsSyncDeviceType, smsSyncDeviceId, out text2))
            {
                if (string.IsNullOrEmpty(text2))
                {
                    text2 = text;
                }
                SanitizedHtmlString messageHtml;
                if (string.IsNullOrEmpty(text2))
                {
                    messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(2099454980), new object[]
                    {
                        EditSms.SmsSyncHelpLinkBeginTag,
                        EditSms.SmsSyncHelpLinkEndTag
                    });
                }
                else
                {
                    messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(739255527), new object[]
                    {
                        text2,
                        EditSms.SmsSyncHelpLinkBeginTag,
                        EditSms.SmsSyncHelpLinkEndTag
                    });
                }
                base.Infobar.AddMessage(messageHtml, InfobarMessageType.Informational);
            }
            this.message    = base.Initialize <MessageItem>(false, new PropertyDefinition[0]);
            this.bodyMarkup = Markup.PlainText;
            if (this.message != null)
            {
                string action = base.OwaContext.FormsRegistryContext.Action;
                string state  = base.OwaContext.FormsRegistryContext.State;
                if (string.CompareOrdinal(action, "Reply") == 0)
                {
                    this.newItemType = NewItemType.Reply;
                }
                else if (string.CompareOrdinal(action, "Forward") == 0)
                {
                    this.newItemType = NewItemType.Forward;
                }
                else if (string.CompareOrdinal(action, "Open") == 0 && string.CompareOrdinal(state, "Draft") == 0)
                {
                    this.newItemType = NewItemType.ExplicitDraft;
                }
                else
                {
                    this.newItemType         = NewItemType.ImplicitDraft;
                    base.DeleteExistingDraft = true;
                }
            }
            else
            {
                this.message = Utilities.CreateDraftMessageFromQueryString(base.UserContext, base.Request);
                if (this.message != null)
                {
                    this.newItemType         = NewItemType.ImplicitDraft;
                    base.DeleteExistingDraft = true;
                    if (!ObjectClass.IsSmsMessage(this.message.ClassName))
                    {
                        this.message.ClassName = "IPM.Note.Mobile.SMS";
                        this.message.Save(SaveMode.ResolveConflicts);
                        this.message.Load();
                    }
                    base.Item = this.message;
                }
            }
            if (this.newItemType != NewItemType.New)
            {
                if (this.newItemType == NewItemType.ExplicitDraft)
                {
                    this.infobar.AddMessage(SanitizedHtmlString.FromStringId(-1981719796), InfobarMessageType.Informational);
                }
                this.recipientWell = new MessageRecipientWell(this.message);
                if (this.newItemType == NewItemType.Reply && this.recipientWell != null && !this.recipientWell.HasRecipients(RecipientWellType.To))
                {
                    this.infobar.AddMessage(SanitizedHtmlString.FromStringId(-575462747), InfobarMessageType.Warning, "divSmsReNumMis");
                }
            }
            else
            {
                this.recipientWell = new MessageRecipientWell();
            }
            this.toolbar = new EditSmsToolbar();
        }
        public static bool NeedToAddUnsyncedMessageInfobar(string messageClass, IStorePropertyBag storePropertyBag, MailboxSession session)
        {
            int num = 0;

            return(TextMessagingUtilities.TryGetDeliveryStatus(messageClass, storePropertyBag, session, out num) && 50 > num && 0 < num);
        }