Package org.apache.vysper.xmpp.stanza

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


        body.addAttribute("ack", Long.toString(session.getHighestReadRid()));

        Stanza features = new ServerResponses().getFeaturesForAuthentication(serverRuntimeContext.getServerFeatures()
                .getAuthenticationMethods());
        body.addPreparedElement(features);
        return body.build();
    }

    /**
     * Creates an empty BOSH response.
     * <p>
 
View Full Code Here


     * The empty BOSH response looks like <code>&lt;body xmlns='http://jabber.org/protocol/httpbind'/&gt;</code>
     * @return the empty BOSH response
     */
    public Stanza getEmptyResponse() {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("body", NamespaceURIs.XEP0124_BOSH);
        return stanzaBuilder.build();
    }

    /**
     * Creates a BOSH response by wrapping a stanza in a &lt;body/&gt; element
     * @param stanza the XMPP stanza to wrap
View Full Code Here

     * @return the BOSH response
     */
    public Stanza wrapStanza(Stanza stanza) {
        StanzaBuilder body = new StanzaBuilder("body", NamespaceURIs.XEP0124_BOSH);
        body.addPreparedElement(stanza);
        return body.build();
    }
   
    /**
     * Creates a BOSH response by merging 2 other BOSH responses, this is useful when sending more than one message as
     * a response to a HTTP request.
View Full Code Here

            body.addPreparedElement(element);
        }
        for (XMLElement element : response2.getInnerElements()) {
            body.addPreparedElement(element);
        }
        return body.build();
    }
   
    private Stanza getRestartResponse() {
        Stanza features = new ServerResponses().getFeaturesForSession();
        return wrapStanza(features);
View Full Code Here

     * @return the termination BOSH body
    */
    public Stanza getTerminateResponse() {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("body", NamespaceURIs.XEP0124_BOSH);
        stanzaBuilder.addAttribute("type", "terminate");
        return stanzaBuilder.build();
    }
   
    /**
     * Adds a custom attribute to a BOSH body.
     *
 
View Full Code Here

        }
        stanzaBuilder.addAttribute(attributeName, attributeValue);
        for (XMLElement element : stanza.getInnerElements()) {
            stanzaBuilder.addPreparedElement(element);
        }
        return stanzaBuilder.build();
    }

}
View Full Code Here

//        }

        builder.addPreparedElement(new X(NamespaceURIs.XEP0045_MUC_USER, new Item(changer, includeJid, true)));

        logger.debug("Room presence from {} sent to {}", roomAndNick, receiver);
        relayStanza(receiver.getJid(), builder.build(), serverRuntimeContext);
    }

   
    private boolean includeJidInItem(Room room, Occupant receiver) {
     // room is non-anonymous or semi-anonmoys and the occupant a moderator, send full user JID
View Full Code Here

            // send status to indicate that this is the users own presence
            inner.add(new Status(StatusCode.OWN_PRESENCE));
        }
        builder.addPreparedElement(new X(NamespaceURIs.XEP0045_MUC_USER, inner));

        relayStanza(receiver.getJid(), builder.build(), serverRuntimeContext);
    }

   
    private void sendExitRoomPresenceToExisting(Occupant exitingOccupant, Occupant existingOccupant, Room room,
            String statusMessage, ServerRuntimeContext serverRuntimeContext) {
View Full Code Here

            }
            inner.add(status);
        }
        builder.addPreparedElement(new X(NamespaceURIs.XEP0045_MUC_USER, inner));

        relayStanza(existingOccupant.getJid(), builder.build(), serverRuntimeContext);
    }

    protected void relayStanzas(Entity receiver, List<Stanza> stanzas, ServerRuntimeContext serverRuntimeContext) {
        for(Stanza stanza : stanzas) {
            relayStanza(receiver, stanza, serverRuntimeContext);
View Full Code Here

        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

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.