mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-24 03:27:59 +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:
parent
8511a9e67b
commit
26b16665e5
4 changed files with 15 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue