aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Straub <andy@strb.org>2015-07-22 15:02:53 +0200
committerAndreas Straub <andy@strb.org>2015-07-22 15:03:52 +0200
commitdb05d264334b548ce2f307d614e39aabd775bb4f (patch)
tree84c0429dd9bd04c85bd02681e2310977f8a4ffe5 /src
parent9c1c86ed444cfa860b6e958849dd6a55b9a16a04 (diff)
Always build own device session automatically
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java19
1 files changed, 13 insertions, 6 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 c30a7ab8..c6f74538 100644
--- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java
+++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java
@@ -803,8 +803,16 @@ public class AxolotlService {
}
public void registerDevices(final Jid jid, @NonNull final Set<Integer> deviceIds) {
- if(deviceIds.contains(getOwnDeviceId())) {
- deviceIds.remove(getOwnDeviceId());
+ if(jid.toBareJid().equals(account.getJid().toBareJid())) {
+ if (deviceIds.contains(getOwnDeviceId())) {
+ deviceIds.remove(getOwnDeviceId());
+ }
+ for(Integer deviceId : deviceIds) {
+ AxolotlAddress ownDeviceAddress = new AxolotlAddress(jid.toBareJid().toString(),deviceId);
+ if(sessions.get(ownDeviceAddress) == null) {
+ buildSessionFromPEP(null, ownDeviceAddress, false);
+ }
+ }
}
Set<Integer> expiredDevices = new HashSet<>(axolotlStore.getSubDeviceSessions(jid.toBareJid().toString()));
expiredDevices.removeAll(deviceIds);
@@ -976,11 +984,10 @@ public class AxolotlService {
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account)+"Retrieving bundle: " + bundlesPacket);
mXmppConnectionService.sendIqPacket(account, bundlesPacket, new OnIqPacketReceived() {
private void finish() {
- AxolotlAddress ownAddress = new AxolotlAddress(conversation.getAccount().getJid().toBareJid().toString(),0);
- AxolotlAddress foreignAddress = new AxolotlAddress(conversation.getJid().toBareJid().toString(),0);
+ AxolotlAddress ownAddress = new AxolotlAddress(account.getJid().toBareJid().toString(),0);
if (!fetchStatusMap.getAll(ownAddress).containsValue(FetchStatus.PENDING)
- && !fetchStatusMap.getAll(foreignAddress).containsValue(FetchStatus.PENDING)) {
- if (flushWaitingQueueAfterFetch) {
+ && !fetchStatusMap.getAll(address).containsValue(FetchStatus.PENDING)) {
+ if (flushWaitingQueueAfterFetch && conversation != null) {
conversation.findUnsentMessagesWithEncryption(Message.ENCRYPTION_AXOLOTL,
new Conversation.OnMessageFound() {
@Override