You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by se...@apache.org on 2001/08/12 00:02:01 UTC

cvs commit: jakarta-james/src/java/org/apache/james/transport/matchers HasAttachment.java

serge       01/08/11 15:02:01

  Added:       src/java/org/apache/james/transport/matchers
                        HasAttachment.java
  Log:
  Another simple matcher.
  
  Revision  Changes    Path
  1.1                  jakarta-james/src/java/org/apache/james/transport/matchers/HasAttachment.java
  
  Index: HasAttachment.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.james.transport.matchers;
  
  import org.apache.mailet.*;
  import java.util.*;
  import javax.mail.*;
  import javax.mail.internet.*;
  
  /**
   * Checks whether this message has an attachment
   *
   * @author  Serge Knystautas <se...@lokitech.com>
   */
  public class HasAttachment extends GenericMatcher {
  
      public Collection match(Mail mail) throws MessagingException {
          MimeMessage message = mail.getMessage();
  
          if (message.getContentType() != null &&
                  message.getContentType().startsWith("multipart/mixed")) {
              return mail.getRecipients();
          } else {
              return null;
          }
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org