public static bool IsSmsSyncEnabled(UserContext userContext, out E164Number smsSyncPhoneNumber, out string smsSyncDeviceProtocol, out string smsSyncDeviceType, out string smsSyncDeviceId, out string smsSyncDeviceFriendlyName)
        {
            smsSyncPhoneNumber        = null;
            smsSyncDeviceProtocol     = null;
            smsSyncDeviceType         = null;
            smsSyncDeviceId           = null;
            smsSyncDeviceFriendlyName = null;
            bool result;

            using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(userContext.MailboxSession))
            {
                TextMessagingAccount textMessagingAccount = (TextMessagingAccount)versionedXmlDataProvider.Read <TextMessagingAccount>(userContext.ExchangePrincipal.ObjectId);
                if (textMessagingAccount.EasEnabled && null != textMessagingAccount.EasPhoneNumber)
                {
                    smsSyncPhoneNumber        = textMessagingAccount.EasPhoneNumber;
                    smsSyncDeviceProtocol     = textMessagingAccount.EasDeviceProtocol;
                    smsSyncDeviceType         = textMessagingAccount.EasDeviceType;
                    smsSyncDeviceId           = textMessagingAccount.EasDeviceId;
                    smsSyncDeviceFriendlyName = textMessagingAccount.EasDeviceName;
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }
Exemple #2
0
        // Token: 0x06000AB1 RID: 2737 RVA: 0x00045CD8 File Offset: 0x00043ED8
        private static bool TryGetNotificationPhoneNumber(MailboxInfo mailbox, MailboxSession session, ADUser user, out string phoneNumber, out CultureInfo notificationPreferredCulture)
        {
            phoneNumber = null;
            notificationPreferredCulture = null;
            TextMessagingAccount textMessagingAccount = null;

            if (MwiAssistant.TryReadTextMessagingAccount(session, out textMessagingAccount))
            {
                bool flag = TextMessagingHelper.IsMachineToPersonTextingOnlyAccount(textMessagingAccount);
                ExTraceGlobals.MWITracer.TraceDebug(0L, "MwiAssistant: TryGetNotificationPhoneNumber User = {0}, EASEnabled = {1}, Phone Number Verified = {2}, Phone Number = {3}, Can send sms = {4}", new object[]
                {
                    user.DistinguishedName,
                    textMessagingAccount.EasEnabled,
                    textMessagingAccount.NotificationPhoneNumberVerified,
                    (textMessagingAccount.NotificationPhoneNumber != null && textMessagingAccount.NotificationPhoneNumber.Number != null) ? textMessagingAccount.NotificationPhoneNumber.Number : "<null>",
                    flag
                });
                if (flag)
                {
                    phoneNumber = textMessagingAccount.NotificationPhoneNumber.Number;
                    notificationPreferredCulture = textMessagingAccount.NotificationPreferredCulture;
                }
            }
            else
            {
                ExTraceGlobals.MWITracer.TraceWarning <string>(0L, "MwiAssistant: TryGetNotificationPhoneNumber Cannot send SMS because TextMessagingAccount does not exist for User {0}", user.DistinguishedName);
            }
            return(phoneNumber != null);
        }
Exemple #3
0
 // Token: 0x06000AB0 RID: 2736 RVA: 0x00045C88 File Offset: 0x00043E88
 private static bool TryReadTextMessagingAccount(MailboxSession session, out TextMessagingAccount account)
 {
     using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(session))
     {
         account = (TextMessagingAccount)versionedXmlDataProvider.Read <TextMessagingAccount>(session.MailboxOwner.ObjectId);
     }
     return(account != null);
 }
 public static bool IsMachineToPersonTextingOnlyAccount(TextMessagingAccount account)
 {
     if (account == null)
     {
         throw new ArgumentNullException("account");
     }
     return(!account.EasEnabled && account.NotificationPhoneNumberVerified && null != account.NotificationPhoneNumber && !string.IsNullOrEmpty(account.NotificationPhoneNumber.Number));
 }
 // Token: 0x06000A63 RID: 2659 RVA: 0x00044578 File Offset: 0x00042778
 internal static bool TryLoadTextMessagingAccount(MailboxSession session, out TextMessagingAccount textMessagingAccount)
 {
     textMessagingAccount = null;
     using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(session))
     {
         textMessagingAccount = (TextMessagingAccount)versionedXmlDataProvider.Read <TextMessagingAccount>(session.MailboxOwner.ObjectId);
     }
     return(textMessagingAccount != null);
 }
        // Token: 0x06000A6D RID: 2669 RVA: 0x000449B4 File Offset: 0x00042BB4
        internal static bool AreInterestedFieldsEqual(TextMessagingAccount value1, TextMessagingAccount value2)
        {
            bool result;

            if (Utils.CheckMembers(value1, value2, out result))
            {
                return(value1.EasEnabled == value2.EasEnabled && value1.NotificationPhoneNumberVerified == value2.NotificationPhoneNumberVerified && value1.MobileOperatorId == value2.MobileOperatorId);
            }
            return(result);
        }
        internal static bool IsSMSConfigured(UserContext context)
        {
            bool result;

            using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(context.MailboxSession))
            {
                ADObjectId           objectId             = context.MailboxSession.MailboxOwner.ObjectId;
                TextMessagingAccount textMessagingAccount = (TextMessagingAccount)versionedXmlDataProvider.Read <TextMessagingAccount>(objectId);
                result = (textMessagingAccount != null && textMessagingAccount.NotificationPhoneNumber != null && textMessagingAccount.NotificationPhoneNumberVerified);
            }
            return(result);
        }
 // Token: 0x060008FC RID: 2300 RVA: 0x0003CE9C File Offset: 0x0003B09C
 private void SyncTextMessagingStates(long cookie)
 {
     this.UpdateAllUserSettings(cookie, delegate(MailboxSession mailboxSession, IRecipientSession recipientSession, ADUser user)
     {
         using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(mailboxSession))
         {
             TextMessagingAccount account = (TextMessagingAccount)versionedXmlDataProvider.Read <TextMessagingAccount>(user.Identity);
             if (this.ShouldContinue(cookie))
             {
                 TextMessagingHelper.UpdateAndSaveTextMessgaingStateOnAdUser(account, user, recipientSession);
             }
         }
     }, (ADRawEntry user) => user[ADRecipientSchema.TextMessagingState] == null);
 }
