Package org.apache.vysper.xmpp.modules.extension.xep0045_muc.stanzas

Examples of org.apache.vysper.xmpp.modules.extension.xep0045_muc.stanzas.X


        inner.add(invdec);
        if (password != null) {
            inner.add(new Password(password));
        }

        X newX = new X(NamespaceURIs.XEP0045_MUC_USER, inner);
        builder.addPreparedElement(newX);
        return builder.build();
    }
View Full Code Here


        // "Note: If an error occurs in relation to joining a room, the service SHOULD include
        // the MUC child element (i.e., <x xmlns='http://jabber.org/protocol/muc'/>) in the
        // <presence/> stanza of type "error"."

        return MUCHandlerHelper.createErrorStanza("presence", NamespaceURIs.JABBER_CLIENT, from, to, id, type,
                errorName, Arrays.asList((XMLElement) new X()));
    }
View Full Code Here

                return createPresenceErrorStanza(roomJid, newOccupantJid, stanza.getID(), "cancel", "conflict");
            }

            // check password if password protected
            if (room.isRoomType(RoomType.PasswordProtected)) {
                X x = X.fromStanza(stanza);
                String password = null;
                if (x != null) {
                    password = x.getPasswordValue();
                }

                if (password == null || !password.equals(room.getPassword())) {
                    // password missing or not matching
                    return createPresenceErrorStanza(roomJid, newOccupantJid, stanza.getID(), "auth", "not-authorized");
View Full Code Here

        //        if(receiver.getJid().equals(changer.getJid())) {
        //            // send status to indicate that this is the users own presence
        //            new Status(StatusCode.OWN_PRESENCE).insertElement(builder);
        //        }

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

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

        return null;
    }

    private Stanza handleInvites(MessageStanza stanza, Entity from, Occupant sendingOccupant, Room room,
            ServerRuntimeContext serverRuntimeContext) {
        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) {
View Full Code Here

        // "Note: If an error occurs in relation to joining a room, the service SHOULD include
        // the MUC child element (i.e., <x xmlns='http://jabber.org/protocol/muc'/>) in the
        // <presence/> stanza of type "error"."

        return MUCHandlerHelper.createErrorStanza("presence", NamespaceURIs.JABBER_CLIENT, from, to, id, type,
                errorName, Arrays.asList((XMLElement) new X()));
    }
View Full Code Here

                return createPresenceErrorStanza(roomJid, newOccupantJid, stanza.getID(), "cancel", "conflict");
            }

            // check password if password protected
            if (room.isRoomType(RoomType.PasswordProtected)) {
                X x = X.fromStanza(stanza);
                String password = null;
                if (x != null) {
                    password = x.getPasswordValue();
                }

                if (password == null || !password.equals(room.getPassword())) {
                    // password missing or not matching
                    return createPresenceErrorStanza(roomJid, newOccupantJid, stanza.getID(), "auth", "not-authorized");
View Full Code Here

        //        if(receiver.getJid().equals(changer.getJid())) {
        //            // send status to indicate that this is the users own presence
        //            new Status(StatusCode.OWN_PRESENCE).insertElement(builder);
        //        }

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

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

        return null;
    }

    private Stanza handleInvites(MessageStanza stanza, Entity from, Occupant sendingOccupant, Room room,
            ServerRuntimeContext serverRuntimeContext) {
        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) {
View Full Code Here

                xInnerElms.add(new Password(password));
            }
            if (history != null) {
                xInnerElms.add(history);
            }
            stanzaBuilder.addPreparedElement(new X(xInnerElms));
        }
        Stanza presenceStanza = stanzaBuilder.build();
        ResponseStanzaContainer container = handler.execute(presenceStanza, userSessionContext
                .getServerRuntimeContext(), true, userSessionContext, null);
        if (container != null) {
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.modules.extension.xep0045_muc.stanzas.X

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.