mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-21 07:09:56 +01:00
Replace some more longs with ints.
This commit is contained in:
@@ -76,7 +76,7 @@ class AvatarValidator implements MessageValidator {
|
|||||||
// 0.0: Message Type, Version, Content-Type
|
// 0.0: Message Type, Version, Content-Type
|
||||||
checkSize(body, 3);
|
checkSize(body, 3);
|
||||||
// Message Type
|
// Message Type
|
||||||
long messageType = body.getInt(0);
|
int messageType = body.getInt(0);
|
||||||
if (messageType != MSG_TYPE_UPDATE) throw new FormatException();
|
if (messageType != MSG_TYPE_UPDATE) throw new FormatException();
|
||||||
// Version
|
// Version
|
||||||
long version = body.getLong(1);
|
long version = body.getLong(1);
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ class MessagingManagerImpl implements MessagingManager, IncomingMessageHook,
|
|||||||
try {
|
try {
|
||||||
BdfDictionary metaDict = metadataParser.parse(meta);
|
BdfDictionary metaDict = metadataParser.parse(meta);
|
||||||
// Message type is null for version 0.0 private messages
|
// Message type is null for version 0.0 private messages
|
||||||
Long messageType = metaDict.getOptionalLong(MSG_KEY_MSG_TYPE);
|
Integer messageType = metaDict.getOptionalInt(MSG_KEY_MSG_TYPE);
|
||||||
if (messageType == null) {
|
if (messageType == null) {
|
||||||
incomingPrivateMessage(txn, m, metaDict, true, emptyList());
|
incomingPrivateMessage(txn, m, metaDict, true, emptyList());
|
||||||
} else if (messageType == PRIVATE_MESSAGE) {
|
} else if (messageType == PRIVATE_MESSAGE) {
|
||||||
@@ -419,7 +419,7 @@ class MessagingManagerImpl implements MessagingManager, IncomingMessageHook,
|
|||||||
if (meta == null) continue;
|
if (meta == null) continue;
|
||||||
try {
|
try {
|
||||||
// Message type is null for version 0.0 private messages
|
// Message type is null for version 0.0 private messages
|
||||||
Long messageType = meta.getOptionalLong(MSG_KEY_MSG_TYPE);
|
Integer messageType = meta.getOptionalInt(MSG_KEY_MSG_TYPE);
|
||||||
if (messageType != null && messageType != PRIVATE_MESSAGE)
|
if (messageType != null && messageType != PRIVATE_MESSAGE)
|
||||||
continue;
|
continue;
|
||||||
long timestamp = meta.getLong(MSG_KEY_TIMESTAMP);
|
long timestamp = meta.getLong(MSG_KEY_TIMESTAMP);
|
||||||
@@ -453,7 +453,8 @@ class MessagingManagerImpl implements MessagingManager, IncomingMessageHook,
|
|||||||
Map<MessageId, BdfDictionary> messages =
|
Map<MessageId, BdfDictionary> messages =
|
||||||
clientHelper.getMessageMetadataAsDictionary(txn, g);
|
clientHelper.getMessageMetadataAsDictionary(txn, g);
|
||||||
for (Entry<MessageId, BdfDictionary> entry : messages.entrySet()) {
|
for (Entry<MessageId, BdfDictionary> entry : messages.entrySet()) {
|
||||||
Long type = entry.getValue().getOptionalLong(MSG_KEY_MSG_TYPE);
|
Integer type =
|
||||||
|
entry.getValue().getOptionalInt(MSG_KEY_MSG_TYPE);
|
||||||
if (type == null || type == PRIVATE_MESSAGE)
|
if (type == null || type == PRIVATE_MESSAGE)
|
||||||
result.add(entry.getKey());
|
result.add(entry.getKey());
|
||||||
}
|
}
|
||||||
@@ -527,7 +528,7 @@ class MessagingManagerImpl implements MessagingManager, IncomingMessageHook,
|
|||||||
try {
|
try {
|
||||||
BdfDictionary meta =
|
BdfDictionary meta =
|
||||||
clientHelper.getMessageMetadataAsDictionary(txn, m);
|
clientHelper.getMessageMetadataAsDictionary(txn, m);
|
||||||
Long messageType = meta.getOptionalLong(MSG_KEY_MSG_TYPE);
|
Integer messageType = meta.getOptionalInt(MSG_KEY_MSG_TYPE);
|
||||||
if (messageType != null && messageType == PRIVATE_MESSAGE) {
|
if (messageType != null && messageType == PRIVATE_MESSAGE) {
|
||||||
for (AttachmentHeader h : parseAttachmentHeaders(g, meta)) {
|
for (AttachmentHeader h : parseAttachmentHeaders(g, meta)) {
|
||||||
try {
|
try {
|
||||||
@@ -554,7 +555,7 @@ class MessagingManagerImpl implements MessagingManager, IncomingMessageHook,
|
|||||||
int unreadCount = 0;
|
int unreadCount = 0;
|
||||||
for (Entry<MessageId, BdfDictionary> entry : metadata.entrySet()) {
|
for (Entry<MessageId, BdfDictionary> entry : metadata.entrySet()) {
|
||||||
BdfDictionary meta = entry.getValue();
|
BdfDictionary meta = entry.getValue();
|
||||||
Long messageType = meta.getOptionalLong(MSG_KEY_MSG_TYPE);
|
Integer messageType = meta.getOptionalInt(MSG_KEY_MSG_TYPE);
|
||||||
if (messageType == null || messageType == PRIVATE_MESSAGE) {
|
if (messageType == null || messageType == PRIVATE_MESSAGE) {
|
||||||
msgCount++;
|
msgCount++;
|
||||||
if (!meta.getBoolean(MSG_KEY_READ)) unreadCount++;
|
if (!meta.getBoolean(MSG_KEY_READ)) unreadCount++;
|
||||||
|
|||||||
Reference in New Issue
Block a user