1
0
Fork 0
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:
M66B 2022-03-13 08:13:15 +01:00
parent 61d078f929
commit dc5574e0e5

View file

@ -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.