Search in sources :

Example 1 with MUCRoomEntities

use of org.jivesoftware.openfire.plugin.rest.entity.MUCRoomEntities in project Openfire by igniterealtime.

the class MUCRoomController method getChatRooms.

/**
	 * Gets the chat rooms.
	 * 
	 * @param serviceName
	 *            the service name
	 * @param channelType
	 *            the channel type
	 * @param roomSearch
	 *            the room search
	 * @return the chat rooms
	 */
public MUCRoomEntities getChatRooms(String serviceName, String channelType, String roomSearch, boolean expand) {
    List<MUCRoom> rooms = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(serviceName).getChatRooms();
    List<MUCRoomEntity> mucRoomEntities = new ArrayList<MUCRoomEntity>();
    for (MUCRoom chatRoom : rooms) {
        if (roomSearch != null) {
            if (!chatRoom.getName().contains(roomSearch)) {
                continue;
            }
        }
        if (channelType.equals(MUCChannelType.ALL)) {
            mucRoomEntities.add(convertToMUCRoomEntity(chatRoom, expand));
        } else if (channelType.equals(MUCChannelType.PUBLIC) && chatRoom.isPublicRoom()) {
            mucRoomEntities.add(convertToMUCRoomEntity(chatRoom, expand));
        }
    }
    return new MUCRoomEntities(mucRoomEntities);
}
Also used : LocalMUCRoom(org.jivesoftware.openfire.muc.spi.LocalMUCRoom) MUCRoom(org.jivesoftware.openfire.muc.MUCRoom) MUCRoomEntity(org.jivesoftware.openfire.plugin.rest.entity.MUCRoomEntity) ArrayList(java.util.ArrayList) MUCRoomEntities(org.jivesoftware.openfire.plugin.rest.entity.MUCRoomEntities)

Aggregations

ArrayList (java.util.ArrayList)1 MUCRoom (org.jivesoftware.openfire.muc.MUCRoom)1 LocalMUCRoom (org.jivesoftware.openfire.muc.spi.LocalMUCRoom)1 MUCRoomEntities (org.jivesoftware.openfire.plugin.rest.entity.MUCRoomEntities)1 MUCRoomEntity (org.jivesoftware.openfire.plugin.rest.entity.MUCRoomEntity)1