SusiMail: Add Date header to sent messages, as required

Make Loader static
This commit is contained in:
zzz
2018-02-21 15:05:15 +00:00
parent 61ae0a597a
commit 56c17300d5
2 changed files with 8 additions and 2 deletions

View File

@ -162,7 +162,7 @@ class PersistentMailCache {
* Load files from in, add mail to out
* @since 0.9.34
*/
private class Loader implements Runnable {
private static class Loader implements Runnable {
private final Queue<File> _in;
private final Queue<Mail> _out;
@ -345,6 +345,9 @@ class PersistentMailCache {
}
/**
* This is for the initial load only.
* Others will use getMail().
*
* @return null on failure
*/
private static Mail load(File f) {

View File

@ -84,6 +84,7 @@ import net.i2p.servlet.RequestWrapper;
import net.i2p.servlet.util.ServletUtil;
import net.i2p.servlet.util.WriterOutputStream;
import net.i2p.util.I2PAppThread;
import net.i2p.util.RFC822Date;
import net.i2p.util.SecureFileOutputStream;
import net.i2p.util.Translate;
@ -2492,6 +2493,8 @@ public class WebMail extends HttpServlet
if( ok ) {
StringBuilder body = new StringBuilder(1024);
I2PAppContext ctx = I2PAppContext.getGlobalContext();
body.append("Date: " + RFC822Date.to822Date(ctx.clock().now()) + "\r\n");
// todo include real names, and headerline encode them
body.append( "From: " + from + "\r\n" );
Mail.appendRecipients( body, toList, "To: " );
@ -2502,7 +2505,7 @@ public class WebMail extends HttpServlet
ok = false;
sessionObject.error += e.getMessage();
}
String boundary = "_=" + I2PAppContext.getGlobalContext().random().nextLong();
String boundary = "_=" + ctx.random().nextLong();
if (multipart) {
body.append( "MIME-Version: 1.0\r\nContent-type: multipart/mixed; boundary=\"" + boundary + "\"\r\n\r\n" );
}