Subversion Repositories SmartDukaan

Rev

Rev 3408 | Rev 4142 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3408 Rev 3546
Line 26... Line 26...
26
import javax.mail.Message;
26
import javax.mail.Message;
27
import javax.mail.MessagingException;
27
import javax.mail.MessagingException;
28
import javax.mail.Multipart;
28
import javax.mail.Multipart;
29
import javax.mail.Part;
29
import javax.mail.Part;
30
 
30
 
-
 
31
import net.htmlparser.jericho.Source;
-
 
32
 
31
import org.apache.commons.logging.Log;
33
import org.apache.commons.logging.Log;
32
import org.apache.commons.logging.LogFactory;
34
import org.apache.commons.logging.LogFactory;
33
import org.apache.thrift.TException;
35
import org.apache.thrift.TException;
34
import org.apache.thrift.transport.TTransportException;
36
import org.apache.thrift.transport.TTransportException;
35
 
37
 
Line 210... Line 212...
210
     * Return the primary text content of the message.
212
     * Return the primary text content of the message.
211
     */
213
     */
212
    private String getText(Part p) throws MessagingException, IOException {
214
    private String getText(Part p) throws MessagingException, IOException {
213
        if (p.isMimeType("text/*")) {
215
        if (p.isMimeType("text/*")) {
214
            String s = (String) p.getContent();
216
            String s = (String) p.getContent();
-
 
217
            if (p.isMimeType("text/html")) {
-
 
218
                return new Source(s).getTextExtractor().toString();
-
 
219
            }
-
 
220
            else {
215
            return s;
221
                return s;
-
 
222
            }
216
        }
223
        }
217
 
224
 
218
        if (p.isMimeType("multipart/alternative")) {
225
        if (p.isMimeType("multipart/alternative")) {
219
            // prefer plain text over html text
226
            // prefer plain text over html text
220
            Multipart mp = (Multipart) p.getContent();
227
            Multipart mp = (Multipart) p.getContent();