mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
. Fixed issue 626 and issue 528:
Date header was not set properly
This commit is contained in:
parent
c2ca739293
commit
ac022ce467
@ -1528,7 +1528,7 @@ public class MessagingController implements Runnable {
|
||||
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
|
||||
LocalFolder localFolder = (LocalFolder)localStore.getFolder(account.getErrorFolderName());
|
||||
Message[] messages = new Message[1];
|
||||
Message message = new MimeMessage();
|
||||
MimeMessage message = new MimeMessage();
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
PrintStream ps = new PrintStream(baos);
|
||||
t.printStackTrace(ps);
|
||||
@ -1540,7 +1540,7 @@ public class MessagingController implements Runnable {
|
||||
long nowTime = System.currentTimeMillis();
|
||||
Date nowDate = new Date(nowTime);
|
||||
message.setInternalDate(nowDate);
|
||||
message.setSentDate(nowDate);
|
||||
message.addSentDate(nowDate);
|
||||
message.setFrom(new Address(account.getEmail(), "K9mail internal"));
|
||||
messages[0] = message;
|
||||
|
||||
@ -1579,7 +1579,7 @@ public class MessagingController implements Runnable {
|
||||
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
|
||||
LocalFolder localFolder = (LocalFolder)localStore.getFolder(account.getErrorFolderName());
|
||||
Message[] messages = new Message[1];
|
||||
Message message = new MimeMessage();
|
||||
MimeMessage message = new MimeMessage();
|
||||
|
||||
|
||||
message.setBody(new TextBody(body));
|
||||
@ -1589,7 +1589,7 @@ public class MessagingController implements Runnable {
|
||||
long nowTime = System.currentTimeMillis();
|
||||
Date nowDate = new Date(nowTime);
|
||||
message.setInternalDate(nowDate);
|
||||
message.setSentDate(nowDate);
|
||||
message.addSentDate(nowDate);
|
||||
message.setFrom(new Address(account.getEmail(), "K9mail internal"));
|
||||
messages[0] = message;
|
||||
|
||||
|
@ -630,7 +630,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
|
||||
private MimeMessage createMessage(boolean appendSig) throws MessagingException {
|
||||
MimeMessage message = new MimeMessage();
|
||||
message.setSentDate(new Date());
|
||||
message.addSentDate(new Date());
|
||||
Address from = new Address(mIdentity.getEmail(), mIdentity.getName());
|
||||
message.setFrom(from);
|
||||
message.setRecipients(RecipientType.TO, getAddresses(mToView));
|
||||
|
@ -104,20 +104,31 @@ public class MimeMessage extends Message {
|
||||
return mSentDate;
|
||||
}
|
||||
|
||||
public void setSentDate(Date sentDate) throws MessagingException {
|
||||
/**
|
||||
* Sets the sent date object member as well as *adds* the 'Date' header
|
||||
* instead of setting it (for performance reasons).
|
||||
*
|
||||
* @see #mSentDate
|
||||
* @param sentDate
|
||||
* @throws com.android.email.mail.MessagingException
|
||||
*/
|
||||
public void addSentDate(Date sentDate) throws MessagingException {
|
||||
if (mDateFormat == null) {
|
||||
mDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
|
||||
mDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
|
||||
}
|
||||
setHeader("Date", mDateFormat.format(sentDate));
|
||||
addHeader("Date", mDateFormat.format(sentDate));
|
||||
setInternalSentDate(sentDate);
|
||||
}
|
||||
|
||||
public void setSentDate(Date sentDate) throws MessagingException {
|
||||
removeHeader("Date");
|
||||
addSentDate(sentDate);
|
||||
}
|
||||
|
||||
public void setInternalSentDate(Date sentDate) throws MessagingException {
|
||||
this.mSentDate = sentDate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getContentType() throws MessagingException {
|
||||
String contentType = getFirstHeader(MimeHeader.HEADER_CONTENT_TYPE);
|
||||
if (contentType == null) {
|
||||
|
@ -897,7 +897,7 @@ public class LocalStore extends Store implements Serializable {
|
||||
if (from.length > 0) {
|
||||
message.setFrom(from[0]);
|
||||
}
|
||||
message.setInternalSentDate(new Date(cursor.getLong(2)));
|
||||
message.addSentDate(new Date(cursor.getLong(2)));
|
||||
message.setUid(cursor.getString(3));
|
||||
String flagList = cursor.getString(4);
|
||||
if (flagList != null && flagList.length() > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user