Examples of MucUserItem


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

                String requestNick = getFieldValue(fields, "muc#roomnick");
                Occupant requestor = room.findOccupantByNick(requestNick);
                requestor.setRole(Role.Participant);
               
                // notify remaining users that user got role updated
                MucUserItem presenceItem = new MucUserItem(requestor.getAffiliation(), requestor.getRole());
                for (Occupant occupant : room.getOccupants()) {
                    Stanza presenceToRemaining = MUCStanzaBuilder.createPresenceStanza(requestor.getJidInRoom(), occupant.getJid(),
                            null, NamespaceURIs.XEP0045_MUC_USER, presenceItem);

                    relayStanza(occupant.getJid(), presenceToRemaining, serverRuntimeContext);
View Full Code Here

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

                status = new Status(StatusCode.REMOVED_BY_AFFILIATION);
            }

            newRole = Role.None;
           
            MucUserItem presenceItem = new MucUserItem(newAffiliation, newRole);

            Stanza presenceToFormerMember = MUCStanzaBuilder.createPresenceStanza(from, targetOccupant.getJid(),
                    presenceType, NamespaceURIs.XEP0045_MUC_USER, presenceItem, status);

            relayStanza(targetOccupant.getJid(), presenceToFormerMember, serverRuntimeContext);
        } else if(newAffiliation == Affiliation.Owner || newAffiliation == Affiliation.Admin) {
            if(moderator.getAffiliation() != Affiliation.Owner) {
                return MUCHandlerHelper.createErrorReply(stanza, StanzaErrorType.CANCEL,
                        StanzaErrorCondition.NOT_ALLOWED);
            }
        }
        room.getAffiliations().add(target, newAffiliation);
           

        if(targetOccupant != null) {
            MucUserItem presenceItem = new MucUserItem(newAffiliation, newRole);
            for (Occupant occupant : room.getOccupants()) {
                Stanza presenceToRemaining = MUCStanzaBuilder.createPresenceStanza(from, occupant.getJid(),
                        presenceType, NamespaceURIs.XEP0045_MUC_USER, presenceItem, status);

                relayStanza(occupant.getJid(), presenceToRemaining, serverRuntimeContext);
            }
        } else {
            room.getAffiliations().add(target, newAffiliation);
           
            MucUserItem presenceItem = new MucUserItem(target, null, newAffiliation, Role.None);
            for (Occupant occupant : room.getOccupants()) {
                StanzaBuilder builder = MUCStanzaBuilder.createMessageStanza(room.getJID(), occupant.getJid(), null, null);
                builder.addPreparedElement(presenceItem);

                relayStanza(occupant.getJid(), builder.build(), serverRuntimeContext);
View Full Code Here

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

        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),
                    // TODO handle <actor>
                    // TODO handle <reason>
                    status);

            relayStanza(target.getJid(), presenceToKicked, serverRuntimeContext);
        }

        PresenceStanzaType availType = (newRole == Role.None) ? PresenceStanzaType.UNAVAILABLE : null;

        // notify remaining users that user got role updated
        MucUserItem presenceItem = new MucUserItem(target.getAffiliation(), newRole);
        for (Occupant occupant : room.getOccupants()) {
            Stanza presenceToRemaining = MUCStanzaBuilder.createPresenceStanza(targetInRoom, occupant.getJid(),
                    availType, NamespaceURIs.XEP0045_MUC_USER, presenceItem, status);

            relayStanza(occupant.getJid(), presenceToRemaining, serverRuntimeContext);
View Full Code Here

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

        assertEquals(Role.Participant, room.findOccupantByNick("Nick 2").getRole());

        // verify that remaining users got presence
        assertPresenceStanza(new EntityImpl(ROOM2_JID, "Nick 2"), OCCUPANT2_JID, null,
                new MucUserItem(null, null, Affiliation.Member, Role.Participant), null, occupant2Queue.getNext());
        assertPresenceStanza(new EntityImpl(ROOM2_JID, "Nick 2"), OCCUPANT1_JID, null,
                new MucUserItem(null, null, Affiliation.Member, Role.Participant), null, occupant1Queue.getNext());
    }
View Full Code Here

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

        assertIqResultStanza(ROOM2_JID, OCCUPANT1_JID, "id1", result);

        assertEquals(Affiliation.None, room.getAffiliations().getAffiliation(OCCUPANT2_JID));

        // verify that remaining users got presence
        MucUserItem expectedMucPresenceItem = new MucUserItem(null, null, Affiliation.None, Role.None);
        assertPresenceStanza(new EntityImpl(ROOM2_JID, "Nick 2"), OCCUPANT2_JID, PresenceStanzaType.UNAVAILABLE,
                expectedMucPresenceItem, StatusCode.REMOVED_BY_AFFILIATION, occupant2Queue.getNext());
        assertPresenceStanza(new EntityImpl(ROOM2_JID, "Nick 2"), OCCUPANT1_JID, PresenceStanzaType.UNAVAILABLE,
                expectedMucPresenceItem, StatusCode.REMOVED_BY_AFFILIATION, occupant1Queue.getNext());
    }
View Full Code Here

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

        assertEquals(Affiliation.None, room.getAffiliations().getAffiliation(OCCUPANT2_JID));

        // verify that remaining users got message
        // must be sent from the room
        assertMessageStanza(ROOM2_JID, OCCUPANT1_JID,
                null, new MucUserItem(OCCUPANT2_JID, null, Affiliation.None, Role.None), occupant1Queue.getNext());
    }
View Full Code Here

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

        assertEquals(Affiliation.Admin, room.findOccupantByNick("Nick 2").getAffiliation());

        // verify that remaining users got presence
        assertPresenceStanza(new EntityImpl(ROOM2_JID, "Nick 2"), OCCUPANT2_JID, null,
                new MucUserItem(null, null, Affiliation.Admin, Role.Visitor), null, occupant2Queue.getNext());
        assertPresenceStanza(new EntityImpl(ROOM2_JID, "Nick 2"), OCCUPANT1_JID, null,
                new MucUserItem(null, null, Affiliation.Admin, Role.Visitor), null, occupant1Queue.getNext());
    }
View Full Code Here

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

        assertEquals(Affiliation.Admin, room.getAffiliations().getAffiliation(OCCUPANT2_JID));

        // verify that remaining users got presence
        // must be sent from the room
        assertMessageStanza(ROOM2_JID, OCCUPANT1_JID,
                null, new MucUserItem(OCCUPANT2_JID, null, Affiliation.Admin, Role.None), occupant1Queue.getNext());
    }
View Full Code Here

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

        assertEquals(Affiliation.Member, room.findOccupantByNick("Nick 2").getAffiliation());

        // verify that remaining users got presence
        assertPresenceStanza(new EntityImpl(ROOM2_JID, "Nick 2"), OCCUPANT2_JID, null,
                new MucUserItem(null, null, Affiliation.Member, Role.Visitor), null, occupant2Queue.getNext());
        assertPresenceStanza(new EntityImpl(ROOM2_JID, "Nick 2"), OCCUPANT1_JID, null,
                new MucUserItem(null, null, Affiliation.Member, Role.Visitor), null, occupant1Queue.getNext());
    }
View Full Code Here

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

        assertEquals(Affiliation.Member, room.getAffiliations().getAffiliation(OCCUPANT2_JID));

        // verify that remaining users got presence
        // must be sent from the room
        assertMessageStanza(ROOM2_JID, OCCUPANT1_JID,
                null, new MucUserItem(OCCUPANT2_JID, null, Affiliation.Member, Role.None), occupant1Queue.getNext());
    }
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.