1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-25 15:52:06 +01:00

Add setting to enable IoT Managers automatically

or not. Since they interfer a lot with existing code (presence
management etc.)
This commit is contained in:
Florian Schmaus 2016-12-19 18:09:03 +01:00
parent 8511a9e67b
commit 26b16665e5
4 changed files with 15 additions and 0 deletions

View file

@ -34,6 +34,16 @@ public abstract class IoTManager extends Manager {
private boolean allowNonFriends;
private static boolean autoEnable;
public static void setAutoEnableIoTManagers(boolean autoEnable) {
IoTManager.autoEnable = autoEnable;
}
public static boolean isAutoEnableActive() {
return autoEnable;
}
protected IoTManager(XMPPConnection connection) {
super(connection);

View file

@ -62,6 +62,7 @@ public final class IoTDataManager extends IoTManager {
static {
XMPPConnectionRegistry.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
if (!isAutoEnableActive()) return;
getInstanceFor(connection);
}
});

View file

@ -39,6 +39,7 @@ import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
import org.jivesoftware.smackx.iot.IoTManager;
import org.jivesoftware.smackx.iot.Thing;
import org.jivesoftware.smackx.iot.control.IoTControlManager;
import org.jivesoftware.smackx.iot.data.IoTDataManager;
@ -74,6 +75,7 @@ public final class IoTDiscoveryManager extends Manager {
static {
XMPPConnectionRegistry.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
if (!IoTManager.isAutoEnableActive()) return;
getInstanceFor(connection);
}
});

View file

@ -49,6 +49,7 @@ import org.jivesoftware.smack.roster.RosterEntry;
import org.jivesoftware.smack.roster.SubscribeListener;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
import org.jivesoftware.smackx.iot.IoTManager;
import org.jivesoftware.smackx.iot.discovery.IoTDiscoveryManager;
import org.jivesoftware.smackx.iot.provisioning.element.ClearCache;
import org.jivesoftware.smackx.iot.provisioning.element.ClearCacheResponse;
@ -83,6 +84,7 @@ public final class IoTProvisioningManager extends Manager {
static {
XMPPConnectionRegistry.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(XMPPConnection connection) {
if (!IoTManager.isAutoEnableActive()) return;
getInstanceFor(connection);
}
});