Skip to content

Commit

Permalink
Adding four random bytes to mail message IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
marigostra committed Jan 12, 2023
1 parent 5b1dcce commit af43982
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main/java/org/luwrain/pim/mail/nitrite/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.luwrain.pim.mail.nitrite;

import java.util.*;

import org.luwrain.core.*;
import org.luwrain.pim.mail.*;
import org.luwrain.util.*;
Expand All @@ -31,6 +33,6 @@ void genId()
final byte[] bytes = getRawMessage();
if (bytes.length == 0)
throw new IllegalStateException("the raw message can't be empty on ID generation");
this.id = new Sha1().getSha1(bytes);
this.id = new Sha1().getSha1(bytes) + "-" + UUID.randomUUID().toString().substring(0, 8);
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/luwrain/pim/mail/protocols/Pop3.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void processAccount(MailAccount account) throws IOException, PimExceptio
}
final MessageObj hookObj = new MessageObj(message);
try {
Log.debug(LOG_COMPONENT, "saving the message " + num + "/" + total + " from " + message.getFrom());
Log.debug(LOG_COMPONENT, "saving the message " + (num + 1) + "/" + total + " from " + message.getFrom());
return chainOfResponsibility(luwrain, HOOK_SAVE, new Object[]{mailHookObj, hookObj});
}
catch(Throwable e)
Expand Down

0 comments on commit af43982

Please sign in to comment.