1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-10-31 17:25:58 +01:00

Replace PrivateDatamanager.getProviderKey with JXMPP method

This commit is contained in:
Florian Schmaus 2015-04-12 18:24:52 +02:00
parent e3dced6eea
commit 00ba5ae3df

View file

@ -29,6 +29,7 @@ import org.jivesoftware.smackx.iqprivate.packet.DefaultPrivateData;
import org.jivesoftware.smackx.iqprivate.packet.PrivateData;
import org.jivesoftware.smackx.iqprivate.packet.PrivateDataIQ;
import org.jivesoftware.smackx.iqprivate.provider.PrivateDataProvider;
import org.jxmpp.util.XmppStringUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@ -98,7 +99,7 @@ public final class PrivateDataManager extends Manager {
* @return the PrivateData provider.
*/
public static PrivateDataProvider getPrivateDataProvider(String elementName, String namespace) {
String key = getProviderKey(elementName, namespace);
String key = XmppStringUtils.generateKey(elementName, namespace);
return privateDataProviders.get(key);
}
@ -113,7 +114,7 @@ public final class PrivateDataManager extends Manager {
public static void addPrivateDataProvider(String elementName, String namespace,
PrivateDataProvider provider)
{
String key = getProviderKey(elementName, namespace);
String key = XmppStringUtils.generateKey(elementName, namespace);
privateDataProviders.put(key, provider);
}
@ -124,7 +125,7 @@ public final class PrivateDataManager extends Manager {
* @param namespace The XML namespace.
*/
public static void removePrivateDataProvider(String elementName, String namespace) {
String key = getProviderKey(elementName, namespace);
String key = XmppStringUtils.generateKey(elementName, namespace);
privateDataProviders.remove(key);
}
@ -183,19 +184,6 @@ public final class PrivateDataManager extends Manager {
connection().createPacketCollectorAndSend(privateDataSet).nextResultOrThrow();
}
/**
* Returns a String key for a given element name and namespace.
*
* @param elementName the element name.
* @param namespace the namespace.
* @return a unique key for the element name and namespace pair.
*/
private static String getProviderKey(String elementName, String namespace) {
StringBuilder buf = new StringBuilder();
buf.append("<").append(elementName).append("/><").append(namespace).append("/>");
return buf.toString();
}
/**
* An IQ provider to parse IQ results containing private data.
*/