1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 09:39:39 +02:00

Moved identityName and identityType from SmackConfiguration to ServiceDiscoveryManager.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2359 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2004-08-09 22:09:20 +00:00 committed by gdombiak
parent 1a008f53c2
commit 3c80abdf45
3 changed files with 53 additions and 58 deletions

View file

@ -72,6 +72,9 @@ import org.jivesoftware.smackx.packet.*;
*/
public class ServiceDiscoveryManager {
private static String identityName = "Smack";
private static String identityType = "pc";
private static Map instances = new Hashtable();
private XMPPConnection connection;
@ -109,6 +112,52 @@ public class ServiceDiscoveryManager {
return (ServiceDiscoveryManager) instances.get(connection);
}
/**
* Returns the name of the client that will be returned when asked for the client identity
* in a disco request. The name could be any value you need to identity this client.
*
* @return the name of the client that will be returned when asked for the client identity
* in a disco request.
*/
public static String getIdentityName() {
return identityName;
}
/**
* Sets the name of the client that will be returned when asked for the client identity
* in a disco request. The name could be any value you need to identity this client.
*
* @param name the name of the client that will be returned when asked for the client identity
* in a disco request.
*/
public static void setIdentityName(String name) {
identityName = name;
}
/**
* Returns the type of client that will be returned when asked for the client identity in a
* disco request. The valid types are defined by the category client. Follow this link to learn
* the possible types: <a href="http://www.jabber.org/registrar/disco-categories.html#client">Jabber::Registrar</a>.
*
* @return the type of client that will be returned when asked for the client identity in a
* disco request.
*/
public static String getIdentityType() {
return identityType;
}
/**
* Sets the type of client that will be returned when asked for the client identity in a
* disco request. The valid types are defined by the category client. Follow this link to learn
* the possible types: <a href="http://www.jabber.org/registrar/disco-categories.html#client">Jabber::Registrar</a>.
*
* @param type the type of client that will be returned when asked for the client identity in a
* disco request.
*/
public static void setIdentityType(String type) {
identityType = type;
}
/**
* Initializes the packet listeners of the connection that will answer to any
* service discovery request.
@ -171,8 +220,8 @@ public class ServiceDiscoveryManager {
response.setPacketID(discoverInfo.getPacketID());
// Set this client identity
DiscoverInfo.Identity identity = new DiscoverInfo.Identity("client",
SmackConfiguration.getIdentityName());
identity.setType(SmackConfiguration.getIdentityType());
getIdentityName());
identity.setType(getIdentityType());
response.addIdentity(identity);
// Add the registered features to the response
synchronized (features) {