mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
Upgrade messaging client to support attachments.
This commit is contained in:
@@ -85,15 +85,21 @@ class ClientHelperImpl implements ClientHelper {
|
||||
@Override
|
||||
public void addLocalMessage(Message m, BdfDictionary metadata,
|
||||
boolean shared) throws DbException, FormatException {
|
||||
db.transaction(false, txn -> addLocalMessage(txn, m, metadata, shared));
|
||||
db.transaction(false, txn -> addLocalMessage(txn, m, metadata, shared,
|
||||
false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLocalMessage(Transaction txn, Message m,
|
||||
BdfDictionary metadata, boolean shared)
|
||||
BdfDictionary metadata, boolean shared, boolean temporary)
|
||||
throws DbException, FormatException {
|
||||
db.addLocalMessage(txn, m, metadataEncoder.encode(metadata), shared,
|
||||
false);
|
||||
temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message createMessage(GroupId g, long timestamp, byte[] body) {
|
||||
return messageFactory.createMessage(g, timestamp, body);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -284,7 +284,7 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
|
||||
meta.put("transportId", t.getString());
|
||||
meta.put("version", version);
|
||||
meta.put("local", local);
|
||||
clientHelper.addLocalMessage(txn, m, meta, shared);
|
||||
clientHelper.addLocalMessage(txn, m, meta, shared, false);
|
||||
} catch (FormatException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -314,6 +314,7 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
||||
try {
|
||||
shareMsg = hook.incomingMessage(txn, m, meta);
|
||||
} catch (InvalidMessageException e) {
|
||||
logException(LOG, INFO, e);
|
||||
invalidateMessage(txn, m.getId());
|
||||
return new DeliveryResult(false, false);
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ class ClientVersioningManagerImpl implements ClientVersioningManager,
|
||||
BdfDictionary meta = new BdfDictionary();
|
||||
meta.put(MSG_KEY_UPDATE_VERSION, updateVersion);
|
||||
meta.put(MSG_KEY_LOCAL, true);
|
||||
clientHelper.addLocalMessage(txn, m, meta, true);
|
||||
clientHelper.addLocalMessage(txn, m, meta, true, false);
|
||||
} catch (FormatException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -637,7 +637,8 @@ public class TransportPropertyManagerImplTest extends BrambleMockTestCase {
|
||||
will(returnValue(timestamp));
|
||||
oneOf(clientHelper).createMessage(g, timestamp, body);
|
||||
will(returnValue(message));
|
||||
oneOf(clientHelper).addLocalMessage(txn, message, meta, shared);
|
||||
oneOf(clientHelper).addLocalMessage(txn, message, meta, shared,
|
||||
false);
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ClientVersioningManagerImplTest extends BrambleMockTestCase {
|
||||
localUpdateBody);
|
||||
will(returnValue(localUpdate));
|
||||
oneOf(clientHelper).addLocalMessage(txn, localUpdate,
|
||||
localUpdateMeta, true);
|
||||
localUpdateMeta, true, false);
|
||||
}});
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ public class ClientVersioningManagerImplTest extends BrambleMockTestCase {
|
||||
newLocalUpdateBody);
|
||||
will(returnValue(newLocalUpdate));
|
||||
oneOf(clientHelper).addLocalMessage(txn, newLocalUpdate,
|
||||
newLocalUpdateMeta, true);
|
||||
newLocalUpdateMeta, true, false);
|
||||
// No visibilities have changed
|
||||
}});
|
||||
|
||||
@@ -382,7 +382,7 @@ public class ClientVersioningManagerImplTest extends BrambleMockTestCase {
|
||||
newLocalUpdateBody);
|
||||
will(returnValue(newLocalUpdate));
|
||||
oneOf(clientHelper).addLocalMessage(txn, newLocalUpdate,
|
||||
newLocalUpdateMeta, true);
|
||||
newLocalUpdateMeta, true, false);
|
||||
// The client's visibility has changed
|
||||
oneOf(hook).onClientVisibilityChanging(txn, contact, visibility);
|
||||
}});
|
||||
@@ -567,7 +567,7 @@ public class ClientVersioningManagerImplTest extends BrambleMockTestCase {
|
||||
newLocalUpdateBody);
|
||||
will(returnValue(newLocalUpdate));
|
||||
oneOf(clientHelper).addLocalMessage(txn, newLocalUpdate,
|
||||
newLocalUpdateMeta, true);
|
||||
newLocalUpdateMeta, true, false);
|
||||
// The client's visibility has changed
|
||||
oneOf(clientHelper).getGroupMetadataAsDictionary(txn,
|
||||
contactGroup.getId());
|
||||
@@ -640,7 +640,7 @@ public class ClientVersioningManagerImplTest extends BrambleMockTestCase {
|
||||
newLocalUpdateBody);
|
||||
will(returnValue(newLocalUpdate));
|
||||
oneOf(clientHelper).addLocalMessage(txn, newLocalUpdate,
|
||||
newLocalUpdateMeta, true);
|
||||
newLocalUpdateMeta, true, false);
|
||||
// The client's visibility has changed
|
||||
oneOf(clientHelper).getGroupMetadataAsDictionary(txn,
|
||||
contactGroup.getId());
|
||||
|
||||
Reference in New Issue
Block a user