Fix error handling for announce check retrieval

Only aborts when a timeout was received. Error conditions (most notably
item-not-found) are interpreted as no other devices existing.
This commit is contained in:
Andreas Straub 2015-08-26 20:51:18 +02:00
parent cd451856b2
commit 1156ccbce2

View file

@ -323,14 +323,14 @@ public class AxolotlService {
mXmppConnectionService.sendIqPacket(account, packet, new OnIqPacketReceived() { mXmppConnectionService.sendIqPacket(account, packet, new OnIqPacketReceived() {
@Override @Override
public void onIqPacketReceived(Account account, IqPacket packet) { public void onIqPacketReceived(Account account, IqPacket packet) {
if (packet.getType() == IqPacket.TYPE.RESULT) { if (packet.getType() == IqPacket.TYPE.TIMEOUT) {
Log.d(Config.LOGTAG, getLogprefix(account) + "Timeout received while retrieving own Device Ids.");
} else {
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.contains(getOwnDeviceId())) { if (!deviceIds.contains(getOwnDeviceId())) {
publishOwnDeviceId(deviceIds); publishOwnDeviceId(deviceIds);
} }
} else {
Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while retrieving Device Ids" + packet.findChild("error"));
} }
} }
}); });