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

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


       
        if(existingOccupant.getJid().equals(newOccupant.getJid())) {
           
            if(room.getRoomTypes().contains(RoomType.NonAnonymous)) {
                // notify the user that this is a non-anonymous room
                inner.add(new Status(StatusCode.ROOM_NON_ANONYMOUS));
            }
           
            // 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));

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


       
        List<XMLElement> inner = new ArrayList<XMLElement>();
       
        boolean includeJid = includeJidInItem(room, receiver);
        inner.add(new Item(changer, includeJid, true));
        inner.add(new Status(StatusCode.NEW_NICK));
       
        if(receiver.getJid().equals(changer.getJid())) {
            // 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));

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

        boolean includeJid = includeJidInItem(room, receiver)
        inner.add(new Item(changer, includeJid, false));
       
        if(receiver.getJid().equals(changer.getJid())) {
            // 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);
    }
View Full Code Here

        // is this stanza to be sent to the exiting user himself?
        boolean ownStanza = existingOccupant.getJid().equals(exitingOccupant.getJid());
       
        if(ownStanza || statusMessage != null) {

            Status status;
            if(ownStanza) {
                // send status to indicate that this is the users own presence
                status = new Status(StatusCode.OWN_PRESENCE, statusMessage);
            } else {
                status = new Status(statusMessage);
            }
            inner.add(status);
        }
        builder.addPreparedElement(new X(NamespaceURIs.XEP0045_MUC_USER, inner));
View Full Code Here

        // otherwise we should send messages
        Occupant targetOccupant = room.findOccupantByJID(target);
       
        // notify remaining users that user got affiliation updated
        PresenceStanzaType presenceType = null;
        Status status = null;
        Role newRole;
        Entity from;
        if(targetOccupant != null) {
            newRole = targetOccupant.getRole();
            from = roomAndNick(room, targetOccupant);
        } else {
            newRole = Role.None;
            from = room.getJID();
           
        }
       
        // only owners can revoke ownership and admin
        if((currentAffiliation == Affiliation.Owner || currentAffiliation == Affiliation.Admin) && moderator.getAffiliation() != Affiliation.Owner) {
            return MUCHandlerHelper.createErrorReply(stanza, StanzaErrorType.CANCEL,
                    StanzaErrorCondition.NOT_ALLOWED);
        }
       
        // if the occupant is getting revoke as a member, and this is a members-only room, he also needs to leave the room
        if((newAffiliation == Affiliation.None && room.isRoomType(RoomType.MembersOnly)) || newAffiliation == Affiliation.Outcast) {
            if(newAffiliation == Affiliation.Outcast && targetOccupant.getAffiliation().compareTo(moderator.getAffiliation()) < 0) {
                return MUCHandlerHelper.createErrorReply(stanza, StanzaErrorType.CANCEL,
                        StanzaErrorCondition.NOT_ALLOWED);
            }
           
            if(targetOccupant != null) {
                room.removeOccupant(target);
            }
            presenceType = PresenceStanzaType.UNAVAILABLE;
           
            if(newAffiliation == Affiliation.Outcast) {
                status = new Status(StatusCode.BEEN_BANNED);
            } else {
                status = new Status(StatusCode.REMOVED_BY_AFFILIATION);
            }

            newRole = Role.None;
           
            MucUserItem presenceItem = new MucUserItem(newAffiliation, newRole);
View Full Code Here

            room.removeOccupant(target.getJid());
        }

        Entity targetInRoom = roomAndNick(room, target);

        Status status = null;
        if (newRole == Role.None) {
            status = new Status(StatusCode.BEEN_KICKED);

            // notify user he got kicked
            Stanza presenceToKicked = MUCStanzaBuilder.createPresenceStanza(targetInRoom, target.getJid(),
                    PresenceStanzaType.UNAVAILABLE, NamespaceURIs.XEP0045_MUC_USER, new MucUserItem(
                            Affiliation.None, Role.None),
View Full Code Here

        if (existingOccupant.getJid().equals(newOccupant.getJid())) {

            if (room.getRoomTypes().contains(RoomType.NonAnonymous)) {
                // notify the user that this is a non-anonymous room
                inner.add(new Status(StatusCode.ROOM_NON_ANONYMOUS));
            }

            // send status to indicate that this is the users own presence
            inner.add(new Status(StatusCode.OWN_PRESENCE));
        }

        Stanza presenceToExisting = MUCStanzaBuilder.createPresenceStanza(roomAndNewUserNick,
                existingOccupant.getJid(), null, NamespaceURIs.XEP0045_MUC_USER, inner);
View Full Code Here

        List<XMLElement> inner = new ArrayList<XMLElement>();

        boolean includeJid = includeJidInItem(room, receiver);
        inner.add(new MucUserItem(changer, includeJid, true));
        inner.add(new Status(StatusCode.NEW_NICK));

        if (receiver.getJid().equals(changer.getJid())) {
            // send status to indicate that this is the users own presence
            inner.add(new Status(StatusCode.OWN_PRESENCE));
        }
        Stanza presenceToReceiver = MUCStanzaBuilder.createPresenceStanza(roomAndOldNick, receiver.getJid(),
                PresenceStanzaType.UNAVAILABLE, NamespaceURIs.XEP0045_MUC_USER, inner);

        logger.debug("Room presence from {} sent to {}", roomAndOldNick, receiver);
View Full Code Here

        boolean includeJid = includeJidInItem(room, receiver);
        inner.add(new MucUserItem(changer, includeJid, false));

        if (receiver.getJid().equals(changer.getJid())) {
            // send status to indicate that this is the users own presence
            inner.add(new Status(StatusCode.OWN_PRESENCE));
        }
        Stanza presenceToReceiver = MUCStanzaBuilder.createPresenceStanza(roomAndOldNick, receiver.getJid(), null,
                NamespaceURIs.XEP0045_MUC_USER, inner);

        relayStanza(receiver.getJid(), presenceToReceiver, serverRuntimeContext);
View Full Code Here

        // is this stanza to be sent to the exiting user himself?
        boolean ownStanza = existingOccupant.getJid().equals(exitingOccupant.getJid());

        if (ownStanza || statusMessage != null) {

            Status status;
            if (ownStanza) {
                // send status to indicate that this is the users own presence
                status = new Status(StatusCode.OWN_PRESENCE, statusMessage);
            } else {
                status = new Status(statusMessage);
            }
            inner.add(status);
        }

        Stanza presenceToExisting = MUCStanzaBuilder.createPresenceStanza(roomAndNewUserNick,
View Full Code Here

TOP

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

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.