Exemple #9
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(XsoStoreDataProviderBase.GetExchangePrincipalWithAdSessionSettingsForOrg(base.SessionSettings.CurrentOrganizationId, this.DataObject), (base.ExchangeRunspaceConfig == null) ? null : base.ExchangeRunspaceConfig.SecurityAccessToken, "Compare-TextMessagingVerificationCode"))
     {
         TextMessagingAccount textMessagingAccount = (TextMessagingAccount)versionedXmlDataProvider.Read<TextMessagingAccount>(this.DataObject.Identity);
         IList<PossibleRecipient> effectivePossibleRecipients = textMessagingAccount.TextMessagingSettings.MachineToPersonMessagingPolicies.EffectivePossibleRecipients;
         if (effectivePossibleRecipients.Count == 0)
         {
             base.WriteError(new NotificationPhoneNumberAbsentException(this.Identity.ToString()), ErrorCategory.InvalidData, this.Identity);
         }
         PossibleRecipient possibleRecipient = effectivePossibleRecipients[0];
         bool flag = false;
         if (string.IsNullOrEmpty(possibleRecipient.Passcode))
         {
             base.WriteError(new VerificationCodeNeverSentException(this.Identity.ToString()), ErrorCategory.InvalidData, this.Identity);
         }
         DateTime utcNow = DateTime.UtcNow;
         if (6 <= PossibleRecipient.CountTimesSince(possibleRecipient.PasscodeVerificationFailedTimeHistory, utcNow - TimeSpan.FromDays(1.0), true))
         {
             base.WriteError(new VerificationCodeTooManyFailedException(), ErrorCategory.InvalidData, this.Identity);
         }
         if (string.Equals(possibleRecipient.Passcode, this.VerificationCode, StringComparison.InvariantCultureIgnoreCase))
         {
             possibleRecipient.SetAcknowledged(true);
             ADUser dataObject = this.DataObject;
             SmsSqmDataPointHelper.AddNotificationTurningOnDataPoint(SmsSqmSession.Instance, dataObject.Id, dataObject.LegacyExchangeDN, textMessagingAccount);
         }
         else
         {
             possibleRecipient.PasscodeVerificationFailedTimeHistory.Add(utcNow);
             flag = true;
         }
         versionedXmlDataProvider.Save(textMessagingAccount);
         if (flag)
         {
             base.WriteError(new VerificationCodeUnmatchException(this.VerificationCode), ErrorCategory.InvalidData, this.Identity);
         }
         else if (!textMessagingAccount.EasEnabled)
         {
             TextMessagingHelper.SendSystemTextMessage(versionedXmlDataProvider.MailboxSession, textMessagingAccount.NotificationPhoneNumber, Strings.CalendarNotificationConfirmation.ToString(textMessagingAccount.NotificationPreferredCulture ?? TextMessagingHelper.GetSupportedUserCulture(this.DataObject)), true);
         }
     }
     TaskLogger.LogExit();
 }
 public static void UpdateAndSaveTextMessgaingStateOnAdUser(TextMessagingAccount account, ADRecipient adRecipient, IRecipientSession adSession)
 {
     if (account == null)
     {
         throw new ArgumentNullException("account");
     }
     if (adRecipient == null)
     {
         throw new ArgumentNullException("adRecipient");
     }
     if (adSession == null)
     {
         throw new ArgumentNullException("adSession");
     }
     if (TextMessagingHelper.UpdateTextMessagingState(adRecipient.TextMessagingState, account.TextMessagingSettings.DeliveryPoints))
     {
         adSession.Save(adRecipient);
     }
 }
        public static void SaveTextMessagingAccount(TextMessagingAccount account, VersionedXmlDataProvider storeDataProvider, ADRecipient adRecipient, IRecipientSession adSession)
        {
            if (account == null)
            {
                throw new ArgumentNullException("account");
            }
            if (storeDataProvider == null)
            {
                throw new ArgumentNullException("storeDataProvider");
            }
            if (adRecipient == null)
            {
                throw new ArgumentNullException("adRecipient");
            }
            if (adSession == null)
            {
                throw new ArgumentNullException("adSession");
            }
            bool notificationPhoneNumberVerified = account.NotificationPhoneNumberVerified;
            bool dupIdentitiesExist = false;

            account.TextMessagingSettings.DeliveryPoints.Sort(delegate(DeliveryPoint x, DeliveryPoint y)
            {
                if (x.Identity == y.Identity)
                {
                    dupIdentitiesExist = true;
                }
                return(x.Identity.CompareTo(y.Identity));
            });
            if (dupIdentitiesExist)
            {
                int num = 0;
                while (account.TextMessagingSettings.DeliveryPoints.Count > num)
                {
                    account.TextMessagingSettings.DeliveryPoints[num].Identity = (byte)num;
                    num++;
                }
            }
            TextMessagingHelper.UpdateTextMessagingState(adRecipient.TextMessagingState, account.TextMessagingSettings.DeliveryPoints);
            storeDataProvider.Save(account);
            adSession.Save(adRecipient);
        }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(XsoStoreDataProviderBase.GetExchangePrincipalWithAdSessionSettingsForOrg(base.SessionSettings.CurrentOrganizationId, this.DataObject), (base.ExchangeRunspaceConfig == null) ? null : base.ExchangeRunspaceConfig.SecurityAccessToken, "Send-TextMessagingVerificationCode"))
     {
         TextMessagingAccount      textMessagingAccount        = (TextMessagingAccount)versionedXmlDataProvider.Read <TextMessagingAccount>(this.DataObject.Identity);
         IList <PossibleRecipient> effectivePossibleRecipients = textMessagingAccount.TextMessagingSettings.MachineToPersonMessagingPolicies.EffectivePossibleRecipients;
         if (effectivePossibleRecipients.Count == 0)
         {
             base.WriteError(new NotificationPhoneNumberAbsentException(this.Identity.ToString()), ErrorCategory.InvalidData, this.Identity);
         }
         PossibleRecipient possibleRecipient = effectivePossibleRecipients[0];
         DateTime          utcNow            = DateTime.UtcNow;
         if (3 <= PossibleRecipient.CountTimesSince(possibleRecipient.PasscodeSentTimeHistory, utcNow - TimeSpan.FromMinutes(30.0), false))
         {
             this.WriteWarning(new VerificationCodeSentTooManyTimesException(textMessagingAccount.NotificationPhoneNumber.ToString()).LocalizedString);
             TaskLogger.LogExit();
             return;
         }
         if (PossibleRecipient.CountTimesSince(possibleRecipient.PasscodeSentTimeHistory, utcNow - TimeSpan.FromDays(1.0), true) == 0)
         {
             if (DateTime.UtcNow > SendTextMessagingVerificationCode.timeCreatingRandom + TimeSpan.FromSeconds((double)SendTextMessagingVerificationCode.timeSpan))
             {
                 SendTextMessagingVerificationCode.random             = new Random();
                 SendTextMessagingVerificationCode.timeCreatingRandom = DateTime.UtcNow;
                 SendTextMessagingVerificationCode.timeSpan           = new Random().Next(60);
             }
             possibleRecipient.SetPasscode(SendTextMessagingVerificationCode.random.Next(999999).ToString("000000"));
         }
         possibleRecipient.PasscodeSentTimeHistory.Add(utcNow);
         try
         {
             TextMessagingHelper.SendSystemTextMessage(versionedXmlDataProvider.MailboxSession, textMessagingAccount.NotificationPhoneNumber, Strings.PasscodeInformation(possibleRecipient.Passcode).ToString(textMessagingAccount.NotificationPreferredCulture ?? TextMessagingHelper.GetSupportedUserCulture(this.DataObject)), false);
         }
         catch (SendAsDeniedException innerException)
         {
             base.WriteError(new TextMessageInsufficientPermissionException(innerException), ErrorCategory.InvalidOperation, this.Identity);
         }
         versionedXmlDataProvider.Save(textMessagingAccount);
     }
     TaskLogger.LogExit();
 }
