roomManager.addRoomChatChangedHandler(this);
}
@Override
public void onRoomChatChanged(final RoomChatChangedEvent event) {
final RoomChat room = event.getChat();
if (event.is(ChangeType.created)) {
room.addOccupantChangedHandler(new OccupantChangedEvent.Handler() {
@Override
public void onOccupantChanged(final OccupantChangedEvent event) {
display.print("ROOM OCCUPANT " + event.getOccupant().getNick() + " changed: " + event.getChangeType(), Style.event);
String occupants = "";
for (final Occupant occupant : room.getOccupants()) {
occupants += occupant.getOccupantUri().getResource() + " ";
}
display.print("ROOM OCCUPANTS (" + room.getOccupantsCount() + "): " + occupants, Style.event);
}
});
room.addPresenceReceivedHandler(new PresenceReceivedEvent.Handler() {
@Override
public void onPresenceReceived(final PresenceReceivedEvent event) {
display.print("ROOM PRESENCE : " + event.getPresence(), Style.event);
}
});