mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +01:00
Don't use messaging group ID as proxy for contact ID.
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
package org.briarproject.messaging;
|
||||
|
||||
import org.briarproject.api.clients.ContactGroupFactory;
|
||||
import org.briarproject.api.clients.MessageTracker.GroupCount;
|
||||
import org.briarproject.api.contact.Contact;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.db.DatabaseComponent;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.Transaction;
|
||||
import org.briarproject.api.messaging.ConversationManager;
|
||||
import org.briarproject.api.sync.Group;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
@@ -19,14 +15,11 @@ import javax.inject.Inject;
|
||||
class ConversationManagerImpl implements ConversationManager {
|
||||
|
||||
private final DatabaseComponent db;
|
||||
private final ContactGroupFactory contactGroupFactory;
|
||||
private final Set<ConversationClient> clients;
|
||||
|
||||
@Inject
|
||||
ConversationManagerImpl(DatabaseComponent db,
|
||||
ContactGroupFactory contactGroupFactory) {
|
||||
ConversationManagerImpl(DatabaseComponent db) {
|
||||
this.db = db;
|
||||
this.contactGroupFactory = contactGroupFactory;
|
||||
clients = new CopyOnWriteArraySet<ConversationClient>();
|
||||
}
|
||||
|
||||
@@ -38,23 +31,6 @@ class ConversationManagerImpl implements ConversationManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupId getConversationId(ContactId contactId) throws DbException {
|
||||
// TODO we should probably transition this to its own group
|
||||
// and/or work with the ContactId in the UI instead
|
||||
Contact contact;
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
contact = db.getContact(txn, contactId);
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
Group group = contactGroupFactory
|
||||
.createContactGroup(MessagingManagerImpl.CLIENT_ID, contact);
|
||||
return group.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupCount getGroupCount(ContactId contactId)
|
||||
throws DbException {
|
||||
|
||||
Reference in New Issue
Block a user