mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-28 02:37:16 +00:00
Avoid data handler thread
This commit is contained in:
parent
61d078f929
commit
dc5574e0e5
1 changed files with 23 additions and 0 deletions
|
@ -10,6 +10,8 @@
|
|||
|
||||
package javax.activation;
|
||||
|
||||
import com.sun.mail.imap.IMAPNestedMessage;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
@ -17,6 +19,9 @@ import java.io.PipedInputStream;
|
|||
import java.io.PipedOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeUtility;
|
||||
//import java.awt.datatransfer.Transferable;
|
||||
//import java.awt.datatransfer.DataFlavor;
|
||||
//import java.awt.datatransfer.UnsupportedFlavorException;
|
||||
|
@ -232,6 +237,24 @@ public class DataHandler /*implements Transferable*/ {
|
|||
"no object DCH for MIME type " + getBaseType());
|
||||
}
|
||||
// there is none but the default^^^^^^^^^^^^^^^^
|
||||
|
||||
if (object instanceof IMAPNestedMessage &&
|
||||
dch instanceof ObjectDataContentHandler)
|
||||
try {
|
||||
IMAPNestedMessage nested = (IMAPNestedMessage) object;
|
||||
String encoding = nested.getEncoding();
|
||||
if (encoding == null)
|
||||
return nested.getMimeStream();
|
||||
else
|
||||
return MimeUtility.decode(nested.getMimeStream(), encoding);
|
||||
} catch (MessagingException ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
|
||||
eu.faircode.email.Log.e("DataHandler" +
|
||||
" object=" + (object == null ? null : object.getClass().getName()) +
|
||||
" dch=" + dch.getClass().getName());
|
||||
|
||||
final DataContentHandler fdch = dch;
|
||||
|
||||
// from bill s.
|
||||
|
|
Loading…
Reference in a new issue