org.apache.james.transport.mailets
Class UnwrapText

java.lang.Object
  extended by org.apache.mailet.base.GenericMailet
      extended by org.apache.james.transport.mailets.UnwrapText
All Implemented Interfaces:
Mailet, MailetConfig

public class UnwrapText
extends GenericMailet

Remove (best effort to) the hardcoded wrapping from a message.
If the text is "format=flowed" then deflows the text. Otherwise it forces a dewrap of the text.

Parameters:
quotewidth - when we try to dewrap e quoted text it helps knowing the original with, so we can reconstruct "wrapped wraps" created by multiple wrappings by clients with different original width or simply to the add of the heading ">" that increase the line length.
The value should be "WIDTH+X" if the original length is known, "-X" otherwise. In the latter case the length of the longer line will be used. X is the tollerance needed for the quoting chars: if the original width is known the suggested value for X is 2 (because of "> " prefix), otherwise it is suggested to increase it to a value like 10 (-10)

In summary, if the original wrap is known (for example 76, for flowed messages)
quotewidth = 78
Otherwise
quotewidth = -10


Field Summary
static java.lang.String PARAMETER_NAME_QUOTEWIDTH
           
 
Constructor Summary
UnwrapText()
           
 
Method Summary
 java.lang.String getMailetInfo()
          returns a String describing this mailet.
 void init()
           
 void service(Mail mail)
           
static java.lang.String unwrap(java.lang.String text)
           
static java.lang.String unwrap(java.lang.String text, int qwidth)
           
 
Methods inherited from class org.apache.mailet.base.GenericMailet
arrayToString, checkInitParameters, destroy, getInitParameter, getInitParameter, getInitParameter, getInitParameterNames, getMailetConfig, getMailetContext, getMailetName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAMETER_NAME_QUOTEWIDTH

public static final java.lang.String PARAMETER_NAME_QUOTEWIDTH
See Also:
Constant Field Values
Constructor Detail

UnwrapText

public UnwrapText()
Method Detail

getMailetInfo

public java.lang.String getMailetInfo()
returns a String describing this mailet.

Specified by:
getMailetInfo in interface Mailet
Overrides:
getMailetInfo in class GenericMailet
Returns:
A desciption of this mailet

init

public void init()
          throws MailetException
Overrides:
init in class GenericMailet
Throws:
MailetException

service

public void service(Mail mail)
             throws MailetException
Specified by:
service in interface Mailet
Specified by:
service in class GenericMailet
Throws:
MailetException

unwrap

public static java.lang.String unwrap(java.lang.String text)

unwrap

public static java.lang.String unwrap(java.lang.String text,
                                      int qwidth)


Copyright © 2008-2009 The Apache Software Foundation. All Rights Reserved.