Fill own device sessions into SessionMap
This commit is contained in:
parent
1aeb5874b0
commit
3c5c0c7d3b
|
@ -662,21 +662,28 @@ public class AxolotlService {
|
||||||
this.fillMap(store);
|
this.fillMap(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void putDevicesForJid(String bareJid, List<Integer> deviceIds, SQLiteAxolotlStore store) {
|
||||||
|
for (Integer deviceId : deviceIds) {
|
||||||
|
AxolotlAddress axolotlAddress = new AxolotlAddress(bareJid, deviceId);
|
||||||
|
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account)+"Building session for remote address: "+axolotlAddress.toString());
|
||||||
|
String fingerprint = store.loadSession(axolotlAddress).getSessionState().getRemoteIdentityKey().getFingerprint().replaceAll("\\s", "");
|
||||||
|
this.put(axolotlAddress, new XmppAxolotlSession(account, store, axolotlAddress, fingerprint));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void fillMap(SQLiteAxolotlStore store) {
|
private void fillMap(SQLiteAxolotlStore store) {
|
||||||
|
List<Integer> deviceIds = store.getSubDeviceSessions(account.getJid().toBareJid().toString());
|
||||||
|
putDevicesForJid(account.getJid().toBareJid().toString(), deviceIds, store);
|
||||||
for (Contact contact : account.getRoster().getContacts()) {
|
for (Contact contact : account.getRoster().getContacts()) {
|
||||||
Jid bareJid = contact.getJid().toBareJid();
|
Jid bareJid = contact.getJid().toBareJid();
|
||||||
if (bareJid == null) {
|
if (bareJid == null) {
|
||||||
continue; // FIXME: handle this?
|
continue; // FIXME: handle this?
|
||||||
}
|
}
|
||||||
String address = bareJid.toString();
|
String address = bareJid.toString();
|
||||||
List<Integer> deviceIDs = store.getSubDeviceSessions(address);
|
deviceIds = store.getSubDeviceSessions(address);
|
||||||
for (Integer deviceId : deviceIDs) {
|
putDevicesForJid(address, deviceIds, store);
|
||||||
AxolotlAddress axolotlAddress = new AxolotlAddress(address, deviceId);
|
|
||||||
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account)+"Building session for remote address: "+axolotlAddress.toString());
|
|
||||||
String fingerprint = store.loadSession(axolotlAddress).getSessionState().getRemoteIdentityKey().getFingerprint().replaceAll("\\s", "");
|
|
||||||
this.put(axolotlAddress, new XmppAxolotlSession(account, store, axolotlAddress, fingerprint));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue