switched from Node to dedicated MimePart class and admit

that addPart() is broken
This commit is contained in:
hns 2001-07-31 23:59:25 +00:00
parent 171d615a9f
commit bd0441cda5

View file

@ -9,8 +9,9 @@ import javax.mail.internet.*;
import javax.activation.*;
import java.io.*;
import java.util.*;
import helma.objectmodel.IServer;
import helma.framework.core.*;
import helma.objectmodel.*;
import helma.util.*;
import FESI.Data.*;
import FESI.Interpreter.*;
import FESI.Exceptions.*;
@ -22,7 +23,6 @@ import FESI.Exceptions.*;
public class ESMail extends ESObject implements Serializable {
INode node;
MailExtension mailx;
Properties mprops;
MimeMessage message;
@ -94,20 +94,21 @@ public class ESMail extends ESObject implements Serializable {
multipart = new MimeMultipart ();
}
for (int i=0; i<val.length; i++) {
INode node = getNode (val[i]);
if (node != null) {
// FIXME: addPart is broken.
/* MimePart mp = null;
if (mp != null) {
BodyPart part = new MimeBodyPart ();
IServer.getLogger().log ("Adding MimePart: "+node.getContentType ());
NodeDataSource nds=new NodeDataSource (node);
part.setDataHandler(new DataHandler(nds));
IServer.getLogger().log ("Adding MimePart: "+mp.getContentType ());
MimePartDataSource ds = new MimePartDataSource (mp);
part.setDataHandler (new DataHandler(ds));
// part.setFileName(filename);
// part.setDataHandler (new javax.activation.DataHandler (node.getContent(), node.getContentType ()));
// part.setDataHandler (new javax.activation.DataHandler (mp.getContent(), mp.getContentType ()));
multipart.addBodyPart (part);
} else if (val[i] != null) {
BodyPart part = new MimeBodyPart ();
part.setContent (val[i].toString (), "text/plain");
multipart.addBodyPart (part);
}
} */
}
}
@ -185,20 +186,6 @@ public class ESMail extends ESObject implements Serializable {
}
private final INode getNode (Object obj) {
if (obj == null)
return null;
if (obj instanceof ESNode)
return ((ESNode) obj).getNode ();
if (obj instanceof ESWrapper) {
Object n = ((ESWrapper) obj).getJavaObject();
if (n instanceof INode)
return (INode) n;
}
return null;
}
}