Keep order of labels

This commit is contained in:
Christian Basler 2017-03-30 16:31:36 +02:00
parent 3ab3d7a0ca
commit 5849e68d20
2 changed files with 6 additions and 6 deletions

View File

@ -543,7 +543,7 @@ public class Plaintext implements Streamable {
private long sent; private long sent;
private Long received; private Long received;
private Status status; private Status status;
private Set<Label> labels = new HashSet<>(); private Set<Label> labels = new LinkedHashSet<>();
private long ttl; private long ttl;
private int retries; private int retries;
private Long nextTry; private Long nextTry;

View File

@ -205,11 +205,11 @@ public class JdbcMessageRepository extends AbstractMessageRepository implements
byte[] childIV = message.getInventoryVector().getHash(); byte[] childIV = message.getInventoryVector().getHash();
// save new parents // save new parents
int order = 0; int order = 0;
for (InventoryVector parentIV : message.getParents()) { try (PreparedStatement ps = connection.prepareStatement("INSERT INTO Message_Parent VALUES (?, ?, ?, ?)")) {
Plaintext parent = getMessage(parentIV); for (InventoryVector parentIV : message.getParents()) {
mergeConversations(connection, parent.getConversationId(), message.getConversationId()); Plaintext parent = getMessage(parentIV);
order++; mergeConversations(connection, parent.getConversationId(), message.getConversationId());
try (PreparedStatement ps = connection.prepareStatement("INSERT INTO Message_Parent VALUES (?, ?, ?, ?)")) { order++;
ps.setBytes(1, parentIV.getHash()); ps.setBytes(1, parentIV.getHash());
ps.setBytes(2, childIV); ps.setBytes(2, childIV);
ps.setInt(3, order); // FIXME: this might not be necessary ps.setInt(3, order); // FIXME: this might not be necessary