Pass through device IDs when updating own list
This commit is contained in:
parent
5eae1e52d2
commit
b84fecf51a
|
@ -257,6 +257,8 @@ public class AxolotlService {
|
||||||
if (jid.toBareJid().equals(account.getJid().toBareJid())) {
|
if (jid.toBareJid().equals(account.getJid().toBareJid())) {
|
||||||
if (deviceIds.contains(getOwnDeviceId())) {
|
if (deviceIds.contains(getOwnDeviceId())) {
|
||||||
deviceIds.remove(getOwnDeviceId());
|
deviceIds.remove(getOwnDeviceId());
|
||||||
|
} else {
|
||||||
|
publishOwnDeviceId(deviceIds);
|
||||||
}
|
}
|
||||||
for (Integer deviceId : deviceIds) {
|
for (Integer deviceId : deviceIds) {
|
||||||
AxolotlAddress ownDeviceAddress = new AxolotlAddress(jid.toBareJid().toString(), deviceId);
|
AxolotlAddress ownDeviceAddress = new AxolotlAddress(jid.toBareJid().toString(), deviceId);
|
||||||
|
@ -282,9 +284,6 @@ public class AxolotlService {
|
||||||
XmppAxolotlSession.Trust.UNTRUSTED);
|
XmppAxolotlSession.Trust.UNTRUSTED);
|
||||||
this.deviceIds.put(jid, deviceIds);
|
this.deviceIds.put(jid, deviceIds);
|
||||||
mXmppConnectionService.keyStatusUpdated();
|
mXmppConnectionService.keyStatusUpdated();
|
||||||
if (account.getJid().toBareJid().equals(jid.toBareJid())) {
|
|
||||||
publishOwnDeviceIdIfNeeded();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void wipeOtherPepDevices() {
|
public void wipeOtherPepDevices() {
|
||||||
|
@ -312,10 +311,17 @@ public class AxolotlService {
|
||||||
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
||||||
Element item = mXmppConnectionService.getIqParser().getItem(packet);
|
Element item = mXmppConnectionService.getIqParser().getItem(packet);
|
||||||
Set<Integer> deviceIds = mXmppConnectionService.getIqParser().deviceIds(item);
|
Set<Integer> deviceIds = mXmppConnectionService.getIqParser().deviceIds(item);
|
||||||
if (deviceIds == null) {
|
|
||||||
deviceIds = new HashSet<Integer>();
|
|
||||||
}
|
|
||||||
if (!deviceIds.contains(getOwnDeviceId())) {
|
if (!deviceIds.contains(getOwnDeviceId())) {
|
||||||
|
publishOwnDeviceId(deviceIds);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while retrieving Device Ids" + packet.findChild("error"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void publishOwnDeviceId(Set<Integer> deviceIds) {
|
||||||
deviceIds.add(getOwnDeviceId());
|
deviceIds.add(getOwnDeviceId());
|
||||||
IqPacket publish = mXmppConnectionService.getIqGenerator().publishDeviceIds(deviceIds);
|
IqPacket publish = mXmppConnectionService.getIqGenerator().publishDeviceIds(deviceIds);
|
||||||
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Own device " + getOwnDeviceId() + " not in PEP devicelist. Publishing: " + publish);
|
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Own device " + getOwnDeviceId() + " not in PEP devicelist. Publishing: " + publish);
|
||||||
|
@ -328,12 +334,6 @@ public class AxolotlService {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while retrieving Device Ids" + packet.findChild("error"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void publishBundlesIfNeeded() {
|
public void publishBundlesIfNeeded() {
|
||||||
IqPacket packet = mXmppConnectionService.getIqGenerator().retrieveBundlesForDevice(account.getJid().toBareJid(), getOwnDeviceId());
|
IqPacket packet = mXmppConnectionService.getIqGenerator().retrieveBundlesForDevice(account.getJid().toBareJid(), getOwnDeviceId());
|
||||||
|
|
Loading…
Reference in a new issue