Search in sources :

Example 6 with LocalMUCRoom

use of org.jivesoftware.openfire.muc.spi.LocalMUCRoom 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();
            }
        }
    }
}
Also used : LocalMUCRoom(org.jivesoftware.openfire.muc.spi.LocalMUCRoom) MultiUserChatServiceImpl(org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl) RoomInfo(org.jivesoftware.openfire.muc.cluster.RoomInfo) ArrayList(java.util.ArrayList) List(java.util.List) OccupantAddedEvent(org.jivesoftware.openfire.muc.cluster.OccupantAddedEvent) GetNewMemberRoomsRequest(org.jivesoftware.openfire.muc.cluster.GetNewMemberRoomsRequest)

Example 7 with LocalMUCRoom

use of org.jivesoftware.openfire.muc.spi.LocalMUCRoom in project Openfire by igniterealtime.

the class RoomAvailableEvent method readExternal.

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    room = new LocalMUCRoom();
    room.readExternal(in);
}
Also used : LocalMUCRoom(org.jivesoftware.openfire.muc.spi.LocalMUCRoom)

Example 8 with LocalMUCRoom

use of org.jivesoftware.openfire.muc.spi.LocalMUCRoom in project Openfire by igniterealtime.

the class RoomRemovedEvent method readExternal.

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    room = new LocalMUCRoom();
    room.readExternal(in);
}
Also used : LocalMUCRoom(org.jivesoftware.openfire.muc.spi.LocalMUCRoom)

Aggregations

LocalMUCRoom (org.jivesoftware.openfire.muc.spi.LocalMUCRoom)8 ArrayList (java.util.ArrayList)4 List (java.util.List)2 MUCRoom (org.jivesoftware.openfire.muc.MUCRoom)2 MultiUserChatService (org.jivesoftware.openfire.muc.MultiUserChatService)2 OccupantAddedEvent (org.jivesoftware.openfire.muc.cluster.OccupantAddedEvent)2 RoomInfo (org.jivesoftware.openfire.muc.cluster.RoomInfo)2 MultiUserChatServiceImpl (org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl)2 Date (java.util.Date)1 MUCRole (org.jivesoftware.openfire.muc.MUCRole)1 GetNewMemberRoomsRequest (org.jivesoftware.openfire.muc.cluster.GetNewMemberRoomsRequest)1 RoomUpdatedEvent (org.jivesoftware.openfire.muc.cluster.RoomUpdatedEvent)1 SeniorMemberServicesRequest (org.jivesoftware.openfire.muc.cluster.SeniorMemberServicesRequest)1 ServiceInfo (org.jivesoftware.openfire.muc.cluster.ServiceInfo)1 JID (org.xmpp.packet.JID)1