예제 #1
0
        private bool ShouldSubmit(MessageItem message)
        {
            if (this.IsScheduleMessage(message))
            {
                base.Context.TraceDebug("Delegate action: Message will be forwarded.");
                return(true);
            }
            ProxyAddress originalSender = RuleUtil.GetOriginalSender(base.Context.Message);

            if (originalSender == null || originalSender is InvalidProxyAddress)
            {
                base.Context.TraceDebug("Delegate action: Sent-Representing properties are not valid, message will not be forwarded.");
                return(false);
            }
            base.Context.TraceDebug <ProxyAddress>("Delegate action: Message will be sent representing {0}.", originalSender);
            Result <ADRawEntry> result = base.Context.RecipientCache.FindAndCacheRecipient(originalSender);

            if (result.Data == null)
            {
                if (ProviderError.NotFound == result.Error)
                {
                    base.Context.TraceError("Delegate action: Sender doesn't exist in AD.");
                }
                else
                {
                    base.Context.TraceError <ProviderError>("Delegate action: Sender look up failed: {0}", result.Error);
                }
                base.Context.TraceDebug("Delegate action: Message will not be forwarded.");
                return(false);
            }
            base.Context.TraceDebug("Delegate action: Message will be forwarded.");
            return(true);
        }