From addf9ea6cd30c4d389cfd811e1e7d56f23ea1202 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 26 Oct 2013 23:50:59 +0000 Subject: [PATCH] SMACK-459 Add option to configure the default identity in ServiceDiscoveryManager git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13790 b35dd754-fafc-0310-a699-88a17e54d16e --- .../smackx/ServiceDiscoveryManager.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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