Search in sources :

Example 1 with ParticipantEntities

use of org.jivesoftware.openfire.entity.ParticipantEntities 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

ArrayList (java.util.ArrayList)1 ParticipantEntities (org.jivesoftware.openfire.entity.ParticipantEntities)1 ParticipantEntity (org.jivesoftware.openfire.entity.ParticipantEntity)1 MUCRole (org.jivesoftware.openfire.muc.MUCRole)1