Exemple #13
0
 // Token: 0x060009E4 RID: 2532 RVA: 0x00041508 File Offset: 0x0003F708
 public void HandleEvent(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item)
 {
     if (ObjectType.MAPI_MESSAGE == mapiEvent.ItemType && item == null)
     {
         ExTraceGlobals.UserSettingsTracer.TraceDebug <string>((long)this.GetHashCode(), "Event is MAPI_MESSAGE but item is null, message class is {0}", mapiEvent.ObjectClass);
         return;
     }
     if (!itemStore.Capabilities.CanHaveUserConfigurationManager)
     {
         ExTraceGlobals.UserSettingsTracer.TraceDebug <string>((long)this.GetHashCode(), "Mailbox sesstion does not have UserConfigurationManager capability. Possibly an alternate mailbox, {0}.", itemStore.MailboxOwnerLegacyDN);
         return;
     }
     if (this.IsMailboxDeletedOrDisconnected(mapiEvent))
     {
         ExTraceGlobals.UserSettingsTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "Processing Disabling event for mailbox {0} on database {1}", itemStore.MailboxOwnerLegacyDN, itemStore.MdbGuid);
         UserSettings  settings      = new UserSettings(itemStore);
         SystemMailbox systemMailbox = this.GetSystemMailbox();
         if (systemMailbox != null)
         {
             NotificationFactories.Instance.UpdateSettingUnderSystemMailbox(settings, systemMailbox);
         }
         SettingsChangeListener.Instance.RaiseSettingsChangedEvent(settings, new InfoFromUserMailboxSession(itemStore));
         return;
     }
     if (this.IsMailboxCreatedOrConnected(mapiEvent))
     {
         ExTraceGlobals.UserSettingsTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "Processing Enabling event for mailbox {0} on database {1}", itemStore.MailboxOwnerLegacyDN, itemStore.MdbGuid);
         using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(itemStore))
         {
             TextMessagingAccount account = (TextMessagingAccount)versionedXmlDataProvider.Read <TextMessagingAccount>(itemStore.MailboxOwner.ObjectId);
             IRecipientSession    tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(false, ConsistencyMode.IgnoreInvalid, itemStore.GetADSessionSettings(), 194, "HandleEvent", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\CalendarNotification\\SettingsChangeProcessor.cs");
             ADRecipient          adrecipient = tenantOrRootOrgRecipientSession.Read(itemStore.MailboxOwner.ObjectId);
             if (adrecipient != null)
             {
                 TextMessagingHelper.UpdateAndSaveTextMessgaingStateOnAdUser(account, adrecipient, tenantOrRootOrgRecipientSession);
             }
         }
     }
     this.HandleSettingsEvent(itemStore);
 }
 public static bool ShouldReturnMobile(MailboxSession mailboxSession)
 {
     if (mailboxSession == null)
     {
         return(false);
     }
     if (!mailboxSession.SupportedRoutingTypes.Contains("MOBILE"))
     {
         return(false);
     }
     try
     {
         using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(mailboxSession))
         {
             TextMessagingAccount textMessagingAccount = (TextMessagingAccount)versionedXmlDataProvider.Read <TextMessagingAccount>(mailboxSession.MailboxOwner.ObjectId);
             return(textMessagingAccount.EasEnabled);
         }
     }
     catch (AccessDeniedException arg)
     {
         ExTraceGlobals.ApplicationlogicTracer.TraceError <AccessDeniedException>((long)typeof(TextMessagingHelper).GetHashCode(), "ShouldReturnMobile throwing an exception: {0}", arg);
     }
     return(false);
 }
