Package org.apache.vysper.xmpp.stanza

Examples of org.apache.vysper.xmpp.stanza.StanzaBuilder


        return sendMessage(from, to, type, body, null, null);
    }
   
    protected Stanza sendMessage(Entity from, Entity to, MessageStanzaType type,
            String body, X x, String subject) throws ProtocolException {
        StanzaBuilder stanzaBuilder = StanzaBuilder.createMessageStanza(from,
                to, type, null, body);
        if(subject != null) {
            stanzaBuilder.startInnerElement("subject").addText(subject).endInnerElement();
        }
        if(x != null) {
            stanzaBuilder.addPreparedElement(x);
        }

        Stanza messageStanza = stanzaBuilder.build();
        ResponseStanzaContainer container = handler.execute(messageStanza,
                sessionContext.getServerRuntimeContext(), true, sessionContext,
                null);
        if (container != null) {
            return container.getResponseStanza();
View Full Code Here


* @author The Apache MINA Project (dev@mina.apache.org)
*/
public class AuthorizationResponses {

    public Stanza getSuccess() {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("success", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SASL);
        return stanzaBuilder.build();
    }
View Full Code Here

    public Stanza getFailureNotAuthorized() {
        return getFailure(SASLFailureType.NOT_AUTHORIZED);
    }

    public Stanza getFailure(SASLFailureType failureType) {
        return new StanzaBuilder("failure", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SASL)
                .startInnerElement(failureType.value()).endInnerElement().build();
    }
View Full Code Here

/**
*/
public class MUCPresenceHandlerChangeNickTestCase extends AbstractMUCHandlerTestCase {

    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 {
            return null;
View Full Code Here

             [OPTIONAL application-specific condition element]
           </stream:jabber>
        */

        if (languageCode == null) languageCode = "en_US";
        StanzaBuilder stanzaBuilder = new StanzaBuilder("error");

        stanzaBuilder.startInnerElement(definedErrorCondition.value())
            .addNamespaceAttribute(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_STREAMS)
            .endInnerElement();

        if (descriptiveText != null) {
            stanzaBuilder.startInnerElement("text")
                .addNamespaceAttribute(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_STREAMS)
                .addAttribute(NamespaceURIs.XML, "lang", languageCode)
                .addText(descriptiveText)
                .endInnerElement();
        }

        if (applicationSpecificError != null) {
            stanzaBuilder.addPreparedElement(applicationSpecificError);
        }

        return stanzaBuilder.build();
    }
View Full Code Here

        if (stanza != null && "error".equals(stanza.getType())) {
            return ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.UNSUPPORTED_STANZA_TYPE, errorLang,
                                                               "cannot respond to IQ stanza of type error with the same", null);
        }

        StanzaBuilder responseBuilder = StanzaBuilder.createDirectReply(stanza, true, "error");

        fillErrorStanza(stanza, type, errorCondition, errorText, errorLang, errorConditionElement, responseBuilder);

        return responseBuilder.build();
    }
View Full Code Here

        responseBuilder.endInnerElement();
    }

    public Stanza getTLSFailure() {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("failure", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_TLS);
        return stanzaBuilder.build();
    }
View Full Code Here

        Conference conference = new Conference("foo");
        presenceHandler = new MUCPresenceHandler(conference);
    }

    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

        StanzaBuilder stanzaBuilder = new StanzaBuilder("failure", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_TLS);
        return stanzaBuilder.build();
    }

    public Stanza getSASLFailure(SASLFailureType failureType) {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("failure", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SASL);
        if (failureType != null) {
            stanzaBuilder.startInnerElement(failureType.toString()).endInnerElement();
        }
        return stanzaBuilder.build();
    }
View Full Code Here

        assertFalse(presenceHandler.verify(builder.build()));
    }


    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()));
    }
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.stanza.StanzaBuilder

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.