Package org.apache.vysper.xmpp.stanza

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


        Entity sender = extractSenderJID(stanza, sessionContext);

        String iqStanzaID = stanza.getAttributeValue("id");
        StanzaBuilder sb = StanzaBuilder.createIQStanza(serverJID, sender, IQStanzaType.RESULT, iqStanzaID);
        sb.startInnerElement("pubsub", NamespaceURIs.XEP0060_PUBSUB_OWNER);
       
        String nodeName = extractNodeName(stanza);
        LeafNode node = root.find(nodeName);

        if(node == null) {
View Full Code Here


        CollectionNode root = serviceConfiguration.getRootNode();
        Entity sender = extractSenderJID(stanza, sessionContext);

        String iqStanzaID = stanza.getAttributeValue("id");
        StanzaBuilder sb = StanzaBuilder.createIQStanza(serverJID, sender, IQStanzaType.RESULT, iqStanzaID);
        sb.startInnerElement("pubsub", NamespaceURIs.XEP0060_PUBSUB_OWNER);

        String nodeName = extractNodeName(stanza);
        LeafNode node = root.find(nodeName);

        if(node == null) {
View Full Code Here

        String queryKey = getKey(x);
        String privateDataXML = persistenceManager.getPrivateData(from, queryKey);

        StanzaBuilder stanzaBuilder = StanzaBuilder.createIQStanza(stanza.getTo(), stanza.getFrom(), IQStanzaType.RESULT, stanza.getID());
        if (privateDataXML == null) {
            stanzaBuilder.startInnerElement(x.getName());
            for (Attribute a : x.getAttributes()) {
                stanzaBuilder.addAttribute(a);
            }
            stanzaBuilder.endInnerElement();
        } else {
View Full Code Here

        // If no vCard exists, the server MUST return a stanza error (which SHOULD be <item-not-found/>)
        // or an IQ-result containing an empty <vCard/> element.
        if (vcardXml == null) {
            IQStanzaType iqStanzaType = returnEmptyVCardWhenNonExistent ? IQStanzaType.RESULT : IQStanzaType.ERROR;
            StanzaBuilder stanzaBuilder = StanzaBuilder.createIQStanza(stanza.getTo(), stanza.getFrom(), iqStanzaType, stanza.getID());
            stanzaBuilder.startInnerElement("vCard", NamespaceURIs.VCARD_TEMP).endInnerElement();
            if (returnEmptyVCardWhenNonExistent) {
                // keep it like it is
            } else {
                stanzaBuilder.
                    startInnerElement("error").addAttribute("type", "cancel").
View Full Code Here

            StanzaBuilder stanzaBuilder = StanzaBuilder.createIQStanza(stanza.getTo(), stanza.getFrom(), iqStanzaType, stanza.getID());
            stanzaBuilder.startInnerElement("vCard", NamespaceURIs.VCARD_TEMP).endInnerElement();
            if (returnEmptyVCardWhenNonExistent) {
                // keep it like it is
            } else {
                stanzaBuilder.
                    startInnerElement("error").addAttribute("type", "cancel").
                        startInnerElement("item-not-found", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_STANZAS).
                        endInnerElement().
                    endInnerElement();
            }
View Full Code Here

        Entity subJID = null;

        String iqStanzaID = stanza.getAttributeValue("id");

        StanzaBuilder sb = StanzaBuilder.createIQStanza(serverJID, sender, IQStanzaType.RESULT, iqStanzaID);
        sb.startInnerElement("pubsub", NamespaceURIs.XEP0060_PUBSUB);

        XMLElement sub = stanza.getFirstInnerElement().getFirstInnerElement(); // pubsub/subscribe
        String strSubJID = sub.getAttributeValue("jid"); // MUST

        try {
View Full Code Here

        assertEquals(ResourceState.AVAILABLE_INTERESTED, getResourceState());
    }

    private StanzaBuilder createRosterGet() {
        StanzaBuilder stanzaBuilder = StanzaBuilder.createIQStanza(new EntityImpl(client, boundResourceId), null, IQStanzaType.GET, "id1");
        stanzaBuilder.startInnerElement("query", NamespaceURIs.JABBER_IQ_ROSTER).endInnerElement();
        return stanzaBuilder;
    }


    private ResourceState getResourceState() {
View Full Code Here

   
    public void testStanzaError() throws ParsingException {
        StanzaBuilder builder = new StanzaBuilder("iq");
        builder.addAttribute("to", SERVER_JID);
        builder.addAttribute("from", CLIENT_JID);
        builder.startInnerElement("ping", NamespaceURIs.URN_XMPP_PING);
        builder.endInnerElement();
       
        Stanza request = builder.build();
        IQStanza requestIq = new IQStanza(request);
View Full Code Here

    private Stanza createMessageEventStanza(String nodeName, Entity to, String lang, XMLElement item) {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("message", NamespaceURIs.XEP0060_PUBSUB_EVENT);
        stanzaBuilder.addAttribute("from", serverJID.getFullQualifiedName());
        stanzaBuilder.addAttribute("to", to.getFullQualifiedName());
        stanzaBuilder.addAttribute(NamespaceURIs.XML, "lang", lang);
        stanzaBuilder.startInnerElement("event");
        stanzaBuilder.startInnerElement("items");
        stanzaBuilder.addAttribute("node", nodeName);
        stanzaBuilder.addPreparedElement(item);
        stanzaBuilder.endInnerElement(); // items
        stanzaBuilder.endInnerElement(); // event
View Full Code Here

        StanzaBuilder stanzaBuilder = new StanzaBuilder("message", NamespaceURIs.XEP0060_PUBSUB_EVENT);
        stanzaBuilder.addAttribute("from", serverJID.getFullQualifiedName());
        stanzaBuilder.addAttribute("to", to.getFullQualifiedName());
        stanzaBuilder.addAttribute(NamespaceURIs.XML, "lang", lang);
        stanzaBuilder.startInnerElement("event");
        stanzaBuilder.startInnerElement("items");
        stanzaBuilder.addAttribute("node", nodeName);
        stanzaBuilder.addPreparedElement(item);
        stanzaBuilder.endInnerElement(); // items
        stanzaBuilder.endInnerElement(); // event
        return stanzaBuilder.build();
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.