Exemple #15
0
 public SmsOptions(TextMessagingAccount account) : base(account)
 {
     this.account = account;
 }
        private void ProcessSet(XmlNode setNode)
        {
            using (this.command.Context.Tracker.Start(TimeId.DeviceInfoProcessSet))
            {
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Processing DeviceInformation - Set");
                foreach (object obj in setNode.ChildNodes)
                {
                    XmlNode xmlNode   = (XmlNode)obj;
                    string  innerText = xmlNode.InnerText;
                    string  localName;
                    switch (localName = xmlNode.LocalName)
                    {
                    case "Model":
                        this.deviceModel = DeviceClassCache.NormalizeDeviceClass(innerText);
                        break;

                    case "IMEI":
                        this.deviceImei = innerText;
                        break;

                    case "FriendlyName":
                        this.deviceFriendlyName = innerText;
                        break;

                    case "OS":
                        this.deviceOS = innerText;
                        break;

                    case "OSLanguage":
                        this.deviceOSLanguage = innerText;
                        break;

                    case "PhoneNumber":
                        this.devicePhoneNumber = innerText;
                        break;

                    case "UserAgent":
                        this.deviceUserAgent = innerText;
                        break;

                    case "EnableOutboundSMS":
                    {
                        string a;
                        if (this.command.User.IsConsumerOrganizationUser)
                        {
                            this.deviceEnableOutboundSMS = false;
                        }
                        else if ((a = innerText) != null)
                        {
                            if (!(a == "0"))
                            {
                                if (a == "1")
                                {
                                    this.deviceEnableOutboundSMS = true;
                                }
                            }
                            else
                            {
                                this.deviceEnableOutboundSMS = false;
                            }
                        }
                        break;
                    }

                    case "MobileOperator":
                        this.deviceMobileOperator = innerText;
                        break;

                    case "Annotations":
                        this.command.RequestAnnotations.ParseWLAnnotations(xmlNode, "DeviceInformation");
                        break;
                    }
                }
                if (this.command.RequestAnnotations.ContainsAnnotation("CreateChatsFolder", "DeviceInformation"))
                {
                    this.CreateSmsAndChatsSyncFolder();
                }
                bool       flag       = false;
                GlobalInfo globalInfo = this.command.GlobalInfo;
                globalInfo.DeviceModel        = this.deviceModel;
                globalInfo.DeviceImei         = this.deviceImei;
                globalInfo.DeviceFriendlyName = this.deviceFriendlyName;
                globalInfo.UserAgent          = this.deviceUserAgent;
                string text;
                if (this.command.Context.Request.DeviceIdentity.DeviceType.ToUpper().Contains("SAMSUNG") && this.command.TryParseDeviceOSFromUserAgent(out text))
                {
                    this.deviceOS = text;
                }
                globalInfo.DeviceOS          = this.deviceOS;
                globalInfo.DeviceOSLanguage  = this.deviceOSLanguage;
                globalInfo.DevicePhoneNumber = this.devicePhoneNumber;
                string text2 = string.IsNullOrEmpty(this.devicePhoneNumber) ? globalInfo.DevicePhoneNumberForSms : this.devicePhoneNumber;
                if (string.IsNullOrEmpty(text2))
                {
                    text2 = Guid.NewGuid().GetHashCode().ToString("D3", CultureInfo.InvariantCulture);
                    globalInfo.DevicePhoneNumberForSms = text2;
                }
                else
                {
                    flag |= (string.Compare(text2, globalInfo.DevicePhoneNumberForSms, StringComparison.Ordinal) != 0);
                }
                flag |= (this.deviceEnableOutboundSMS != globalInfo.DeviceEnableOutboundSMS);
                globalInfo.DeviceMobileOperator      = this.deviceMobileOperator;
                globalInfo.DeviceInformationReceived = true;
                SmsSqmDataPointHelper.AddDeviceInfoReceivedDataPoint(SmsSqmSession.Instance, this.mailboxSession.MailboxOwner.ObjectId, this.mailboxSession.MailboxOwner.LegacyDn, this.command.Request.DeviceIdentity.DeviceType, this.command.Request.VersionString);
                if (flag)
                {
                    try
                    {
                        using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(this.mailboxSession))
                        {
                            TextMessagingAccount textMessagingAccount = (TextMessagingAccount)versionedXmlDataProvider.Read <TextMessagingAccount>(this.mailboxSession.MailboxOwner.ObjectId);
                            IRecipientSession    adrecipientSession   = this.mailboxSession.GetADRecipientSession(false, ConsistencyMode.FullyConsistent);
                            ADRecipient          adrecipient          = adrecipientSession.Read(this.mailboxSession.MailboxOwner.ObjectId);
                            this.command.Context.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, adrecipientSession.LastUsedDc);
                            if (adrecipient == null)
                            {
                                throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerError, new LocalizedString("Cannot find AD Recipient correlated to the text messaging account"), false)
                                      {
                                          ErrorStringForProtocolLogger = "NoUserAccountForSms"
                                      };
                            }
                            E164Number e164Number = null;
                            E164Number.TryParse(text2, out e164Number);
                            if (this.deviceEnableOutboundSMS)
                            {
                                if (e164Number == null)
                                {
                                    throw new AirSyncPermanentException(StatusCode.Sync_ServerError, new LocalizedString(string.Format("Cannot parse phone number {0} into a E164 number.", text2)), false)
                                          {
                                              ErrorStringForProtocolLogger = "BadSmsPhoneNum"
                                          };
                                }
                                bool notificationEnabled = textMessagingAccount.NotificationPhoneNumber != null && textMessagingAccount.NotificationPhoneNumberVerified;
                                textMessagingAccount.SetEasEnabled(e164Number, this.syncStateStorage.DeviceIdentity.Protocol, this.syncStateStorage.DeviceIdentity.DeviceType, this.syncStateStorage.DeviceIdentity.DeviceId, this.deviceFriendlyName);
                                TextMessagingHelper.SaveTextMessagingAccount(textMessagingAccount, versionedXmlDataProvider, adrecipient, adrecipientSession);
                                this.command.Context.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, adrecipientSession.LastUsedDc);
                                SmsSqmDataPointHelper.AddEasConfigurationDataPoint(SmsSqmSession.Instance, this.mailboxSession.MailboxOwner.ObjectId, this.mailboxSession.MailboxOwner.LegacyDn, this.command.Request.DeviceIdentity.DeviceType, notificationEnabled, this.command.Request.VersionString);
                            }
                            else if (textMessagingAccount.EasEnabled && textMessagingAccount.EasPhoneNumber == e164Number)
                            {
                                textMessagingAccount.SetEasDisabled();
                                TextMessagingHelper.SaveTextMessagingAccount(textMessagingAccount, versionedXmlDataProvider, adrecipient, adrecipientSession);
                                this.command.Context.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, adrecipientSession.LastUsedDc);
                            }
                        }
                        globalInfo.DevicePhoneNumberForSms = text2;
                        globalInfo.DeviceEnableOutboundSMS = this.deviceEnableOutboundSMS;
                    }
                    catch (StoragePermanentException innerException)
                    {
                        throw new AirSyncPermanentException(StatusCode.ServerError, new LocalizedString("Server Error when trying to update SMS settings."), innerException, false)
                              {
                                  ErrorStringForProtocolLogger = "SmsSettingsSaveError"
                              };
                    }
                }
                this.OutputToIISLog();
            }
        }
 // Token: 0x06000A68 RID: 2664 RVA: 0x00044828 File Offset: 0x00042A28
 internal static bool TextMessagingAccountAllowTextNotification(TextMessagingAccount textMessagingAccount)
 {
     return(!textMessagingAccount.EasEnabled && textMessagingAccount.NotificationPhoneNumberVerified);
 }
Exemple #18
0
 public static void AddNotificationTurningOnDataPoint(SmsSqmSession instance, ADObjectId id, string legacyDN, TextMessagingAccount account)
 {
     if (instance.Enabled)
     {
         string     deploymentType = SmsSqmDataPointHelper.GetDeploymentType(id);
         string     text           = SmsSqmDataPointHelper.Generate64BitUserID(legacyDN);
         RegionInfo regionInfo     = (RegionInfo)account[TextMessagingAccountSchema.CountryRegionId];
         int        num            = (int)account[TextMessagingAccountSchema.MobileOperatorId];
         instance.AddToStreamDataPoint(SqmDataID.SMS_ST_NOTIFICATIONTURNINGON, new object[]
         {
             deploymentType,
             text,
             regionInfo.ToString(),
             num
         });
     }
 }