public JunkEmailCollection.ValidationProblem TryAdd(string value) { JunkEmailCollection.ValidationProblem validationProblem = this.validating ? this.CheckValue(value) : JunkEmailCollection.ValidationProblem.NoError; if (validationProblem == JunkEmailCollection.ValidationProblem.NoError) { base.Add(value); } return(validationProblem); }
private void AddEntriesToCollection(JunkEmailCollection collection, string collectionName, Guid mailboxGuid, string[] entriesToAdd) { foreach (string text in entriesToAdd) { JunkEmailCollection.ValidationProblem validationProblem = collection.TryAdd(text); if (validationProblem != JunkEmailCollection.ValidationProblem.NoError && validationProblem != JunkEmailCollection.ValidationProblem.Duplicate) { throw new MailboxSettingsJunkMailErrorPermanentException(collectionName, text, validationProblem.ToString()); } } }
private void Validate(string value) { if (this.validating) { JunkEmailCollection.ValidationProblem validationProblem = this.CheckValue(value); if (validationProblem != JunkEmailCollection.ValidationProblem.NoError) { throw new JunkEmailValidationException(value, validationProblem); } } }
public JunkEmailValidationTuple(JunkEmailCollection.ValidationProblem problem, string address) { this.Address = address; switch (problem) { case JunkEmailCollection.ValidationProblem.Null: this.Problem = MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsNull; return; case JunkEmailCollection.ValidationProblem.Duplicate: this.Problem = MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsDuplicate; return; case JunkEmailCollection.ValidationProblem.FormatError: this.Problem = MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsMalformatted; return; case JunkEmailCollection.ValidationProblem.Empty: this.Problem = MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsEmpty; return; case JunkEmailCollection.ValidationProblem.TooBig: this.Problem = MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsTooBig; return; case JunkEmailCollection.ValidationProblem.TooManyEntries: this.Problem = MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsFull; return; case JunkEmailCollection.ValidationProblem.EntryInInvalidEntriesList: this.Problem = MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsInvalid; return; default: this.Problem = MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsGood; return; } }
// Token: 0x06000B97 RID: 2967 RVA: 0x00050FAC File Offset: 0x0004F1AC private static bool InternalAdd(JunkEmailRule junkEmailRule, string email, JunkEmailListType junkEmailListType, UserContext userContext, bool isFromOptions, out string message) { bool result = true; message = string.Empty; string text = string.Empty; bool flag = JunkEmailUtilities.IsDomain(ref email); JunkEmailCollection.ValidationProblem validationProblem = JunkEmailCollection.ValidationProblem.NoError; try { switch (junkEmailListType) { case JunkEmailListType.SafeSenders: text = LocalizedStrings.GetNonEncoded(-644781195); if (flag) { validationProblem = junkEmailRule.TrustedSenderDomainCollection.TryAdd(email); message = string.Format(LocalizedStrings.GetNonEncoded(-1801060492), email, text); } else if (JunkEmailUtilities.IsInternalToOrganization(email, userContext)) { message = string.Format(LocalizedStrings.GetNonEncoded(878888369), email, text); result = false; } else { validationProblem = junkEmailRule.TrustedSenderEmailCollection.TryAdd(email); message = string.Format(LocalizedStrings.GetNonEncoded(-1801060492), email, text); } break; case JunkEmailListType.BlockedSenders: text = LocalizedStrings.GetNonEncoded(-145011736); if (flag) { validationProblem = junkEmailRule.BlockedSenderDomainCollection.TryAdd(email); message = string.Format(LocalizedStrings.GetNonEncoded(-1801060492), email, text); } else if (JunkEmailUtilities.IsInternalToOrganization(email, userContext)) { message = string.Format(LocalizedStrings.GetNonEncoded(878888369), email, text); result = false; } else { validationProblem = junkEmailRule.BlockedSenderEmailCollection.TryAdd(email); message = string.Format(LocalizedStrings.GetNonEncoded(-1801060492), email, text); } break; case JunkEmailListType.SafeRecipients: text = LocalizedStrings.GetNonEncoded(-606405795); if (JunkEmailUtilities.IsUsersEmailOrDomain(email, flag, userContext)) { message = string.Format(LocalizedStrings.GetNonEncoded(-1238229754), text); result = false; } else if (flag) { validationProblem = junkEmailRule.TrustedRecipientDomainCollection.TryAdd(email); message = string.Format(LocalizedStrings.GetNonEncoded(-1801060492), email, text); } else { validationProblem = junkEmailRule.TrustedRecipientEmailCollection.TryAdd(email); message = string.Format(LocalizedStrings.GetNonEncoded(-1801060492), email, text); } break; default: throw new OwaInvalidRequestException("Invalid list type"); } } catch (JunkEmailValidationException ex) { ExTraceGlobals.CoreTracer.TraceDebug(0L, "JunkEmailValidationException was caught by JunkEmailUtilities.InternalAdd."); validationProblem = ex.Problem; } finally { switch (validationProblem) { case JunkEmailCollection.ValidationProblem.NoError: case JunkEmailCollection.ValidationProblem.Empty: goto IL_309; case JunkEmailCollection.ValidationProblem.Duplicate: message = string.Format(LocalizedStrings.GetNonEncoded(-1222968570), flag ? LocalizedStrings.GetNonEncoded(-520821858) : LocalizedStrings.GetNonEncoded(-1951590110), text); goto IL_309; case JunkEmailCollection.ValidationProblem.FormatError: message = string.Format(LocalizedStrings.GetNonEncoded(488857414), flag ? LocalizedStrings.GetNonEncoded(-520821858) : LocalizedStrings.GetNonEncoded(-1951590110), text, isFromOptions ? LocalizedStrings.GetNonEncoded(-2139153122) : string.Empty); result = false; goto IL_309; case JunkEmailCollection.ValidationProblem.TooBig: message = string.Format(LocalizedStrings.GetNonEncoded(1628764363), flag ? LocalizedStrings.GetNonEncoded(-520821858) : LocalizedStrings.GetNonEncoded(-1951590110), text); result = false; goto IL_309; case JunkEmailCollection.ValidationProblem.TooManyEntries: message = string.Format(LocalizedStrings.GetNonEncoded(1708451641), flag ? LocalizedStrings.GetNonEncoded(-520821858) : LocalizedStrings.GetNonEncoded(-1951590110), text); result = false; goto IL_309; } message = string.Format(LocalizedStrings.GetNonEncoded(1312248603), flag ? LocalizedStrings.GetNonEncoded(-520821858) : LocalizedStrings.GetNonEncoded(-1951590110), text); result = false; IL_309 :; } return(result); }
public JunkEmailValidationException(string value, JunkEmailCollection.ValidationProblem problem) : base(ServerStrings.JunkEmailValidationError(value)) { EnumValidator.ThrowIfInvalid <JunkEmailCollection.ValidationProblem>(problem, "problem"); this.problem = problem; }