@Override public void connectionCreated(final XMPPConnection connection) { // Set on every established connection that this client supports the Multi-User // Chat protocol. This information will be used when another client tries to // discover whether this client supports MUC or not. ServiceDiscoveryManager.getInstanceFor(connection).addFeature(MUCInitialPresence.NAMESPACE); // Set the NodeInformationProvider that will provide information about the // joined rooms whenever a disco request is received final WeakReference<XMPPConnection> weakRefConnection = new WeakReference<XMPPConnection>(connection); ServiceDiscoveryManager.getInstanceFor(connection).setNodeInformationProvider(DISCO_NODE, new AbstractNodeInformationProvider() { @Override public List<DiscoverItems.Item> getNodeItems() { XMPPConnection connection = weakRefConnection.get(); if (connection == null) return Collections.emptyList(); Set<EntityBareJid> joinedRooms = MultiUserChatManager.getInstanceFor(connection).getJoinedRooms(); List<DiscoverItems.Item> answer = new ArrayList<DiscoverItems.Item>(); for (EntityBareJid room : joinedRooms) { answer.add(new DiscoverItems.Item(room)); } return answer; } }); } });
serviceDiscoveryManager.setNodeInformationProvider(node, new AbstractNodeInformationProvider() { @Override
.setNodeInformationProvider(NAMESPACE, new AbstractNodeInformationProvider() { @Override
sdm.setNodeInformationProvider(localNodeVer, new AbstractNodeInformationProvider() { List<String> features = sdm.getFeatures(); List<ExtensionElement> packetExtensions = sdm.getExtendedInfoAsList();