mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 13:19:52 +01:00
Made private group timestamp greater than that of latest message
This commit is contained in:
@@ -6,6 +6,7 @@ import org.briarproject.android.api.AndroidNotificationManager;
|
|||||||
import org.briarproject.android.controller.handler.ResultExceptionHandler;
|
import org.briarproject.android.controller.handler.ResultExceptionHandler;
|
||||||
import org.briarproject.android.privategroup.conversation.GroupController.GroupListener;
|
import org.briarproject.android.privategroup.conversation.GroupController.GroupListener;
|
||||||
import org.briarproject.android.threaded.ThreadListControllerImpl;
|
import org.briarproject.android.threaded.ThreadListControllerImpl;
|
||||||
|
import org.briarproject.api.clients.MessageTracker.GroupCount;
|
||||||
import org.briarproject.api.crypto.CryptoExecutor;
|
import org.briarproject.api.crypto.CryptoExecutor;
|
||||||
import org.briarproject.api.db.DatabaseExecutor;
|
import org.briarproject.api.db.DatabaseExecutor;
|
||||||
import org.briarproject.api.db.DbException;
|
import org.briarproject.api.db.DbException;
|
||||||
@@ -130,15 +131,10 @@ public class GroupControllerImpl extends
|
|||||||
MessageId parentId = null;
|
MessageId parentId = null;
|
||||||
MessageId previousMsgId =
|
MessageId previousMsgId =
|
||||||
privateGroupManager.getPreviousMsgId(getGroupId());
|
privateGroupManager.getPreviousMsgId(getGroupId());
|
||||||
// timestamp must be greater than the timestamps
|
GroupCount count =
|
||||||
// of the member's previous message...
|
privateGroupManager.getGroupCount(getGroupId());
|
||||||
long timestamp = privateGroupManager
|
long timestamp = count.getLatestMsgTime();
|
||||||
.getMessageTimestamp(previousMsgId);
|
if (parentItem != null) parentId = parentItem.getId();
|
||||||
// ...and the parent post, if any
|
|
||||||
if (parentItem != null) {
|
|
||||||
timestamp = max(parentItem.getTimestamp(), timestamp);
|
|
||||||
parentId = parentItem.getId();
|
|
||||||
}
|
|
||||||
timestamp = max(clock.currentTimeMillis(), timestamp + 1);
|
timestamp = max(clock.currentTimeMillis(), timestamp + 1);
|
||||||
createMessage(body, timestamp, parentId, author,
|
createMessage(body, timestamp, parentId, author,
|
||||||
previousMsgId, handler);
|
previousMsgId, handler);
|
||||||
|
|||||||
@@ -51,12 +51,6 @@ public interface PrivateGroupManager extends MessageTracker {
|
|||||||
*/
|
*/
|
||||||
MessageId getPreviousMsgId(GroupId g) throws DbException;
|
MessageId getPreviousMsgId(GroupId g) throws DbException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the timestamp of the message with the given ID
|
|
||||||
*/
|
|
||||||
// TODO change to getPreviousMessageHeader()
|
|
||||||
long getMessageTimestamp(MessageId id) throws DbException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks the group with GroupId g as resolved
|
* Marks the group with GroupId g as resolved
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -192,16 +192,6 @@ public class PrivateGroupManagerImpl extends BdfIncomingMessageHook implements
|
|||||||
txn.attach(e);
|
txn.attach(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMessageTimestamp(MessageId id) throws DbException {
|
|
||||||
try {
|
|
||||||
BdfDictionary d = clientHelper.getMessageMetadataAsDictionary(id);
|
|
||||||
return d.getLong(KEY_TIMESTAMP);
|
|
||||||
} catch (FormatException e) {
|
|
||||||
throw new DbException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GroupMessageHeader addLocalMessage(GroupMessage m)
|
public GroupMessageHeader addLocalMessage(GroupMessage m)
|
||||||
throws DbException {
|
throws DbException {
|
||||||
|
|||||||
Reference in New Issue
Block a user