disable removing of broken devices by default

This commit is contained in:
Daniel Gultsch 2016-12-18 11:49:27 +01:00
parent dbda2afd6d
commit fbbf1a37b4
2 changed files with 14 additions and 10 deletions

View file

@ -81,6 +81,8 @@ public final class Config {
public static final long MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000; public static final long MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000;
public static final long OMEMO_AUTO_EXPIRY = 7 * MILLISECONDS_IN_DAY; public static final long OMEMO_AUTO_EXPIRY = 7 * MILLISECONDS_IN_DAY;
public static final boolean REMOVE_BROKEN_DEVICES = false;
public static final boolean DISABLE_PROXY_LOOKUP = false; //useful to debug ibb public static final boolean DISABLE_PROXY_LOOKUP = false; //useful to debug ibb
public static final boolean DISABLE_HTTP_UPLOAD = false; public static final boolean DISABLE_HTTP_UPLOAD = false;

View file

@ -804,17 +804,19 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
} }
mXmppConnectionService.keyStatusUpdated(report); mXmppConnectionService.keyStatusUpdated(report);
} }
Set<Integer> ownDeviceIds = new HashSet<>(getOwnDeviceIds()); if (Config.REMOVE_BROKEN_DEVICES) {
boolean publish = false; Set<Integer> ownDeviceIds = new HashSet<>(getOwnDeviceIds());
for(Map.Entry<Integer,FetchStatus> entry : own.entrySet()) { boolean publish = false;
int id = entry.getKey(); for (Map.Entry<Integer, FetchStatus> entry : own.entrySet()) {
if (entry.getValue() == FetchStatus.ERROR && PREVIOUSLY_REMOVED_FROM_ANNOUNCEMENT.add(id) && ownDeviceIds.remove(id)) { int id = entry.getKey();
publish = true; if (entry.getValue() == FetchStatus.ERROR && PREVIOUSLY_REMOVED_FROM_ANNOUNCEMENT.add(id) && ownDeviceIds.remove(id)) {
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": error fetching own device with id "+id+". removing from announcement"); publish = true;
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": error fetching own device with id " + id + ". removing from announcement");
}
}
if (publish) {
publishOwnDeviceId(ownDeviceIds);
} }
}
if (publish) {
publishOwnDeviceId(ownDeviceIds);
} }
} }