CombineMatcher uses the results of multiple matchers to make a decision. The results of the individual matchers can be combined using the logic operations AND, OR and NOT. Both existing matcher policies (
) and policies defined only within the particular CombineMatcher ( ) can be used.New matchers can be added with the
button. Each line in the main window of the CombineMatcher configuration panel corresponds to a matcher. To use an existing matcher policy, set the combobox on the left to . After that, clicking the icon opens a dialog window where the matcher to be used can be selected.Tip |
---|
Matchers can also be configured whenever needed: set the combobox to , click on the icon, and select and configure the matcher as required. |
Each matcher can be taken into consideration either with its regular, or with its inverted result using the
checkbox. The individual matchers (or their inverses) can be combined with the logical AND, and OR operations. This can be set in the combobox:: It corresponds to the logical AND; the CombineMatcher will return the TRUE value only if all criteria are TRUE.
: It corresponds to the logical OR; the CombineMatcher will return the TRUE value if at least one criteria is TRUE.
: CombineMatcher will return the TRUE value if all criteria have the same value (either TRUE or FALSE).
Tip |
---|
A CombineMatcher can also be used to combine the results of other CombineMatchers, thus very complex decisions can also be made. |
Example 6.12. Blacklisting e-mail recipients |
---|
A simple use for CombineMatcher is to filter the recipients of e-mail addresses using the following process:
Python: class SmtpRecipientMatcherProxy(SmtpProxy): recipient_matcher="SmtpCombineMatcher" def config(self): SmtpProxy.config(self) MatcherPolicy(name="SmtpCombineMatcher", matcher=CombineMatcher\ (expr=(Z_AND, "SmtpCheckrecipient", "SmtpWhitelist"))) MatcherPolicy(name="SmtpWhitelist", matcher=RegexpMatcher\ (match_list=("info@example.com",), ignore_list=None)) MatcherPolicy(name="SmtpCheckrecipient", matcher=SmtpInvalidRecipientMatcher\ (server_port=25, cache_timeout=60, attempt_delivery=FALSE, \ force_delivery_attempt=FALSE, server_name="recipientcheck.example.com")) |
Published on May 30, 2024
© BalaSys IT Ltd.
Send your comments to support@balasys.hu