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); }
// Token: 0x06001099 RID: 4249 RVA: 0x00043F20 File Offset: 0x00042120 public RecipientInfoCacheEntry LookUp(string number) { if (this.CacheEntries == null || this.CacheEntries.Count == 0) { return(null); } E164Number number2; if (!E164Number.TryParse(number, out number2)) { return(null); } foreach (RecipientInfoCacheEntry recipientInfoCacheEntry in this.CacheEntries) { E164Number number3; if (!E164Number.TryParse(recipientInfoCacheEntry.RoutingAddress, out number3)) { this.Tracer.TraceDebug <string>((long)this.GetHashCode(), "There's an invalid phone number in the SMS recipient cache of {0}'s mailbox", this.MailboxSession.MailboxOwner.MailboxInfo.DisplayName); } else if (SmsRecipientInfoCache.NumbersMatch(number2, number3)) { return(recipientInfoCacheEntry); } } return(null); }
public static ConversationIndex GenerateFromPhoneNumber(string number) { E164Number e164Number; if (!E164Number.TryParse(number, out e164Number)) { return(ConversationIndex.Empty); } int num = "472e2878-19b1-4ac1-a21a-".Length + 12; StringBuilder stringBuilder = new StringBuilder(num); stringBuilder.Append("472e2878-19b1-4ac1-a21a-"); if (e164Number.SignificantNumber.Length <= 12) { stringBuilder.Append(e164Number.SignificantNumber); } else { stringBuilder.Append(e164Number.SignificantNumber.Substring(e164Number.SignificantNumber.Length - 12)); } while (stringBuilder.Length < num) { stringBuilder.Append('f'); } return(ConversationIndex.Create(new Guid(stringBuilder.ToString()))); }
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); }
internal void SetPhonenumber(E164Number number) { if (this.PhoneNumber != number) { this.Acknowledged = false; this.SetPasscode(null); } this.PhoneNumber = number; }
internal override void Normalize(PropertyBag participantPropertyBag) { string valueOrDefault = participantPropertyBag.GetValueOrDefault <string>(ParticipantSchema.EmailAddress); E164Number e164Number; if (!string.IsNullOrEmpty(valueOrDefault) && E164Number.TryParse(valueOrDefault, out e164Number)) { participantPropertyBag.SetOrDeleteProperty(ParticipantSchema.EmailAddress, e164Number.Number); } base.Normalize(participantPropertyBag); }
public DeliveryPoint(byte identity, DeliveryPointType type, E164Number phonenumber, string protocol, string deviceType, string deviceId, string deviceFriendlyName, int p2pMessagingPriority, int m2pMessagingPriority) { this.Identity = identity; this.Type = type; this.PhoneNumber = phonenumber; this.Protocol = protocol; this.DeviceType = deviceType; this.DeviceId = deviceId; this.DeviceFriendlyName = deviceFriendlyName; this.P2pMessagingPriority = p2pMessagingPriority; this.M2pMessagingPriority = m2pMessagingPriority; }
internal override ParticipantValidationStatus Validate(Participant participant) { if (participant.EmailAddress == null) { return(ParticipantValidationStatus.AddressRequiredForRoutingType); } if (!E164Number.IsValidE164Number(participant.EmailAddress)) { return(ParticipantValidationStatus.InvalidAddressFormat); } return(ParticipantValidationStatus.NoError); }
private static bool TryGetSmsSyncDeviceLastSyncTime(SyncStateStorage syncStateStorage, E164Number smsSyncPhoneNumber, out ExDateTime lastSyncTime, out string deviceName) { lastSyncTime = ExDateTime.MinValue; deviceName = null; using (CustomSyncState customSyncState = syncStateStorage.GetCustomSyncState(new GlobalSyncStateInfo { ReadOnly = true }, new PropertyDefinition[0])) { if (customSyncState == null) { return(false); } if (!customSyncState.GetData <BooleanData, bool>("DeviceEnableOutboundSMS", false)) { return(false); } string data = customSyncState.GetData <StringData, string>("DevicePhoneNumber", null); if (string.IsNullOrEmpty(data)) { return(false); } E164Number e164Number = null; if (!E164Number.TryParse(data, out e164Number)) { return(false); } if (!e164Number.Equals(smsSyncPhoneNumber, true)) { return(false); } deviceName = customSyncState.GetData <StringData, string>("DeviceFriendlyName", null); } lastSyncTime = syncStateStorage.CreationTime; using (CustomSyncState customSyncState2 = syncStateStorage.GetCustomSyncState(new SyncStatusSyncStateInfo { ReadOnly = true }, new PropertyDefinition[0])) { if (customSyncState2 != null) { lastSyncTime = customSyncState2.GetData <DateTimeData, ExDateTime>("LastSyncAttemptTime", ExDateTime.MinValue); if (ExDateTime.MinValue == lastSyncTime) { lastSyncTime = customSyncState2.GetData <DateTimeData, ExDateTime>("LastSyncSuccessTime", syncStateStorage.CreationTime); } } } return(true); }
private static bool AreNameAndAddressTheSameNumber(AnrManager.Options options, string routingType, string displayName, string routingAddress) { if (!options.IsDefaultRoutingType("MOBILE")) { return(false); } if (!Utilities.IsMobileRoutingType(routingType)) { return(false); } E164Number objA = null; E164Number objB = null; return(E164Number.TryParse(displayName, out objA) && E164Number.TryParse(routingAddress, out objB) && object.Equals(objA, objB)); }
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)); }
public static void SendSystemTextMessage(MailboxSession mailboxSession, E164Number recipient, string content, bool alert) { if (mailboxSession == null) { throw new ArgumentNullException("mailboxSession"); } if (recipient == null) { throw new ArgumentNullException("recipient"); } if (string.IsNullOrEmpty(content)) { throw new ArgumentNullException("content"); } TextMessagingHelper.SendMessageItemWithoutSave(mailboxSession, alert ? "IPM.Note.Mobile.SMS.Alert.Info" : "IPM.Note.Mobile.SMS.Undercurrent", new Participant(mailboxSession.MailboxOwner), new Participant(recipient.Number, recipient.Number, "MOBILE"), null, content, false, Importance.Normal); }
// Token: 0x060009EC RID: 2540 RVA: 0x00041B98 File Offset: 0x0003FD98 internal static TextNotificationSettings ParseTextSettingsItemBody(string body) { TextNotificationSettings result; using (StringReader stringReader = new StringReader(body)) { if (SettingsItemBodyParser.GetNextLine(stringReader) != "V1.2") { SettingsItemBodyParser.Tracer.TraceDebug(0L, "Unknown user settings version, skipped"); throw new FormatException(); } MailboxRegionalConfiguration mailboxRegionalConfiguration = new MailboxRegionalConfiguration(); mailboxRegionalConfiguration.TimeZone = new ExTimeZoneValue(SettingsItemBodyParser.GetNextTimeZone(stringReader)); int nextInteger = SettingsItemBodyParser.GetNextInteger(stringReader); if (nextInteger != 0) { mailboxRegionalConfiguration.Language = new CultureInfo(nextInteger); } mailboxRegionalConfiguration.TimeFormat = SettingsItemBodyParser.GetNextLine(stringReader); mailboxRegionalConfiguration.DateFormat = SettingsItemBodyParser.GetNextLine(stringReader); CalendarNotification calendarNotification = new CalendarNotification(); calendarNotification.MeetingReminderNotification = SettingsItemBodyParser.GetNextBoolean(stringReader); calendarNotification.MeetingReminderSendDuringWorkHour = SettingsItemBodyParser.GetNextBoolean(stringReader); calendarNotification.NextDays = SettingsItemBodyParser.GetNextInteger(stringReader); calendarNotification.CalendarUpdateNotification = SettingsItemBodyParser.GetNextBoolean(stringReader); calendarNotification.CalendarUpdateSendDuringWorkHour = SettingsItemBodyParser.GetNextBoolean(stringReader); calendarNotification.DailyAgendaNotification = SettingsItemBodyParser.GetNextBoolean(stringReader); calendarNotification.DailyAgendaNotificationSendTime = TimeSpan.FromSeconds((double)SettingsItemBodyParser.GetNextInteger(stringReader)); E164Number textMessagingPhoneNumber; if (!E164Number.TryParse(SettingsItemBodyParser.GetNextLine(stringReader), out textMessagingPhoneNumber)) { SettingsItemBodyParser.Tracer.TraceDebug(0L, "Invalid phone number, skipped"); throw new FormatException(); } calendarNotification.TextMessagingPhoneNumber = textMessagingPhoneNumber; ExTimeZone nextTimeZone = SettingsItemBodyParser.GetNextTimeZone(stringReader); int nextInteger2 = SettingsItemBodyParser.GetNextInteger(stringReader); int nextInteger3 = SettingsItemBodyParser.GetNextInteger(stringReader); int nextInteger4 = SettingsItemBodyParser.GetNextInteger(stringReader); StorageWorkingHours workingHours = StorageWorkingHours.Create(nextTimeZone, nextInteger2, nextInteger3, nextInteger4); result = new TextNotificationSettings(mailboxRegionalConfiguration, calendarNotification, workingHours); } return(result); }
private static bool IsMobileAddressExactMatch(AnrManager.NameParsingResult parsingResult, RecipientAddress address) { if (!parsingResult.ParsedSuccessfully) { return(false); } if (!Utilities.IsMobileRoutingType(parsingResult.RoutingType)) { return(false); } if (!Utilities.IsMobileRoutingType(address.RoutingType)) { return(false); } E164Number objA = null; E164Number objB = null; return(E164Number.TryParse(parsingResult.RoutingAddress, out objA) && E164Number.TryParse(address.RoutingAddress, out objB) && object.Equals(objA, objB)); }
internal static PossibleRecipient GetMathed(IEnumerable <PossibleRecipient> candidates, E164Number number, bool snOnly) { if (candidates == null) { throw new ArgumentNullException("candidates"); } if (null == number) { throw new ArgumentNullException("number"); } foreach (PossibleRecipient possibleRecipient in candidates) { if (possibleRecipient.Ready && E164Number.Equals(possibleRecipient.PhoneNumber, number, snOnly)) { return(possibleRecipient); } } return(null); }
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); }
// Token: 0x0600109B RID: 4251 RVA: 0x00044010 File Offset: 0x00042210 private bool AddParticipant(Participant participant) { E164Number e164Number; if (!E164Number.TryParse(participant.EmailAddress, out e164Number)) { return(false); } for (int i = 0; i < this.CacheEntries.Count; i++) { RecipientInfoCacheEntry recipientInfoCacheEntry = this.CacheEntries[i]; E164Number number; if (!E164Number.TryParse(recipientInfoCacheEntry.RoutingAddress, out number)) { this.Tracer.TraceDebug <string>((long)this.GetHashCode(), "There's an invalid phone number in the SMS recipient cache of {0}'s mailbox", this.MailboxSession.MailboxOwner.MailboxInfo.DisplayName); } else if (SmsRecipientInfoCache.NumbersMatch(e164Number, number)) { this.CacheEntries[i] = SmsRecipientInfoCache.CreateCacheEntry(participant, e164Number.Number); return(true); } } if (this.CacheEntries.Count < 150) { this.CacheEntries.Add(SmsRecipientInfoCache.CreateCacheEntry(participant, e164Number.Number)); return(true); } int index = 0; for (int j = 1; j < this.CacheEntries.Count; j++) { if (this.CacheEntries[j].DateTimeTicks < this.CacheEntries[index].DateTimeTicks) { index = j; } } this.CacheEntries[index] = SmsRecipientInfoCache.CreateCacheEntry(participant, e164Number.Number); return(true); }
public override int GetHashCode() { int hash = 1; if (kindCase_ == KindOneofCase.E164Number) { hash ^= E164Number.GetHashCode(); } if (kindCase_ == KindOneofCase.ShortCode) { hash ^= ShortCode.GetHashCode(); } if (Extension.Length != 0) { hash ^= Extension.GetHashCode(); } hash ^= (int)kindCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public PossibleRecipient(bool effective, DateTime effectiveLastModificationTime, string region, string carrier, E164Number phonenumber, bool acknowledged, string passcode, List <DateTime> passcodeSentTimeHistory, List <DateTime> passcodeVerificationFailedTimeHistory) { this.Effective = effective; this.EffectiveLastModificationTime = effectiveLastModificationTime; this.Region = region; this.Carrier = carrier; this.PhoneNumber = phonenumber; this.Acknowledged = acknowledged; this.Passcode = passcode; this.PasscodeSentTimeHistory = passcodeSentTimeHistory; this.PasscodeVerificationFailedTimeHistory = passcodeVerificationFailedTimeHistory; }
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(); }
// Token: 0x0600109D RID: 4253 RVA: 0x00044170 File Offset: 0x00042370 private static bool NumbersMatch(E164Number number1, E164Number number2) { return(number1 == number2 || ((string.IsNullOrEmpty(number1.CountryCode) || string.IsNullOrEmpty(number2.CountryCode)) && string.Equals(number1.SignificantNumber, number2.SignificantNumber, StringComparison.OrdinalIgnoreCase))); }
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(); } }
internal static List <PropValue> TryParseMobilePhoneNumber(string inputString) { if (string.IsNullOrEmpty(inputString)) { return(null); } int num; int num2; string number; string text; if ((num = inputString.LastIndexOfAny(MobileRoutingTypeDriver.separatorsRightBracket)) == -1 || (num2 = inputString.LastIndexOfAny(MobileRoutingTypeDriver.separatorsLeftBracket)) == -1) { number = inputString; text = inputString; } else { if (num2 >= num || ((inputString[num2] != '[' || inputString[num] != ']') && (inputString[num2] != '<' || inputString[num] != '>'))) { return(null); } text = inputString.Substring(0, num2); number = inputString.Substring(num2 + 1, num - num2 - 1); } E164Number e164Number; if (!E164Number.TryParse(number, out e164Number)) { return(null); } int num3 = text.Length; int num4 = -1; int i = 0; while (i < text.Length) { if (!char.IsWhiteSpace(text[i])) { if ('"' == text[i]) { num3 = i; break; } break; } else { i++; } } int j = text.Length - 1; while (j >= num3) { if (!char.IsWhiteSpace(text[j])) { if ('"' == text[j]) { num4 = j; break; } break; } else { j--; } } if (num3 < num4) { text = text.Substring(num3 + 1, num4 - num3 - 1); } else { text = text.Trim(); } return(Participant.ListCoreProperties(text, e164Number.Number, "MOBILE")); }
public static E164Number Redact(E164Number e164Number, out string raw, out string redacted) { raw = null; redacted = null; return(null); }
private static void ValidateParticipant(Participant participant) { E164Number e164Number; if (string.Equals(participant.RoutingType, "MOBILE", StringComparison.OrdinalIgnoreCase) && !E164Number.TryParse(participant.EmailAddress, out e164Number)) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false) { ErrorStringForProtocolLogger = "BadMobileParticipantString" }; } }