mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 08:12:05 +01:00
Use AbstractNodeInformationProvider where possible
This commit is contained in:
parent
b54d133b36
commit
ce203e76b5
2 changed files with 8 additions and 40 deletions
|
@ -37,12 +37,11 @@ import org.jivesoftware.smack.filter.PacketExtensionFilter;
|
|||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||
import org.jivesoftware.smackx.caps.cache.EntityCapsPersistentCache;
|
||||
import org.jivesoftware.smackx.caps.packet.CapsExtension;
|
||||
import org.jivesoftware.smackx.disco.NodeInformationProvider;
|
||||
import org.jivesoftware.smackx.disco.AbstractNodeInformationProvider;
|
||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo.Feature;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo.Identity;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverItems.Item;
|
||||
import org.jivesoftware.smackx.xdata.FormField;
|
||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||
import org.jxmpp.util.cache.LruCache;
|
||||
|
@ -478,25 +477,17 @@ public class EntityCapsManager extends Manager {
|
|||
JID_TO_NODEVER_CACHE.put(connection.getUser(), new NodeVerHash(entityNode, currentCapsVersion, "sha-1"));
|
||||
|
||||
final List<Identity> identities = new LinkedList<Identity>(ServiceDiscoveryManager.getInstanceFor(connection).getIdentities());
|
||||
sdm.setNodeInformationProvider(entityNode + '#' + currentCapsVersion, new NodeInformationProvider() {
|
||||
sdm.setNodeInformationProvider(entityNode + '#' + currentCapsVersion, new AbstractNodeInformationProvider() {
|
||||
List<String> features = sdm.getFeaturesList();
|
||||
List<PacketExtension> packetExtensions = sdm.getExtendedInfoAsList();
|
||||
|
||||
@Override
|
||||
public List<Item> getNodeItems() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNodeFeatures() {
|
||||
return features;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Identity> getNodeIdentities() {
|
||||
return identities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PacketExtension> getNodePacketExtensions() {
|
||||
return packetExtensions;
|
||||
|
|
|
@ -38,16 +38,14 @@ import org.jivesoftware.smack.filter.PacketFilter;
|
|||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smackx.commands.AdHocCommand.Action;
|
||||
import org.jivesoftware.smackx.commands.AdHocCommand.Status;
|
||||
import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
|
||||
import org.jivesoftware.smackx.disco.NodeInformationProvider;
|
||||
import org.jivesoftware.smackx.disco.AbstractNodeInformationProvider;
|
||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo.Identity;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
||||
import org.jivesoftware.smackx.xdata.Form;
|
||||
|
||||
|
@ -143,7 +141,8 @@ public class AdHocCommandManager extends Manager {
|
|||
// received
|
||||
ServiceDiscoveryManager.getInstanceFor(connection)
|
||||
.setNodeInformationProvider(NAMESPACE,
|
||||
new NodeInformationProvider() {
|
||||
new AbstractNodeInformationProvider() {
|
||||
@Override
|
||||
public List<DiscoverItems.Item> getNodeItems() {
|
||||
|
||||
List<DiscoverItems.Item> answer = new ArrayList<DiscoverItems.Item>();
|
||||
|
@ -159,19 +158,6 @@ public class AdHocCommandManager extends Manager {
|
|||
|
||||
return answer;
|
||||
}
|
||||
|
||||
public List<String> getNodeFeatures() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Identity> getNodeIdentities() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PacketExtension> getNodePacketExtensions() {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// The packet listener and the filter for processing some AdHoc Commands
|
||||
|
@ -232,11 +218,8 @@ public class AdHocCommandManager extends Manager {
|
|||
// Set the NodeInformationProvider that will provide information about
|
||||
// the added command
|
||||
serviceDiscoveryManager.setNodeInformationProvider(node,
|
||||
new NodeInformationProvider() {
|
||||
public List<DiscoverItems.Item> getNodeItems() {
|
||||
return null;
|
||||
}
|
||||
|
||||
new AbstractNodeInformationProvider() {
|
||||
@Override
|
||||
public List<String> getNodeFeatures() {
|
||||
List<String> answer = new ArrayList<String>();
|
||||
answer.add(NAMESPACE);
|
||||
|
@ -245,7 +228,7 @@ public class AdHocCommandManager extends Manager {
|
|||
answer.add("jabber:x:data");
|
||||
return answer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DiscoverInfo.Identity> getNodeIdentities() {
|
||||
List<DiscoverInfo.Identity> answer = new ArrayList<DiscoverInfo.Identity>();
|
||||
DiscoverInfo.Identity identity = new DiscoverInfo.Identity(
|
||||
|
@ -253,12 +236,6 @@ public class AdHocCommandManager extends Manager {
|
|||
answer.add(identity);
|
||||
return answer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PacketExtension> getNodePacketExtensions() {
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue