mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +01:00
Do not require an entire Message for the MessageSharedEvent
This commit is contained in:
@@ -240,7 +240,7 @@ class ClientHelperImpl implements ClientHelper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMessageShared(Transaction txn, Message m, boolean shared)
|
||||
public void setMessageShared(Transaction txn, MessageId m, boolean shared)
|
||||
throws DbException {
|
||||
db.setMessageShared(txn, m, shared);
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
||||
transaction.attach(new MessageAddedEvent(m, null));
|
||||
transaction.attach(new MessageStateChangedEvent(m, c, true,
|
||||
DELIVERED));
|
||||
if (shared) transaction.attach(new MessageSharedEvent(m));
|
||||
if (shared) transaction.attach(new MessageSharedEvent(m.getId()));
|
||||
}
|
||||
db.mergeMessageMetadata(txn, m.getId(), meta);
|
||||
}
|
||||
@@ -704,13 +704,13 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
||||
transaction.attach(new ContactStatusChangedEvent(c, active));
|
||||
}
|
||||
|
||||
public void setMessageShared(Transaction transaction, Message m,
|
||||
public void setMessageShared(Transaction transaction, MessageId m,
|
||||
boolean shared) throws DbException {
|
||||
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
||||
T txn = unbox(transaction);
|
||||
if (!db.containsMessage(txn, m.getId()))
|
||||
if (!db.containsMessage(txn, m))
|
||||
throw new NoSuchMessageException();
|
||||
db.setMessageShared(txn, m.getId(), shared);
|
||||
db.setMessageShared(txn, m, shared);
|
||||
if (shared) transaction.attach(new MessageSharedEvent(m));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
|
||||
protected void incomingMessage(Transaction txn, Message m, BdfList body,
|
||||
BdfDictionary meta) throws DbException, FormatException {
|
||||
|
||||
clientHelper.setMessageShared(txn, m, true);
|
||||
clientHelper.setMessageShared(txn, m.getId(), true);
|
||||
|
||||
ForumPostHeader post = getForumPostHeader(txn, m.getId(), meta);
|
||||
ForumPostReceivedEvent event =
|
||||
|
||||
Reference in New Issue
Block a user