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