1 17 18 package org.apache.james.transport.matchers; 19 20 import org.apache.mailet.GenericRecipientMatcher; 21 import org.apache.mailet.MailAddress; 22 23 import java.util.Collection ; 24 import java.util.Locale ; 25 import java.util.StringTokenizer ; 26 import java.util.Vector ; 27 28 31 public class HostIs extends GenericRecipientMatcher { 32 33 private Collection hosts; 34 35 public void init() { 36 StringTokenizer st = new StringTokenizer (getCondition(), ", ", false); 37 hosts = new Vector (); 38 while (st.hasMoreTokens()) { 39 hosts.add(st.nextToken().toLowerCase(Locale.US)); 40 } 41 } 42 43 public boolean matchRecipient(MailAddress recipient) { 44 return hosts.contains(recipient.getHost().toLowerCase(Locale.US)); 45 } 46 } 47 | Popular Tags |