Package org.apache.vysper.xmpp.stanza

Examples of org.apache.vysper.xmpp.stanza.StanzaBuilder.endInnerElement()


    public void testFromStanza() {
        StanzaBuilder builder = StanzaBuilder.createMessageStanza(JID, JID, null, "Foo");
        builder.startInnerElement("x", NamespaceURIs.XEP0045_MUC);
        builder.startInnerElement("password").addText("secret").endInnerElement();
        builder.endInnerElement();
       
        X x = X.fromStanza(builder.build());
       
        assertNotNull(x);
        assertEquals("secret", x.getPasswordValue());
View Full Code Here


    private Stanza changeNick(Entity occupantJid, Entity roomWithNickJid) throws ProtocolException {
        StanzaBuilder stanzaBuilder = StanzaBuilder.createPresenceStanza(occupantJid, roomWithNickJid, null, null, null, null);
        stanzaBuilder.startInnerElement("x", NamespaceURIs.XEP0045_MUC);
       
        stanzaBuilder.endInnerElement();
        Stanza presenceStanza = stanzaBuilder.build();
        ResponseStanzaContainer container = handler.execute(presenceStanza, sessionContext.getServerRuntimeContext(), true, sessionContext, null);
        if(container != null) {
            return container.getResponseStanza();
        } else {
View Full Code Here

    }

    public void testVerifyNonPresence() {
        StanzaBuilder builder = StanzaBuilder.createMessageStanza(FROM, TO, "en", "foo");
        builder.startInnerElement("x", NamespaceURIs.XEP0045_MUC);
        builder.endInnerElement();
       
        assertFalse(presenceHandler.verify(builder.build()));
    }

View Full Code Here


    public void testVerifyWithMUCNamespace() {
        StanzaBuilder builder = StanzaBuilder.createPresenceStanza(FROM, TO, null, null, null, null);
        builder.startInnerElement("x", NamespaceURIs.XEP0045_MUC);
        builder.endInnerElement();
       
        assertTrue(presenceHandler.verify(builder.build()));
    }

    public void testVerifyWithNonMUCNamespace() {
View Full Code Here

    }

    public void testVerifyWithNonMUCNamespace() {
        StanzaBuilder builder = StanzaBuilder.createPresenceStanza(FROM, TO, null, null, null, null);
        builder.startInnerElement("x", "foo");
        builder.endInnerElement();
       
        assertFalse(presenceHandler.verify(builder.build()));
    }

   
View Full Code Here

        StanzaBuilder stanzaBuilder = startFeatureStanza();
        stanzaBuilder.startInnerElement("starttls", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_TLS);
            if (sessionContext.getServerRuntimeContext().getServerFeatures().isStartTLSRequired()) {
                stanzaBuilder.startInnerElement("required", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_TLS).endInnerElement();
            }
        stanzaBuilder.endInnerElement();

        return stanzaBuilder.build();
    }

    public Stanza getFeaturesForAuthentication(List<SASLMechanism> authenticationMethods) {
View Full Code Here

        StanzaBuilder stanzaBuilder = startFeatureStanza();
        stanzaBuilder.startInnerElement("mechanisms", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SASL);
            for (SASLMechanism authenticationMethod : authenticationMethods) {
                stanzaBuilder.startInnerElement("mechanism", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SASL).addText(authenticationMethod.getName()).endInnerElement();
            }
            stanzaBuilder.endInnerElement();

        return stanzaBuilder.build();
    }

    private Stanza getFeaturesForSession() {
View Full Code Here

    private Stanza getFeaturesForSession() {
        StanzaBuilder stanzaBuilder = startFeatureStanza();

        stanzaBuilder.startInnerElement("bind", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_BIND)
            .startInnerElement("required", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_BIND).endInnerElement();
        stanzaBuilder.endInnerElement();

        // session establishment is here for RFC3921 compatibility and is planed to be removed in revisions of this RFC.
        stanzaBuilder.startInnerElement("session", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SESSION)
            .startInnerElement("required", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SESSION).endInnerElement();
        stanzaBuilder.endInnerElement();
View Full Code Here

        stanzaBuilder.endInnerElement();

        // session establishment is here for RFC3921 compatibility and is planed to be removed in revisions of this RFC.
        stanzaBuilder.startInnerElement("session", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SESSION)
            .startInnerElement("required", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SESSION).endInnerElement();
        stanzaBuilder.endInnerElement();

        return stanzaBuilder.build();
    }

    protected StanzaBuilder startFeatureStanza() {
View Full Code Here

            }
        }
       
        builder.startInnerElement("error").addAttribute("type", type);
        builder.startInnerElement(errorName, NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_STANZAS).endInnerElement();
        builder.endInnerElement();
       
        return builder.build();
    }
   
    public static Stanza createInviteMessageStanza(Stanza original, String password) throws EntityFormatException {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.