1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-23 21:17:58 +01:00

Applied patch for full XEP-128 compliance from Guus.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@9920 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Daniel Henninger 2008-02-15 16:32:46 +00:00 committed by dhenninger
parent 9876d05d52
commit 3a1a6b7830

View file

@ -29,6 +29,7 @@ import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smackx.packet.DiscoverInfo;
import org.jivesoftware.smackx.packet.DiscoverItems;
import org.jivesoftware.smackx.packet.DataForm;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@ -54,6 +55,7 @@ public class ServiceDiscoveryManager {
private XMPPConnection connection;
private final List<String> features = new ArrayList<String>();
private DataForm extendedInfo = null;
private Map<String, NodeInformationProvider> nodeInformationProviders =
new ConcurrentHashMap<String, NodeInformationProvider>();
@ -228,6 +230,9 @@ public class ServiceDiscoveryManager {
for (Iterator<String> it = getFeatures(); it.hasNext();) {
response.addFeature(it.next());
}
if (extendedInfo != null) {
response.addExtension(extendedInfo);
}
}
}
else {
@ -368,6 +373,36 @@ public class ServiceDiscoveryManager {
}
}
/**
* Registers extended discovery information of this XMPP entity. When this
* client is queried for its information this data form will be returned as
* specified by XEP-0128.
* <p>
*
* Since no packet is actually sent to the server it is safe to perform this
* operation before logging to the server. In fact, you may want to
* configure the extended info before logging to the server so that the
* information is already available if it is required upon login.
*
* @param info
* the data form that contains the extend service discovery
* information.
*/
public void setExtendedInfo(DataForm info) {
extendedInfo = info;
}
/**
* Removes the dataform containing extended service discovery information
* from the information returned by this XMPP entity.<p>
*
* Since no packet is actually sent to the server it is safe to perform this
* operation before logging to the server.
*/
public void removeExtendedInfo() {
extendedInfo = null;
}
/**
* Returns the discovered information of a given XMPP entity addressed by its JID.
*