예제 #1
0
        // Token: 0x06000B99 RID: 2969 RVA: 0x00051350 File Offset: 0x0004F550
        private static void InternalRemove(JunkEmailRule junkEmailRule, string[] email, JunkEmailListType junkEmailListType, UserContext userContext)
        {
            switch (junkEmailListType)
            {
            case JunkEmailListType.SafeSenders:
                for (int i = 0; i < email.Length; i++)
                {
                    if (JunkEmailUtilities.IsDomain(ref email[i]))
                    {
                        junkEmailRule.TrustedSenderDomainCollection.Remove(email[i]);
                    }
                    else
                    {
                        junkEmailRule.TrustedSenderEmailCollection.Remove(email[i]);
                    }
                }
                return;

            case JunkEmailListType.BlockedSenders:
                for (int j = 0; j < email.Length; j++)
                {
                    if (JunkEmailUtilities.IsDomain(ref email[j]))
                    {
                        junkEmailRule.BlockedSenderDomainCollection.Remove(email[j]);
                    }
                    else
                    {
                        junkEmailRule.BlockedSenderEmailCollection.Remove(email[j]);
                    }
                }
                return;

            case JunkEmailListType.SafeRecipients:
                for (int k = 0; k < email.Length; k++)
                {
                    if (JunkEmailUtilities.IsDomain(ref email[k]))
                    {
                        junkEmailRule.TrustedRecipientDomainCollection.Remove(email[k]);
                    }
                    else
                    {
                        junkEmailRule.TrustedRecipientEmailCollection.Remove(email[k]);
                    }
                }
                return;

            default:
                throw new OwaInvalidRequestException("Invalid list type");
            }
        }
예제 #2
0
        // 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);
        }