use of org.jivesoftware.openfire.muc.cluster.GetNewMemberRoomsRequest in project Openfire by igniterealtime.
the class MultiUserChatManager method joinedCluster.
@Override
@SuppressWarnings("unchecked")
public void joinedCluster(byte[] nodeID) {
Object result = CacheFactory.doSynchronousClusterTask(new GetNewMemberRoomsRequest(), nodeID);
if (result instanceof List<?>) {
List<RoomInfo> rooms = (List<RoomInfo>) result;
for (RoomInfo roomInfo : rooms) {
LocalMUCRoom remoteRoom = roomInfo.getRoom();
MultiUserChatServiceImpl service = (MultiUserChatServiceImpl) remoteRoom.getMUCService();
LocalMUCRoom localRoom = service.getLocalChatRoom(remoteRoom.getName());
if (localRoom == null) {
// Create local room with remote information
localRoom = remoteRoom;
service.chatRoomAdded(localRoom);
}
// Add remote occupants to local room
for (OccupantAddedEvent event : roomInfo.getOccupants()) {
event.setSendPresence(true);
event.run();
}
}
}
}
Aggregations