[jboss-cvs] jboss-seam/src/mail/org/jboss/seam/mail/ui ...

Peter Muir peter at bleepbleep.org.uk
Tue Jan 23 14:25:31 EST 2007


  User: pmuir   
  Date: 07/01/23 14:25:31

  Modified:    src/mail/org/jboss/seam/mail/ui     UIReplyTo.java
                        UIMessage.java UIFrom.java MailComponent.java
  Log:
  Minor structural alteration to support attachments
  
  Revision  Changes    Path
  1.2       +3 -0      jboss-seam/src/mail/org/jboss/seam/mail/ui/UIReplyTo.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UIReplyTo.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/mail/org/jboss/seam/mail/ui/UIReplyTo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- UIReplyTo.java	21 Jan 2007 14:13:34 -0000	1.1
  +++ UIReplyTo.java	23 Jan 2007 19:25:31 -0000	1.2
  @@ -19,6 +19,9 @@
         try
         {
            MimeMessage mimeMessage = findMimeMessage();
  +         if (mimeMessage.getReplyTo() != null && mimeMessage.getReplyTo().length > 0) {
  +            throw new UnsupportedOperationException("Email cannot have more than one from address");
  +         }
            Address[] replyTo = {getInternetAddress(facesContext)}; 
            mimeMessage.setReplyTo(replyTo);
         }
  
  
  
  1.2       +2 -1      jboss-seam/src/mail/org/jboss/seam/mail/ui/UIMessage.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UIMessage.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/mail/org/jboss/seam/mail/ui/UIMessage.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- UIMessage.java	21 Jan 2007 14:13:34 -0000	1.1
  +++ UIMessage.java	23 Jan 2007 19:25:31 -0000	1.2
  @@ -13,7 +13,7 @@
   /**
    * JSF component which delimites the start and end of the mail message.  
    */
  -// TODO Support Priority,read receipt, encoding
  +// TODO Support Priority,read receipt, encoding, precedence
   // TODO Support getting session from JNDI
   public class UIMessage extends MailComponent
   {
  @@ -54,6 +54,7 @@
         super.encodeEnd(arg0);
         try
         {
  +         // TODO Can we improve upon this?
            Transport.send(getMimeMessage());
         }
         catch (Exception e)
  
  
  
  1.2       +4 -0      jboss-seam/src/mail/org/jboss/seam/mail/ui/UIFrom.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UIFrom.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/mail/org/jboss/seam/mail/ui/UIFrom.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- UIFrom.java	21 Jan 2007 14:13:34 -0000	1.1
  +++ UIFrom.java	23 Jan 2007 19:25:31 -0000	1.2
  @@ -17,7 +17,11 @@
      {
         try
         {
  +         
            MimeMessage mimeMessage = findMimeMessage();
  +        if (mimeMessage.getFrom() != null && mimeMessage.getFrom().length > 0) {
  +           throw new UnsupportedOperationException("Email cannot have more than one from address");
  +        }
            mimeMessage.setFrom(getInternetAddress(facesContext));
         }
         catch (Exception e)
  
  
  
  1.2       +7 -1      jboss-seam/src/mail/org/jboss/seam/mail/ui/MailComponent.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: MailComponent.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/mail/org/jboss/seam/mail/ui/MailComponent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- MailComponent.java	21 Jan 2007 14:13:34 -0000	1.1
  +++ MailComponent.java	23 Jan 2007 19:25:31 -0000	1.2
  @@ -7,7 +7,9 @@
   import javax.faces.component.UIComponentBase;
   import javax.faces.context.FacesContext;
   import javax.faces.context.ResponseWriter;
  +import javax.mail.MessagingException;
   import javax.mail.internet.MimeMessage;
  +import javax.mail.internet.MimeMultipart;
   
   import org.jboss.seam.ui.JSF;
   
  @@ -54,7 +56,7 @@
      /**
       * look up the tree for mail message
       */
  -   public MimeMessage findMimeMessage() {
  +   public MimeMessage findMimeMessage() throws MessagingException {
          UIMessage parent = (UIMessage) findParent(this, UIMessage.class);
          if (parent != null) 
          {
  @@ -66,6 +68,10 @@
          }
      }
      
  +   public MimeMultipart getRootMultipart() throws IOException, MessagingException {
  +      return (MimeMultipart) findMimeMessage().getContent();
  +   }
  +   
      public MailComponent findParent(UIComponent parent) {
         return findParent(parent, null);
      }
  
  
  



More information about the jboss-cvs-commits mailing list