Examples of Stanza


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

       
        // adding the ack attribute here is needed because when responding to o request with the same RID (as is the case here)
        // the ack would not be included on BoshBackedSessionContext#write0, but this first ack is required.
        body.addAttribute("ack", Long.toString(session.getHighestReadRid()));

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

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

        }
        return body.build();
    }
   
    private Stanza getRestartResponse() {
        Stanza features = new ServerResponses().getFeaturesForSession();
        return wrapStanza(features);
    }
View Full Code Here

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

       
        //
        // check presence broadcasts to resources of same session (self, interested & available)
        //
       
        Stanza initiatorNotification = initiatingUser.getNextStanza();
        assertNotNull(initiatorNotification);
        assertTrue(checkPresence(initiatorNotification, null, initiatingUser.getEntityFQ(), showValue));
        assertTrue(initiatorNotification.getVerifier().toAttributeEquals(initiatingUser.getEntityFQ().getFullQualifiedName()));
       
        Stanza availableResourceNotification = anotherAvailableUser.getNextStanza();
        assertNotNull(availableResourceNotification);
        assertTrue(checkPresence(availableResourceNotification, null, initiatingUser.getEntityFQ(), showValue));
        assertTrue(availableResourceNotification.getVerifier().toAttributeEquals(anotherAvailableUser.getEntityFQ().getFullQualifiedName()));
        assertNull(anotherAvailableUser.getNextStanza()); // no more stanzas
       
        Stanza interestedResourceNotification = anotherInterestedUser.getNextStanza();
        assertNotNull(interestedResourceNotification);
        assertTrue(checkPresence(interestedResourceNotification, null, initiatingUser.getEntityFQ(), showValue));
        assertTrue(interestedResourceNotification.getVerifier().toAttributeEquals(initiatingUser.getEntity().getFullQualifiedName() + "/" + anotherInterestedUser.getBoundResourceId()));
        assertNull(anotherInterestedUser.getNextStanza()); // no more stanzas
       
        assertNull(anotherInterestedNotAvailUser.getNextStanza()); // no stanza at all

        //
View Full Code Here

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

    private void assertStanzas(List<Stanza> stanzas, int expectedSize) throws Exception {
        assertEquals(expectedSize, stanzas.size());

        if(expectedSize > 0) {
            for(int i = 0; i<expectedSize - 1; i++) {
                Stanza stanza = stanzas.get(i);
                assertStanza(stanza, BODY + (DiscussionHistory.DEFAULT_HISTORY_SIZE - expectedSize + 2 + i), null);
            }

            // then check subject message
            assertStanza(stanzas.get(expectedSize - 1), null, SUBJECT);
View Full Code Here

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

        }
        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

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

    protected void testNotAllowedMessage(Room room, String expectedErrorName)
            throws Exception {
        String body = "Message body";

        // now, let user 2 exit room
        Stanza errorStanza = sendMessage(OCCUPANT1_JID, ROOM1_JID,
                GROUPCHAT, body);

        XMLElement expectedBody = new XMLElementBuilder("body").addText(body).build();
        assertMessageErrorStanza(errorStanza, ROOM1_JID, OCCUPANT1_JID, "modify",
                expectedErrorName,expectedBody);
View Full Code Here

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

                        X x = X.fromStanza(stanza);
                        if(x != null && x.getInvite() != null) {
                            if(sendingOccupant != null) {
                                // invite, forward modified invite
                                try {
                                    Stanza invite = MUCHandlerHelper.createInviteMessageStanza(stanza, room.getPassword());
                                    relayStanza(invite.getTo(), invite, serverRuntimeContext);
                                } catch (EntityFormatException e) {
                                    // invalid format of invite element
                                    return createMessageErrorStanza(room.getJID(), from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.JID_MALFORMED, stanza);
                                }
                            } else {
                                // user must be occupant to send invite
                                return createMessageErrorStanza(room.getJID(), from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.NOT_ACCEPTABLE, stanza);
                            }
                        } else if(x != null && x.getDecline() != null) {
                            // invite, forward modified decline
                            try {
                                Stanza decline = MUCHandlerHelper.createDeclineMessageStanza(stanza);
                                relayStanza(decline.getTo(), decline, serverRuntimeContext);
                            } catch (EntityFormatException e) {
                                // invalid format of invite element
                                return createMessageErrorStanza(room.getJID(), from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.JID_MALFORMED, stanza);
                            }
                        } else {
View Full Code Here

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

        } catch (ProtocolException e) {
            e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
        }

        if (responseStanzaContainer != null && responseStanzaContainer.getResponseStanza() != null) {
            Stanza responseStanza = responseStanzaContainer.getResponseStanza();
            try {
                IgnoreFailureStrategy failureStrategy = new IgnoreFailureStrategy(); // TODO call back MUC module
                serverRuntimeContext.getStanzaRelay().relay(responseStanza.getTo(), responseStanza, failureStrategy);
            } catch (DeliveryException e) {
                throw new RuntimeException(e);
            }
        }
View Full Code Here

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

    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

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

    public void testChangeNickWithDuplicateNick() throws Exception {
        Room room = conference.findRoom(ROOM1_JID);
        room.addOccupant(OCCUPANT1_JID, "nick");
        room.addOccupant(OCCUPANT2_JID, "nick 2");
       
        Stanza error = changeNick(OCCUPANT1_JID, new EntityImpl(ROOM1_JID,"nick 2"));
       
        assertNotNull(error);
    }
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.