Ejemplo n.º 1
0
 private void CreateWorkItemForReply(FolderEvaluationResult result, RuleAction.Reply action, int actionIndex)
 {
     if (RuleUtil.IsSameUser(this.context, this.context.RecipientCache, this.context.Sender, this.context.Recipient))
     {
         this.context.TraceDebug("Do not generate reply to self.");
         return;
     }
     if (ObjectClass.IsDsn(this.context.Message.ClassName) || ObjectClass.IsMdn(this.context.Message.ClassName))
     {
         this.context.TraceDebug("Do not generate reply for Dsn or Mdn messages");
         return;
     }
     if ((this.context.Message.AutoResponseSuppress & AutoResponseSuppress.AutoReply) != AutoResponseSuppress.None)
     {
         this.context.TraceDebug("Do not generate reply since Auto-Reply is being suppressed on current message");
         return;
     }
     if (ObjectClass.IsApprovalMessage(this.context.Message.ClassName))
     {
         this.context.TraceDebug("Do not generate reply to approval message.");
         return;
     }
     if (this.context.LimitChecker.DoesExceedAutoReplyLimit())
     {
         return;
     }
     result.AddWorkItem(new ReplyWorkItem(this.context, action.ReplyTemplateMessageEntryID, action.ReplyTemplateGuid, action.Flags, actionIndex));
 }
        protected static RecipientItemType GetRecipientType(RuleEvaluationContextBase context)
        {
            RecipientItemType result = RecipientItemType.Unknown;
            string            text   = context.PropertyBag[StoreObjectSchema.ItemClass] as string;

            if (!string.IsNullOrEmpty(text) && ObjectClass.IsReport(text))
            {
                result = RecipientItemType.To;
            }
            else
            {
                RecipientCollection recipients = context.Message.Recipients;
                for (int i = 0; i < recipients.Count; i++)
                {
                    if (recipients[i].Participant.RoutingType != null && recipients[i].Participant.EmailAddress != null)
                    {
                        ProxyAddress addressToResolve = ProxyAddress.Parse(recipients[i].Participant.RoutingType, recipients[i].Participant.EmailAddress);
                        if (RuleUtil.IsSameUser(context, context.RecipientCache, addressToResolve, context.Recipient))
                        {
                            result = recipients[i].RecipientItemType;
                            break;
                        }
                    }
                }
            }
            return(result);
        }
        public bool CompareAddresses(object messageValue, object ruleValue)
        {
            ProxyAddress proxyAddressFromSearchKey  = RuleUtil.GetProxyAddressFromSearchKey(messageValue);
            ProxyAddress proxyAddressFromSearchKey2 = RuleUtil.GetProxyAddressFromSearchKey(ruleValue);

            if (proxyAddressFromSearchKey2 == null || proxyAddressFromSearchKey2 is InvalidProxyAddress || string.IsNullOrEmpty(proxyAddressFromSearchKey2.ValueString))
            {
                string recipient = ServerStrings.Null;
                if (proxyAddressFromSearchKey2 != null)
                {
                    recipient = proxyAddressFromSearchKey2.ToString();
                }
                this.DisableAndMarkRuleInError(this.CurrentRule, RuleAction.Type.OP_INVALID, 0, DeferredError.RuleError.Parsing);
                this.RecordError(ServerStrings.FolderRuleErrorInvalidRecipient(recipient));
                return(false);
            }
            this.TraceDebug <ProxyAddress, ProxyAddress>("Comparing recipients, message address {0}, rule address {1}", proxyAddressFromSearchKey, proxyAddressFromSearchKey2);
            RuleUtil.FaultInjection((FaultInjectionLid)4257530192U);
            return(RuleUtil.IsSameUser(this, this.RecipientCache, proxyAddressFromSearchKey, proxyAddressFromSearchKey2));
        }