Drupal: správný formát data (RFC 822)
authorFrantišek Kučera <franta-hg@frantovo.cz>
Tue, 11 Oct 2011 16:34:17 +0200
changeset 71beb11d70f0eb
parent 70 2177f9b14688
child 72 aae4b4688700
Drupal: správný formát data (RFC 822)
src/org/sonews/storage/impl/DrupalDatabase.java
     1.1 --- a/src/org/sonews/storage/impl/DrupalDatabase.java	Tue Oct 11 16:17:51 2011 +0200
     1.2 +++ b/src/org/sonews/storage/impl/DrupalDatabase.java	Tue Oct 11 16:34:17 2011 +0200
     1.3 @@ -24,10 +24,12 @@
     1.4  import java.sql.ResultSet;
     1.5  import java.sql.SQLException;
     1.6  import java.sql.Statement;
     1.7 +import java.text.SimpleDateFormat;
     1.8  import java.util.ArrayList;
     1.9  import java.util.Collections;
    1.10  import java.util.Date;
    1.11  import java.util.List;
    1.12 +import java.util.Locale;
    1.13  import java.util.logging.Level;
    1.14  import java.util.logging.Logger;
    1.15  import javax.mail.internet.MailDateFormat;
    1.16 @@ -57,6 +59,7 @@
    1.17  	protected int restarts = 0;
    1.18  	protected Connection conn = null;
    1.19  	private QuotedPrintableCodec qpc = new QuotedPrintableCodec(CHARSET);
    1.20 +	private SimpleDateFormat RFC822_DATE = new SimpleDateFormat("EEE', 'dd' 'MMM' 'yyyy' 'HH:mm:ss' 'Z", Locale.US);
    1.21  	// TODO: správná doména
    1.22  	private String myDomain = "kinderporno.cz";
    1.23  
    1.24 @@ -186,7 +189,7 @@
    1.25  		addHeader(sb, "From", MimeUtility.encodeWord(rs.getString("sender_name")) + " <>", false);
    1.26  		addHeader(sb, "Subject", rs.getString("subject"), true);
    1.27  		/** TODO: správný formát data: */
    1.28 -		addHeader(sb, "Date", MailDateFormat.getInstance().format(new Date(rs.getLong("created") * 1000)), false);
    1.29 +		addHeader(sb, "Date", RFC822_DATE.format(new Date(rs.getLong("created"))), false);
    1.30  		addHeader(sb, "Content-Type", "text/html; charset=" + CHARSET, false);
    1.31  		addHeader(sb, "Content-Transfer-Encoding", "quoted-printable", false);
    1.32  		//addHeader(sb, "Content-Transfer-Encoding", "base64", false);