diff --git a/source/org/jivesoftware/smackx/ServiceDiscoveryManager.java b/source/org/jivesoftware/smackx/ServiceDiscoveryManager.java index 566294837..688f9a3a6 100644 --- a/source/org/jivesoftware/smackx/ServiceDiscoveryManager.java +++ b/source/org/jivesoftware/smackx/ServiceDiscoveryManager.java @@ -53,9 +53,11 @@ public class ServiceDiscoveryManager { private static final String DEFAULT_IDENTITY_NAME = "Smack"; private static final String DEFAULT_IDENTITY_CATEGORY = "client"; private static final String DEFAULT_IDENTITY_TYPE = "pc"; + private static DiscoverInfo.Identity defaultIdentity = new Identity(DEFAULT_IDENTITY_CATEGORY, + DEFAULT_IDENTITY_NAME, DEFAULT_IDENTITY_TYPE); private Set identities = new HashSet(); - private DiscoverInfo.Identity identity = new Identity(DEFAULT_IDENTITY_CATEGORY, DEFAULT_IDENTITY_NAME, DEFAULT_IDENTITY_TYPE); + private DiscoverInfo.Identity identity = defaultIdentity; private EntityCapsManager capsManager; @@ -77,6 +79,16 @@ public class ServiceDiscoveryManager { }); } + /** + * Set the default identity all new connections will have. If unchanged the default identity is an + * identity where category is set to 'client', type is set to 'pc' and name is set to 'Smack'. + * + * @param identity + */ + public static void setDefaultIdentity(DiscoverInfo.Identity identity) { + defaultIdentity = identity; + } + /** * Creates a new ServiceDiscoveryManager for a given Connection. This means that the * service manager will respond to any service discovery request that the connection may