geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject cvs commit: incubator-geronimo/specs/javamail/src/java/javax/mail MessageContext.java
Date Thu, 04 Sep 2003 01:37:01 GMT
dblevins    2003/09/03 18:37:01

  Modified:    specs/javamail/src/java/javax/mail MessageContext.java
  Log:
  Patch: GERONIMO-56
  From:  Alex Blewitt
  
  Implemented methods to MessageContext
  
  Revision  Changes    Path
  1.3       +21 -5     incubator-geronimo/specs/javamail/src/java/javax/mail/MessageContext.java
  
  Index: MessageContext.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/MessageContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MessageContext.java	16 Aug 2003 04:29:52 -0000	1.2
  +++ MessageContext.java	4 Sep 2003 01:37:01 -0000	1.3
  @@ -68,14 +68,30 @@
           _part = part;
       }
       public Message getMessage() {
  -        // TODO Review how to get this, if possible
  -        return null;
  +        return getMessageFrom(getPart());
  +    }
  +    private Message getMessageFrom(Part part) {
  +        if (part instanceof Message) {
  +            return (Message)part;
  +        } else if (part instanceof BodyPart) {
  +            Part parent = ((Multipart)part).getParent();
  +            return getMessageFrom(parent);
  +        } else if (part instanceof Multipart) {
  +            Part parent = ((Multipart)part).getParent();
  +            return getMessageFrom(parent);
  +        } else {
  +            return null;
  +        }
       }
       public Part getPart() {
           return _part;
       }
       public Session getSession() {
  -        // TODO Review how to get this, if possible
  -        return null;
  +        Message message = getMessage();
  +        if (message == null) {
  +            return null;
  +        } else {
  +            return message.session;
  +        }
       }
   }
  
  
  

Mime
View raw message