mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-29 23:42:06 +01:00
Adds ability to set the identity name and type of a Smack client. SMACK-149
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2347 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
287c54a6ac
commit
e45c4a6805
2 changed files with 60 additions and 0 deletions
|
@ -15,4 +15,10 @@
|
||||||
<!-- Keep-alive interval in milleseconds -->
|
<!-- Keep-alive interval in milleseconds -->
|
||||||
<keepAliveInterval>30000</keepAliveInterval>
|
<keepAliveInterval>30000</keepAliveInterval>
|
||||||
|
|
||||||
|
<!-- Name of the client to provide as the client's identity -->
|
||||||
|
<identityName>Smack</identityName>
|
||||||
|
<!-- Type of client within the categoty "client". For other valid types refer to
|
||||||
|
http://www.jabber.org/registrar/disco-categories.html#client -->
|
||||||
|
<identityType>pc</identityType>
|
||||||
|
|
||||||
</smack>
|
</smack>
|
|
@ -79,6 +79,8 @@ public final class SmackConfiguration {
|
||||||
|
|
||||||
private static int packetReplyTimeout = 5000;
|
private static int packetReplyTimeout = 5000;
|
||||||
private static int keepAliveInterval = 30000;
|
private static int keepAliveInterval = 30000;
|
||||||
|
private static String identityName = "Smack";
|
||||||
|
private static String identityType = "pc";
|
||||||
|
|
||||||
private SmackConfiguration() {
|
private SmackConfiguration() {
|
||||||
}
|
}
|
||||||
|
@ -120,6 +122,12 @@ public final class SmackConfiguration {
|
||||||
else if (parser.getName().equals("keepAliveInterval")) {
|
else if (parser.getName().equals("keepAliveInterval")) {
|
||||||
keepAliveInterval = parseIntProperty(parser, keepAliveInterval);
|
keepAliveInterval = parseIntProperty(parser, keepAliveInterval);
|
||||||
}
|
}
|
||||||
|
else if (parser.getName().equals("identityName")) {
|
||||||
|
identityName = parser.nextText();
|
||||||
|
}
|
||||||
|
else if (parser.getName().equals("identityType")) {
|
||||||
|
identityType = parser.nextText();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
eventType = parser.next();
|
eventType = parser.next();
|
||||||
}
|
}
|
||||||
|
@ -195,6 +203,52 @@ public final class SmackConfiguration {
|
||||||
keepAliveInterval = interval;
|
keepAliveInterval = interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
private static void parseClassToLoad(XmlPullParser parser) throws Exception {
|
private static void parseClassToLoad(XmlPullParser parser) throws Exception {
|
||||||
String className = parser.nextText();
|
String className = parser.nextText();
|
||||||
// Attempt to load the class so that the class can get initialized
|
// Attempt to load the class so that the class can get initialized
|
||||||
|
|
Loading…
Reference in a new issue