1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 03:32:16 -05:00

Don't automatically create Message-ID when none is found

This commit is contained in:
cketti 2015-01-05 01:07:04 +01:00
parent d7085a2f07
commit 3eb25a011f
3 changed files with 9 additions and 7 deletions

View File

@ -308,13 +308,10 @@ public class MimeMessage extends Message {
if (mMessageId == null) {
mMessageId = getFirstHeader("Message-ID");
}
if (mMessageId == null) { // even after checking the header
setMessageId(generateMessageId());
}
return mMessageId;
}
private String generateMessageId() {
public void generateMessageId() throws MessagingException {
String hostname = null;
if (mFrom != null && mFrom.length >= 1) {
@ -330,7 +327,9 @@ public class MimeMessage extends Message {
}
/* We use upper case here to match Apple Mail Message-ID format (for privacy) */
return "<" + UUID.randomUUID().toString().toUpperCase(Locale.US) + "@" + hostname + ">";
String messageId = "<" + UUID.randomUUID().toString().toUpperCase(Locale.US) + "@" + hostname + ">";
setMessageId(messageId);
}
public void setMessageId(String messageId) throws MessagingException {

View File

@ -1338,6 +1338,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
private MimeMessage createMessage(boolean isDraft) throws MessagingException {
MimeMessage message = new MimeMessage();
message.addSentDate(new Date(), K9.hideTimeZone());
message.generateMessageId();
Address from = new Address(mIdentity.getEmail(), mIdentity.getName());
message.setFrom(from);
message.setRecipients(RecipientType.TO, getAddresses(mToView));

View File

@ -1179,6 +1179,10 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
}
private ThreadInfo getThreadInfo(SQLiteDatabase db, String messageId, boolean onlyEmpty) {
if (messageId == null) {
return null;
}
String sql = "SELECT t.id, t.message_id, t.root, t.parent " +
"FROM messages m " +
"LEFT JOIN threads t ON (t.message_id = m.id) " +
@ -1393,8 +1397,6 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
@Override
public Void doDbWork(final SQLiteDatabase db) throws WrappedException, UnavailableStorageException {
try {
message.buildMimeRepresentation();
ViewableContainer container =
LocalMessageExtractor.extractTextAndAttachments(LocalFolder.this.localStore.context, message);