Let clients decide whether to share messages or not

This commit is contained in:
Torsten Grote
2016-08-11 12:19:10 -03:00
parent 9defb099dd
commit 71196e3494
7 changed files with 17 additions and 11 deletions

View File

@@ -162,6 +162,8 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
protected void incomingMessage(Transaction txn, Message m, BdfList list,
BdfDictionary meta) throws DbException, FormatException {
clientHelper.setMessageShared(txn, m, true);
GroupId groupId = m.getGroupId();
BlogPostHeader h = getPostHeaderFromMetadata(txn, m.getId(), meta);
BlogPostAddedEvent event =

View File

@@ -239,6 +239,12 @@ class ClientHelperImpl implements ClientHelper {
db.mergeMessageMetadata(txn, m, metadataEncoder.encode(metadata));
}
@Override
public void setMessageShared(Transaction txn, Message m, boolean shared)
throws DbException {
db.setMessageShared(txn, m, shared);
}
@Override
public byte[] toByteArray(BdfDictionary dictionary) throws FormatException {
ByteArrayOutputStream out = new ByteArrayOutputStream();

View File

@@ -78,6 +78,8 @@ 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);
ForumPostHeader post = getForumPostHeader(txn, m.getId(), meta);
ForumPostReceivedEvent event =
new ForumPostReceivedEvent(post, m.getGroupId());

View File

@@ -358,8 +358,6 @@ class ValidationManagerImpl implements ValidationManager, Service,
throw new InvalidMessageException(
"Deleted by Client");
}
db.setMessageShared(txn, m, true);
db.setMessageState(txn, m, c, DELIVERED);
// deliver pending dependents