diff options
author | Andreas Straub <andy@strb.org> | 2015-07-21 13:51:15 +0200 |
---|---|---|
committer | Andreas Straub <andy@strb.org> | 2015-07-21 14:24:59 +0200 |
commit | 3c5c0c7d3b4ceaaca51b64ca91d2d1fcd76f9a66 (patch) | |
tree | cced0a1c53d0078df04463001388db502287d618 /src/main/java/eu/siacs | |
parent | 1aeb5874b042b7461e82dddbb34f70c5149a789f (diff) |
Fill own device sessions into SessionMap
Diffstat (limited to 'src/main/java/eu/siacs')
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java index fc1e13fd..a004599d 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java @@ -662,21 +662,28 @@ public class AxolotlService { 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) { + List<Integer> deviceIds = store.getSubDeviceSessions(account.getJid().toBareJid().toString()); + putDevicesForJid(account.getJid().toBareJid().toString(), deviceIds, store); for (Contact contact : account.getRoster().getContacts()) { Jid bareJid = contact.getJid().toBareJid(); if (bareJid == null) { continue; // FIXME: handle this? } String address = bareJid.toString(); - List<Integer> deviceIDs = store.getSubDeviceSessions(address); - for (Integer deviceId : deviceIDs) { - 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)); - } + deviceIds = store.getSubDeviceSessions(address); + putDevicesForJid(address, deviceIds, store); } + } @Override |