Search in sources :

Example 31 with MUCRole

use of org.jivesoftware.openfire.muc.MUCRole in project Openfire by igniterealtime.

the class MUCRoomController method getRoomParticipants.

/**
	 * Gets the room participants.
	 *
	 * @param roomName
	 *            the room name
	 * @param serviceName
	 *            the service name
	 * @return the room participants
	 */
public ParticipantEntities getRoomParticipants(String roomName, String serviceName) {
    ParticipantEntities participantEntities = new ParticipantEntities();
    List<ParticipantEntity> participants = new ArrayList<ParticipantEntity>();
    Collection<MUCRole> serverParticipants = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(serviceName).getChatRoom(roomName).getParticipants();
    for (MUCRole role : serverParticipants) {
        ParticipantEntity participantEntity = new ParticipantEntity();
        participantEntity.setJid(role.getRoleAddress().toFullJID());
        participantEntity.setRole(role.getRole().name());
        participantEntity.setAffiliation(role.getAffiliation().name());
        participants.add(participantEntity);
    }
    participantEntities.setParticipants(participants);
    return participantEntities;
}
Also used : MUCRole(org.jivesoftware.openfire.muc.MUCRole) ParticipantEntity(org.jivesoftware.openfire.entity.ParticipantEntity) ParticipantEntities(org.jivesoftware.openfire.entity.ParticipantEntities) ArrayList(java.util.ArrayList)

Aggregations

MUCRole (org.jivesoftware.openfire.muc.MUCRole)31 GroupJID (org.jivesoftware.openfire.group.GroupJID)15 JID (org.xmpp.packet.JID)14 ArrayList (java.util.ArrayList)10 Presence (org.xmpp.packet.Presence)10 Element (org.dom4j.Element)9 ForbiddenException (org.jivesoftware.openfire.muc.ForbiddenException)9 UpdatePresence (org.jivesoftware.openfire.muc.cluster.UpdatePresence)9 NotAllowedException (org.jivesoftware.openfire.muc.NotAllowedException)8 ConflictException (org.jivesoftware.openfire.muc.ConflictException)6 UserNotFoundException (org.jivesoftware.openfire.user.UserNotFoundException)6 GroupNotFoundException (org.jivesoftware.openfire.group.GroupNotFoundException)5 AddAffiliation (org.jivesoftware.openfire.muc.cluster.AddAffiliation)4 UpdateOccupant (org.jivesoftware.openfire.muc.cluster.UpdateOccupant)3 NotFoundException (org.jivesoftware.util.NotFoundException)3 Message (org.xmpp.packet.Message)3 IOException (java.io.IOException)2 UnauthorizedException (org.jivesoftware.openfire.auth.UnauthorizedException)2 Group (org.jivesoftware.openfire.group.Group)2 CannotBeInvitedException (org.jivesoftware.openfire.muc.CannotBeInvitedException)2