Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.mail
Class MessageUtils

java.lang.Object
  extended by com.jivesoftware.forum.mail.MessageUtils

public class MessageUtils
extends java.lang.Object

Utility functions for reading Message data.


Field Summary
static java.lang.String ENABLED_TOKEN
          Token string used in freemarker templates to determing if email reply to watches is enabled.
static java.lang.String END_TOKEN
          Token string used to detect the end of template text when parsing incoming mail.
 
Constructor Summary
MessageUtils()
           
 
Method Summary
static java.lang.String addressArrayToString(javax.mail.Address[] addresses)
          Returns the first address in the supplied array as a String.
static java.lang.String addressToString(javax.mail.Address address)
          Converts an Address to a String.
static int getIndexAfterEndToken(java.lang.String messageBody)
          Returns the position in the suppled string past the last occurrence of the template end token.
static java.util.List getMessageAttachments(javax.mail.Message message)
          If the supplied Message has a mimetype matching the pattern multipart/*, all parts will be looped through in search of attachment data.
static java.lang.String getMessageBodyText(javax.mail.Part message)
          Reads the supplied Part and returns its body text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

END_TOKEN

public static final java.lang.String END_TOKEN
Token string used to detect the end of template text when parsing incoming mail. It is appended to all email templates.

See Also:
Constant Field Values

ENABLED_TOKEN

public static final java.lang.String ENABLED_TOKEN
Token string used in freemarker templates to determing if email reply to watches is enabled.

See Also:
Constant Field Values
Constructor Detail

MessageUtils

public MessageUtils()
Method Detail

getMessageBodyText

public static java.lang.String getMessageBodyText(javax.mail.Part message)
                                           throws javax.mail.MessagingException,
                                                  java.io.IOException,
                                                  EmailMonitorException
Reads the supplied Part and returns its body text.

Parameters:
message - the Part to read.
Returns:
the body text as either plain text or html.
Throws:
javax.mail.MessagingException
java.io.IOException
EmailMonitorException

getMessageAttachments

public static java.util.List getMessageAttachments(javax.mail.Message message)
                                            throws javax.mail.MessagingException,
                                                   java.io.IOException
If the supplied Message has a mimetype matching the pattern multipart/*, all parts will be looped through in search of attachment data. A List of AttachmentData objects is returned with the results.

Parameters:
message - the message to search for attachments.
Returns:
s List of AttachmentData objects representing all attachments.
Throws:
javax.mail.MessagingException - if accessing message data fails.
java.io.IOException - if reading message data fails.

addressToString

public static java.lang.String addressToString(javax.mail.Address address)
Converts an Address to a String.

Parameters:
address - the address to convert.
Returns:
the string representation of the address.

addressArrayToString

public static java.lang.String addressArrayToString(javax.mail.Address[] addresses)
Returns the first address in the supplied array as a String. If the array is empty, this method returns null.

Parameters:
addresses - the array of Address to return as a string.
Returns:
the first address in the supplied array as a String, or null if the array is empty.

getIndexAfterEndToken

public static int getIndexAfterEndToken(java.lang.String messageBody)
Returns the position in the suppled string past the last occurrence of the template end token. Used to find body text which is entered below a threaded email reply rather than above.

Parameters:
messageBody - the body of the message to scan.
Returns:
the position in the suppled string past the last occurrence of the template end token, or -1 if no text exists beyond the token, or if no token exists.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.