use of org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl in project Openfire by igniterealtime.
the class MultiUserChatManager method createMultiUserChatService.
/**
* Creates a new MUC service and registers it with the manager, and starts up the service.
*
* @param subdomain Subdomain of the MUC service.
* @param description Description of the MUC service (can be null for default description)
* @param isHidden True if the service is hidden from view in services lists.
* @return MultiUserChatService implementation that was just created.
* @throws AlreadyExistsException if the service already exists.
*/
public MultiUserChatServiceImpl createMultiUserChatService(String subdomain, String description, Boolean isHidden) throws AlreadyExistsException {
if (getMultiUserChatServiceID(subdomain) != null)
throw new AlreadyExistsException();
MultiUserChatServiceImpl muc = new MultiUserChatServiceImpl(subdomain, description, isHidden);
insertService(subdomain, description, isHidden);
registerMultiUserChatService(muc);
return muc;
}
use of org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl 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();
}
}
}
}
use of org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl in project Openfire by igniterealtime.
the class MultiUserChatManager method loadServices.
/**
* Loads the list of configured services stored in the database.
*/
private void loadServices() {
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_SERVICES);
rs = pstmt.executeQuery();
while (rs.next()) {
String subdomain = rs.getString(1);
String description = rs.getString(2);
Boolean isHidden = Boolean.valueOf(rs.getString(3));
MultiUserChatServiceImpl muc = new MultiUserChatServiceImpl(subdomain, description, isHidden);
mucServices.put(subdomain, muc);
}
} catch (Exception e) {
Log.error(e.getMessage(), e);
} finally {
DbConnectionManager.closeConnection(rs, pstmt, con);
}
}
use of org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl in project Openfire by igniterealtime.
the class ServiceAddedEvent method run.
@Override
public void run() {
// should really never occur.
if (!XMPPServer.getInstance().getMultiUserChatManager().isServiceRegistered(subdomain)) {
MultiUserChatService service = new MultiUserChatServiceImpl(subdomain, description, isHidden);
XMPPServer.getInstance().getMultiUserChatManager().registerMultiUserChatService(service);
}
}
Aggregations