Package rocks.xmpp.extensions.disco.model.info

Examples of rocks.xmpp.extensions.disco.model.info.Feature


     */
    public List<StreamHost> discoverProxies() throws XmppException {
        ItemNode itemNode = serviceDiscoveryManager.discoverItems(null);
        for (Item item : itemNode.getItems()) {
            InfoNode infoNode = serviceDiscoveryManager.discoverInformation(item.getJid());
            if (infoNode.getFeatures().contains(new Feature(Socks5ByteStream.NAMESPACE))) {
                IQ result = xmppSession.query(new IQ(item.getJid(), IQ.Type.GET, new Socks5ByteStream()));
                Socks5ByteStream socks5ByteStream = result.getExtension(Socks5ByteStream.class);
                if (socks5ByteStream != null) {
                    return socks5ByteStream.getStreamHosts();
                }
View Full Code Here


        ItemNode itemDiscovery = serviceDiscoveryManager.discoverItems(null);
        Collection<ChatService> chatServices = new ArrayList<>();

        for (Item item : itemDiscovery.getItems()) {
            InfoNode infoDiscovery = serviceDiscoveryManager.discoverInformation(item.getJid());
            if (infoDiscovery.getFeatures().contains(new Feature(Muc.NAMESPACE))) {
                chatServices.add(new ChatService(item.getJid(), xmppSession, serviceDiscoveryManager));
            }
        }
        return chatServices;
    }
View Full Code Here

public class ServiceDiscoveryManagerTest extends BaseTest {

    @Test
    public void testFeatureEquals() {
        ServiceDiscoveryManager serviceDiscoveryManager = xmppSession.getExtensionManager(ServiceDiscoveryManager.class);
        serviceDiscoveryManager.addFeature(new Feature("http://jabber.org/protocol/muc"));
        Assert.assertTrue(serviceDiscoveryManager.getFeatures().contains(new Feature("http://jabber.org/protocol/muc")));
    }
View Full Code Here

    public void testServiceDiscoveryEntry() {
        TestXmppSession connection1 = new TestXmppSession();
        ServiceDiscoveryManager serviceDiscoveryManager = connection1.getExtensionManager(ServiceDiscoveryManager.class);
        // By default, the manager should be enabled.
        Assert.assertTrue(serviceDiscoveryManager.isEnabled());
        Feature featureInfo = new Feature("http://jabber.org/protocol/disco#info");
        Feature featureItems = new Feature("http://jabber.org/protocol/disco#items");
        Assert.assertTrue(serviceDiscoveryManager.getFeatures().contains(featureInfo));
        Assert.assertTrue(serviceDiscoveryManager.getFeatures().contains(featureItems));
        serviceDiscoveryManager.setEnabled(false);
        Assert.assertFalse(serviceDiscoveryManager.isEnabled());
        Assert.assertFalse(serviceDiscoveryManager.getFeatures().contains(featureInfo));
View Full Code Here

    public void testVerificationString() throws NoSuchAlgorithmException {
        List<Identity> identities = new ArrayList<>();
        identities.add(new Identity("client", "pc", "Exodus 0.9.1"));

        List<Feature> features = new ArrayList<>();
        features.add(new Feature("http://jabber.org/protocol/disco#info"));
        features.add(new Feature("http://jabber.org/protocol/disco#items"));
        features.add(new Feature("http://jabber.org/protocol/muc"));
        features.add(new Feature("http://jabber.org/protocol/caps"));

        InfoNode infoNode = new InfoDiscovery();
        infoNode.getFeatures().addAll(features);
        infoNode.getIdentities().addAll(identities);
        String verificationString = EntityCapabilities.getVerificationString(infoNode, MessageDigest.getInstance("sha-1"));
View Full Code Here

        List<Identity> identities = new ArrayList<>();
        identities.add(new Identity("client", "pc", "Psi 0.11", "en"));
        identities.add(new Identity("client", "pc", "P 0.11", "el"));

        List<Feature> features = new ArrayList<>();
        features.add(new Feature("http://jabber.org/protocol/caps"));
        features.add(new Feature("http://jabber.org/protocol/disco#info"));
        features.add(new Feature("http://jabber.org/protocol/disco#items"));
        features.add(new Feature("http://jabber.org/protocol/muc"));

        DataForm dataForm = new DataForm(DataForm.Type.RESULT);
        dataForm.getFields().add(new DataForm.Field(DataForm.Field.Type.HIDDEN, "FORM_TYPE", "urn:xmpp:dataforms:softwareinfo"));
        dataForm.getFields().add(new DataForm.Field(DataForm.Field.Type.TEXT_SINGLE, "ip_version", "ipv4", "ipv6"));
        dataForm.getFields().add(new DataForm.Field(DataForm.Field.Type.TEXT_SINGLE, "os", "Mac"));
View Full Code Here

    public void testVerificationStringWithExtendedForm() throws NoSuchAlgorithmException {
        List<Identity> identities = new ArrayList<>();
        identities.add(new Identity("client", "pc", "Exodus 0.9.1"));

        List<Feature> features = new ArrayList<>();
        features.add(new Feature("http://jabber.org/protocol/disco#info"));
        features.add(new Feature("http://jabber.org/protocol/disco#items"));
        features.add(new Feature("http://jabber.org/protocol/muc"));
        features.add(new Feature("http://jabber.org/protocol/caps"));

        DataForm dataForm1 = new DataForm(DataForm.Type.FORM);
        dataForm1.getFields().add(new DataForm.Field(DataForm.Field.Type.BOOLEAN, "ccc"));
        dataForm1.getFields().add(new DataForm.Field(DataForm.Field.Type.HIDDEN, "FORM_TYPE"));
View Full Code Here

    public void testVerificationString3() throws NoSuchAlgorithmException {
        List<Identity> identities = new ArrayList<>();
        identities.add(new Identity("client", "pc"));

        List<Feature> features = new ArrayList<>();
        features.add(new Feature("http://jabber.org/protocol/disco#info"));
        features.add(new Feature("http://jabber.org/protocol/disco#items"));
        features.add(new Feature("urn:xmpp:ping"));
        features.add(new Feature("jabber:iq:last"));
        features.add(new Feature("jabber:iq:version"));
        features.add(new Feature("http://jabber.org/protocol/ibb"));
        features.add(new Feature("vcard-temp"));
        features.add(new Feature("urn:xmpp:time"));
        features.add(new Feature("http://jabber.org/protocol/shim"));
        features.add(new Feature("http://jabber.org/protocol/caps"));

        InfoNode infoNode = new InfoDiscovery();
        infoNode.getFeatures().addAll(features);
        infoNode.getIdentities().addAll(identities);
        String verificationString = EntityCapabilities.getVerificationString(infoNode, MessageDigest.getInstance("sha-1"));
View Full Code Here

     * @throws rocks.xmpp.core.stanza.model.StanzaException If the entity returned a stanza error.
     * @throws rocks.xmpp.core.session.NoResponseException  If the entity did not respond.
     */
    public boolean isSupported(String feature, Jid jid) throws XmppException {
        InfoNode infoNode = getCapabilities(jid);
        return infoNode.getFeatures().contains(new Feature(feature));
    }
View Full Code Here

        ItemNode itemNode = serviceDiscoveryManager.discoverItems(null);
        Collection<PubSubService> pubSubServices = new ArrayList<>();

        for (Item item : itemNode.getItems()) {
            InfoNode infoNode = serviceDiscoveryManager.discoverInformation(item.getJid());
            if (infoNode.getFeatures().contains(new Feature(PubSub.NAMESPACE))) {
                pubSubServices.add(new PubSubService(item.getJid(), xmppSession, serviceDiscoveryManager));
            }
        }
        return pubSubServices;
    }
View Full Code Here

TOP

Related Classes of rocks.xmpp.extensions.disco.model.info.Feature

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.