use of org.jivesoftware.openfire.entity.MUCRoomEntity in project Openfire by igniterealtime.
the class MUCRoomController method getChatRoom.
/**
* Gets the chat room.
*
* @param roomName
* the room name
* @param serviceName
* the service name
* @return the chat room
* @throws MUCServiceException
* the MUC service exception
*/
public MUCRoomEntity getChatRoom(String roomName, String serviceName) throws MUCServiceException {
MUCRoom chatRoom = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(serviceName).getChatRoom(roomName);
if (chatRoom == null) {
throw new MUCServiceException("Could not fetch the channel", roomName, "Chat room could be not found");
}
MUCRoomEntity mucRoomEntity = convertToMUCRoomEntity(chatRoom);
return mucRoomEntity;
}
use of org.jivesoftware.openfire.entity.MUCRoomEntity in project Openfire by igniterealtime.
the class MUCRoomController method convertToMUCRoomEntity.
/**
* Convert to MUC room entity.
*
* @param room
* the room
* @return the MUC room entity
*/
public MUCRoomEntity convertToMUCRoomEntity(MUCRoom room) {
MUCRoomEntity mucRoomEntity = new MUCRoomEntity(room.getNaturalLanguageName(), room.getName(), room.getDescription());
mucRoomEntity.setCanAnyoneDiscoverJID(room.canAnyoneDiscoverJID());
mucRoomEntity.setCanChangeNickname(room.canChangeNickname());
mucRoomEntity.setCanOccupantsChangeSubject(room.canOccupantsChangeSubject());
mucRoomEntity.setCanOccupantsInvite(room.canOccupantsInvite());
mucRoomEntity.setPublicRoom(room.isPublicRoom());
mucRoomEntity.setPassword(room.getPassword());
mucRoomEntity.setPersistent(room.isPersistent());
mucRoomEntity.setRegistrationEnabled(room.isRegistrationEnabled());
mucRoomEntity.setLogEnabled(room.isLogEnabled());
mucRoomEntity.setLoginRestrictedToNickname(room.isLoginRestrictedToNickname());
mucRoomEntity.setMaxUsers(room.getMaxUsers());
mucRoomEntity.setMembersOnly(room.isMembersOnly());
mucRoomEntity.setModerated(room.isModerated());
mucRoomEntity.setOwners(MUCRoomUtils.convertJIDsToStringList(room.getOwners()));
mucRoomEntity.setAdmins(MUCRoomUtils.convertJIDsToStringList(room.getAdmins()));
mucRoomEntity.setMembers(MUCRoomUtils.convertJIDsToStringList(room.getMembers()));
mucRoomEntity.setOutcasts(MUCRoomUtils.convertJIDsToStringList(room.getOutcasts()));
mucRoomEntity.setBroadcastPresenceRoles(room.getRolesToBroadcastPresence());
mucRoomEntity.setCreationDate(room.getCreationDate());
mucRoomEntity.setModificationDate(room.getModificationDate());
return mucRoomEntity;
}
use of org.jivesoftware.openfire.entity.MUCRoomEntity 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) {
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));
} else if (channelType.equals(MUCChannelType.PUBLIC) && chatRoom.isPublicRoom()) {
mucRoomEntities.add(convertToMUCRoomEntity(chatRoom));
}
}
return new MUCRoomEntities(mucRoomEntities);
}
Aggregations