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
This commit is contained in:
Florian Schmaus 2013-10-26 23:50:59 +00:00 committed by flow
parent c4014b8ba9
commit addf9ea6cd
1 changed files with 13 additions and 1 deletions

View File

@ -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<DiscoverInfo.Identity> identities = new HashSet<DiscoverInfo.Identity>();
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