public ServiceInfo(MultiUserChatService service) { this.subdomain = service.getServiceName(); this.description = service.getDescription(); this.isHidden = service.isHidden(); rooms = new ArrayList<>(); // Get rooms that have occupants and include them in the reply for (MUCRoom room : service.getChatRooms()) { LocalMUCRoom localRoom = (LocalMUCRoom) room; if (!room.getOccupants().isEmpty()) { rooms.add(new RoomInfo(localRoom, localRoom.getOccupants())); } } }
@Override public void run() { rooms = new ArrayList<>(); // Get all services that have local occupants and include them in the reply for (MultiUserChatService mucService : XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatServices()) { // Get rooms that have local occupants and include them in the reply for (MUCRoom room : mucService.getChatRooms()) { LocalMUCRoom localRoom = (LocalMUCRoom) room; Collection<MUCRole> localOccupants = new ArrayList<>(); for (MUCRole occupant : room.getOccupants()) { if (occupant.isLocal()) { localOccupants.add(occupant); } } if (!localOccupants.isEmpty()) { rooms.add(new RoomInfo(localRoom, localOccupants)); } } } }
@Override public void leftCluster(byte[] nodeID) { // Remove all room occupants linked to the defunct node as their sessions are cleaned out earlier Log.debug("Removing orphaned occupants associated with defunct node: " + new String(nodeID, StandardCharsets.UTF_8)); for (MultiUserChatService service : getMultiUserChatServices()) { for (MUCRoom mucRoom : service.getChatRooms()) { for (MUCRole mucRole : mucRoom.getOccupants()) { if (mucRole.getNodeID().equals(nodeID)) { mucRoom.leaveRoom(mucRole); } } } } }
for (MUCRoom room : mucService.getChatRooms())
public ServiceInfo(MultiUserChatService service) { this.subdomain = service.getServiceName(); this.description = service.getDescription(); this.isHidden = service.isHidden(); rooms = new ArrayList<>(); // Get rooms that have occupants and include them in the reply for (MUCRoom room : service.getChatRooms()) { LocalMUCRoom localRoom = (LocalMUCRoom) room; if (!room.getOccupants().isEmpty()) { rooms.add(new RoomInfo(localRoom, localRoom.getOccupants())); } } }
@Override public void leftCluster(byte[] nodeID) { // Remove all room occupants linked to the defunct node as their sessions are cleaned out earlier Log.debug("Removing orphaned occupants associated with defunct node: " + new String(nodeID, StandardCharsets.UTF_8)); for (MultiUserChatService service : getMultiUserChatServices()) { for (MUCRoom mucRoom : service.getChatRooms()) { for (MUCRole mucRole : mucRoom.getOccupants()) { if (mucRole.getNodeID().equals(nodeID)) { mucRoom.leaveRoom(mucRole); } } } } }
@Override public void run() { rooms = new ArrayList<>(); // Get all services that have local occupants and include them in the reply for (MultiUserChatService mucService : XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatServices()) { // Get rooms that have local occupants and include them in the reply for (MUCRoom room : mucService.getChatRooms()) { LocalMUCRoom localRoom = (LocalMUCRoom) room; Collection<MUCRole> localOccupants = new ArrayList<>(); for (MUCRole occupant : room.getOccupants()) { if (occupant.isLocal()) { localOccupants.add(occupant); } } if (!localOccupants.isEmpty()) { rooms.add(new RoomInfo(localRoom, localOccupants)); } } } }
for (MUCRoom room : mucService.getChatRooms())