mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 05:09:53 +01:00
Include legacy messages when recalculating group count.
This commit is contained in:
@@ -550,27 +550,22 @@ class MessagingManagerImpl implements MessagingManager, IncomingMessageHook,
|
|||||||
|
|
||||||
private void recalculateGroupCount(Transaction txn, GroupId g)
|
private void recalculateGroupCount(Transaction txn, GroupId g)
|
||||||
throws DbException {
|
throws DbException {
|
||||||
BdfDictionary query = BdfDictionary.of(
|
|
||||||
new BdfEntry(MSG_KEY_MSG_TYPE, PRIVATE_MESSAGE));
|
|
||||||
Map<MessageId, BdfDictionary> results;
|
|
||||||
try {
|
try {
|
||||||
results =
|
Map<MessageId, BdfDictionary> metadata =
|
||||||
clientHelper.getMessageMetadataAsDictionary(txn, g, query);
|
clientHelper.getMessageMetadataAsDictionary(txn, g);
|
||||||
|
int msgCount = 0;
|
||||||
|
int unreadCount = 0;
|
||||||
|
for (Entry<MessageId, BdfDictionary> entry : metadata.entrySet()) {
|
||||||
|
BdfDictionary meta = entry.getValue();
|
||||||
|
Long messageType = meta.getOptionalLong(MSG_KEY_MSG_TYPE);
|
||||||
|
if (messageType == null || messageType == PRIVATE_MESSAGE) {
|
||||||
|
msgCount++;
|
||||||
|
if (!meta.getBoolean(MSG_KEY_READ)) unreadCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
messageTracker.resetGroupCount(txn, g, msgCount, unreadCount);
|
||||||
} catch (FormatException e) {
|
} catch (FormatException e) {
|
||||||
throw new DbException(e);
|
throw new DbException(e);
|
||||||
}
|
}
|
||||||
int msgCount = results.size();
|
|
||||||
int unreadCount = 0;
|
|
||||||
for (Entry<MessageId, BdfDictionary> entry : results.entrySet()) {
|
|
||||||
BdfDictionary meta = entry.getValue();
|
|
||||||
boolean read;
|
|
||||||
try {
|
|
||||||
read = meta.getBoolean(MSG_KEY_READ);
|
|
||||||
} catch (FormatException e) {
|
|
||||||
throw new DbException(e);
|
|
||||||
}
|
|
||||||
if (!read) unreadCount++;
|
|
||||||
}
|
|
||||||
messageTracker.resetGroupCount(txn, g, msgCount, unreadCount);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user