Exemplo n.º 1
0
        // Token: 0x06000BA5 RID: 2981 RVA: 0x00051774 File Offset: 0x0004F974
        public static void SortJunkEmailIds(UserContext userContext, StoreObjectId[] sourceIds, out StoreObjectId[] junkIds, out StoreObjectId[] normalIds)
        {
            List <StoreObjectId> list  = new List <StoreObjectId>();
            List <StoreObjectId> list2 = new List <StoreObjectId>();

            for (int i = 0; i < sourceIds.Length; i++)
            {
                try
                {
                    if (JunkEmailUtilities.IsInJunkEmailFolder(sourceIds[i], userContext))
                    {
                        list.Add(sourceIds[i]);
                    }
                    else
                    {
                        list2.Add(sourceIds[i]);
                    }
                }
                catch (ObjectNotFoundException)
                {
                }
            }
            junkIds   = list.ToArray();
            normalIds = list2.ToArray();
        }
Exemplo n.º 2
0
        // Token: 0x06000B9B RID: 2971 RVA: 0x0005148C File Offset: 0x0004F68C
        public static bool Edit(string oldEmail, string newEmail, JunkEmailListType junkEmailListType, UserContext userContext, bool isFromOptions, out string message)
        {
            if (string.IsNullOrEmpty(oldEmail))
            {
                throw new ArgumentNullException("oldEmail", "oldEmail cannot be null or empty");
            }
            if (string.IsNullOrEmpty(newEmail))
            {
                throw new ArgumentNullException("newEmail", "newEmail cannot be null or empty");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            bool flag = true;

            message = string.Empty;
            string        empty         = string.Empty;
            JunkEmailRule junkEmailRule = userContext.MailboxSession.JunkEmailRule;

            string[] email = new string[]
            {
                oldEmail
            };
            JunkEmailUtilities.InternalRemove(junkEmailRule, email, junkEmailListType, userContext);
            if (!JunkEmailUtilities.InternalAdd(junkEmailRule, newEmail, junkEmailListType, userContext, isFromOptions, out message))
            {
                flag = false;
            }
            if (flag)
            {
                junkEmailRule.Save();
            }
            return(flag);
        }
Exemplo n.º 3
0
        // Token: 0x06000BA2 RID: 2978 RVA: 0x000516AC File Offset: 0x0004F8AC
        public static bool IsInJunkEmailFolder(StoreObjectId itemId, UserContext userContext)
        {
            bool result;

            using (Item item = Item.BindAsMessage(userContext.MailboxSession, itemId))
            {
                result = JunkEmailUtilities.IsInJunkEmailFolder(item, false, userContext);
            }
            return(result);
        }
Exemplo n.º 4
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");
            }
        }
Exemplo n.º 5
0
        // Token: 0x06000B9F RID: 2975 RVA: 0x00051624 File Offset: 0x0004F824
        public static bool IsSuspectedPhishingItem(IStorePropertyBag storePropertyBag)
        {
            if (storePropertyBag == null)
            {
                throw new ArgumentNullException("storePropertyBag");
            }
            int    itemPhishingLevel = 1;
            object obj = storePropertyBag.TryGetProperty(ItemSchema.EdgePcl);

            if (!(obj is PropertyError))
            {
                itemPhishingLevel = (int)obj;
            }
            return(JunkEmailUtilities.IsSuspectedPhishingItem(itemPhishingLevel));
        }
Exemplo n.º 6
0
        // Token: 0x06000B9A RID: 2970 RVA: 0x0005143C File Offset: 0x0004F63C
        public static void Remove(string[] email, JunkEmailListType junkEmailListType, UserContext userContext)
        {
            if (email == null || email.Length <= 0)
            {
                throw new ArgumentNullException("email", "email cannot be null or empty");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            JunkEmailRule junkEmailRule = userContext.MailboxSession.JunkEmailRule;

            JunkEmailUtilities.InternalRemove(junkEmailRule, email, junkEmailListType, userContext);
            junkEmailRule.Save();
        }
Exemplo n.º 7
0
        // Token: 0x06000BA9 RID: 2985 RVA: 0x00051840 File Offset: 0x0004FA40
        public static void GetJunkEmailPropertiesForItem(IStorePropertyBag storePropertyBag, bool isEmbedded, bool forceEnableItemLink, UserContext userContext, out bool isInJunkEmailFolder, out bool isSuspectedPhishingItem, out bool itemLinkEnabled, out bool isJunkOrPhishing)
        {
            if (storePropertyBag == null)
            {
                throw new ArgumentNullException("storePropertyBag");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            isInJunkEmailFolder     = JunkEmailUtilities.IsInJunkEmailFolder(storePropertyBag, isEmbedded, userContext);
            isSuspectedPhishingItem = JunkEmailUtilities.IsSuspectedPhishingItem(storePropertyBag);
            bool flag = JunkEmailUtilities.IsItemLinkEnabled(storePropertyBag);

            itemLinkEnabled  = (forceEnableItemLink || flag);
            isJunkOrPhishing = JunkEmailUtilities.IsJunkOrPhishing(isInJunkEmailFolder, isSuspectedPhishingItem, itemLinkEnabled);
        }
Exemplo n.º 8
0
        // Token: 0x06000BA8 RID: 2984 RVA: 0x000517FC File Offset: 0x0004F9FC
        public static bool IsJunkOrPhishing(IStorePropertyBag storePropertyBag, bool isEmbeddedItem, bool forceEnableItemLink, UserContext userContext)
        {
            if (storePropertyBag == null)
            {
                throw new ArgumentNullException("storePropertyBag");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            bool flag   = false;
            bool flag2  = false;
            bool flag3  = false;
            bool result = false;

            JunkEmailUtilities.GetJunkEmailPropertiesForItem(storePropertyBag, isEmbeddedItem, forceEnableItemLink, userContext, out flag, out flag2, out flag3, out result);
            return(result);
        }
Exemplo n.º 9
0
        // Token: 0x06000B98 RID: 2968 RVA: 0x000512F8 File Offset: 0x0004F4F8
        public static bool Add(string email, JunkEmailListType junkEmailListType, UserContext userContext, bool isFromOptions, out string message)
        {
            if (string.IsNullOrEmpty(email))
            {
                throw new ArgumentNullException("email", "email cannot be null or empty");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            JunkEmailRule junkEmailRule = userContext.MailboxSession.JunkEmailRule;
            bool          flag          = JunkEmailUtilities.InternalAdd(junkEmailRule, email, junkEmailListType, userContext, isFromOptions, out message);

            if (flag)
            {
                junkEmailRule.Save();
            }
            return(flag);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
 // Token: 0x06000BA7 RID: 2983 RVA: 0x000517F0 File Offset: 0x0004F9F0
 public static bool IsJunkOrPhishing(IStorePropertyBag storePropertyBag, bool isEmbeddedItem, UserContext userContext)
 {
     return(JunkEmailUtilities.IsJunkOrPhishing(storePropertyBag, isEmbeddedItem, false, userContext));
 }
Exemplo n.º 12
0
 // Token: 0x06000BA3 RID: 2979 RVA: 0x000516EC File Offset: 0x0004F8EC
 public static bool IsInJunkEmailFolder(OwaStoreObjectId itemId, UserContext userContext)
 {
     return(!itemId.IsPublic && JunkEmailUtilities.IsInJunkEmailFolder(itemId.StoreObjectId, userContext));
 }