From e9728c689d6dcc917b07662bd840bbf7ccf0a335 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sun, 25 Dec 2016 18:36:03 +0100 Subject: disable removing of broken devices by default --- src/main/java/de/pixart/messenger/Config.java | 1 + .../messenger/crypto/axolotl/AxolotlService.java | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src/main/java/de/pixart/messenger') diff --git a/src/main/java/de/pixart/messenger/Config.java b/src/main/java/de/pixart/messenger/Config.java index 5deba889b..42d642142 100644 --- a/src/main/java/de/pixart/messenger/Config.java +++ b/src/main/java/de/pixart/messenger/Config.java @@ -91,6 +91,7 @@ public final class Config { public static final int REFRESH_UI_INTERVAL = 1000; public static final long OMEMO_AUTO_EXPIRY = 7 * MILLISECONDS_IN_DAY; // delete old OMEMO devices after 7 days od inactivity + public static final boolean REMOVE_BROKEN_DEVICES = false; public static final int MAX_DISPLAY_MESSAGE_CHARS = 4096; diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java index a80f625f4..bedc0970a 100644 --- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java +++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java @@ -800,17 +800,19 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { } mXmppConnectionService.keyStatusUpdated(report); } - Set ownDeviceIds = new HashSet<>(getOwnDeviceIds()); - boolean publish = false; - for(Map.Entry entry : own.entrySet()) { - int id = entry.getKey(); - if (entry.getValue() == FetchStatus.ERROR && PREVIOUSLY_REMOVED_FROM_ANNOUNCEMENT.add(id) && ownDeviceIds.remove(id)) { - publish = true; - Log.d(Config.LOGTAG,account.getJid().toBareJid()+": error fetching own device with id "+id+". removing from announcement"); + if (Config.REMOVE_BROKEN_DEVICES) { + Set ownDeviceIds = new HashSet<>(getOwnDeviceIds()); + boolean publish = false; + for (Map.Entry entry : own.entrySet()) { + int id = entry.getKey(); + if (entry.getValue() == FetchStatus.ERROR && PREVIOUSLY_REMOVED_FROM_ANNOUNCEMENT.add(id) && ownDeviceIds.remove(id)) { + 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); } } -- cgit v1.2.3