2019-11-18 23:51:27 +01:00
|
|
|
package org.mercury_im.messenger;
|
2019-11-08 00:47:17 +01:00
|
|
|
|
2019-12-02 02:31:32 +01:00
|
|
|
import org.mercury_im.messenger.data.repository.AccountRepository;
|
|
|
|
import org.mercury_im.messenger.data.repository.PeerRepository;
|
|
|
|
import org.mercury_im.messenger.entity.contact.Peer;
|
2019-11-18 23:51:27 +01:00
|
|
|
import org.mercury_im.messenger.transport.connection.ConnectionMethod;
|
|
|
|
import org.mercury_im.messenger.entity.Account;
|
2019-11-12 00:07:57 +01:00
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
|
2019-12-02 02:31:32 +01:00
|
|
|
import javax.inject.Inject;
|
|
|
|
|
2019-11-08 00:47:17 +01:00
|
|
|
public class Messenger {
|
2019-11-12 00:07:57 +01:00
|
|
|
|
|
|
|
private final Map<Long, ConnectionMethod> connections = new HashMap<>();
|
|
|
|
|
2019-12-02 02:31:32 +01:00
|
|
|
@Inject
|
|
|
|
AccountRepository accountRepository;
|
|
|
|
|
|
|
|
@Inject
|
|
|
|
PeerRepository peerRepository;
|
|
|
|
|
|
|
|
@Inject
|
|
|
|
public Messenger() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-11-12 00:07:57 +01:00
|
|
|
public void addConnection(ConnectionMethod connection) {
|
|
|
|
connections.put(connection.getAccount().getId(), connection);
|
|
|
|
}
|
|
|
|
|
2019-11-18 00:04:28 +01:00
|
|
|
public ConnectionMethod getConnection(Account account) {
|
|
|
|
return connections.get(account.getId());
|
|
|
|
}
|
2019-11-08 00:47:17 +01:00
|
|
|
}
|