@Override public int compare(MultiUserChatService o1, MultiUserChatService o2) { return o1.getServiceName().compareTo(o2.getServiceName()); } }
/** * Sets if a system administrator of the MUC service can join a * password-protected room, without supplying the password. * * @param isRequired false if a sysadmin is allowed to join a password-protected room without a password, otherwise true. */ default void setPasswordRequiredForSysadminsToJoinRoom(boolean isRequired) { MUCPersistenceManager.setProperty( getServiceName(), "sysadmin.requires.room.passwords", Boolean.toString(isRequired) ); }
/** * Registers a new MultiUserChatService implementation to the manager. * This is typically used if you have a custom MUC implementation that you * want to register with the manager. In other words, it may not be database * stored and may follow special rules, implementating MultiUserChatService. * It is also used internally to register services from the database. Triggers * the service to start up. * * @param service The MultiUserChatService to be registered. */ public void registerMultiUserChatService(MultiUserChatService service) { Log.debug("MultiUserChatManager: Registering MUC service "+service.getServiceName()); try { ComponentManagerFactory.getComponentManager().addComponent(service.getServiceName(), service); mucServices.put(service.getServiceName(), service); } catch (ComponentException e) { Log.error("MultiUserChatManager: Unable to add "+service.getServiceName()+" as component.", e); } }
/** * Returns true when a system administrator of the MUC service can join a * password-protected room, without supplying the password. * * @return false if a sysadmin can join a password-protected room without a password, otherwise true. */ default boolean isPasswordRequiredForSysadminsToJoinRoom() { return MUCPersistenceManager.getBooleanProperty( getServiceName(), "sysadmin.requires.room.passwords", false ); }
protected MUCRoomTask(LocalMUCRoom room) { this.roomName = room.getName(); this.subdomain = room.getMUCService().getServiceName(); }
this.modificationDate = new Date(startTime); this.emptyDate = new Date(startTime); this.canOccupantsChangeSubject = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.canOccupantsChangeSubject", false); this.maxUsers = MUCPersistenceManager.getIntProperty(mucService.getServiceName(), "room.maxUsers", 30); this.publicRoom = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.publicRoom", true); this.persistent = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.persistent", false); this.moderated = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.moderated", false); this.membersOnly = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.membersOnly", false); this.canOccupantsInvite = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.canOccupantsInvite", false); this.canAnyoneDiscoverJID = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.canAnyoneDiscoverJID", true); this.logEnabled = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.logEnabled", true); this.loginRestrictedToNickname = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.loginRestrictedToNickname", false); this.canChangeNickname = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.canChangeNickname", true); this.registrationEnabled = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.registrationEnabled", true);
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())); } } }
/** * Checks if the room may be included in search results. This is almost * identical to {@link MultiUserChatServiceImpl#canDiscoverRoom(org.jivesoftware.openfire.muc.MUCRoom, org.xmpp.packet.JID)}, * but that method is private and cannot be re-used here. * * @param room * The room to check * @return ''true'' if the room may be included in search results, ''false'' * otherwise. */ private static boolean canBeIncludedInResult(MUCRoom room) { // Check if locked rooms may be discovered final boolean discoverLocked = MUCPersistenceManager.getBooleanProperty(room.getMUCService().getServiceName(), "discover.locked", true); if (!discoverLocked && room.isLocked()) { return false; } return room.isPublicRoom(); } }
Long serviceID = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatServiceID(chatserver.getServiceName());
pstmt.setLong(1, XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatServiceID(room.getMUCService().getServiceName())); pstmt.setLong(2, room.getID()); pstmt.setString(3, StringUtils.dateToMillis(room.getCreationDate()));
ResultSet rs = null; try { Long serviceID = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatServiceID(room.getMUCService().getServiceName()); con = DbConnectionManager.getConnection(); pstmt = con.prepareStatement(LOAD_ROOM);
/** * Called when manager is stopped, to clean things up. */ @Override public void stop() { super.stop(); ClusterManager.removeListener(this); UserEventDispatcher.removeListener(this); // Remove the statistics. StatisticsManager.getInstance().removeStatistic(roomsStatKey); StatisticsManager.getInstance().removeStatistic(occupantsStatKey); StatisticsManager.getInstance().removeStatistic(usersStatKey); StatisticsManager.getInstance().removeStatistic(incomingStatKey); StatisticsManager.getInstance().removeStatistic(outgoingStatKey); for (MultiUserChatService service : mucServices.values()) { unregisterMultiUserChatService(service.getServiceName()); } }
ExternalizableUtil.getInstance().writeSafeUTF(out, mucService.getServiceName());
@Override public int compare(MultiUserChatService o1, MultiUserChatService o2) { return o1.getServiceName().compareTo(o2.getServiceName()); } }
/** * Registers a new MultiUserChatService implementation to the manager. * This is typically used if you have a custom MUC implementation that you * want to register with the manager. In other words, it may not be database * stored and may follow special rules, implementating MultiUserChatService. * It is also used internally to register services from the database. Triggers * the service to start up. * * @param service The MultiUserChatService to be registered. */ public void registerMultiUserChatService(MultiUserChatService service) { Log.debug("MultiUserChatManager: Registering MUC service "+service.getServiceName()); try { ComponentManagerFactory.getComponentManager().addComponent(service.getServiceName(), service); mucServices.put(service.getServiceName(), service); } catch (ComponentException e) { Log.error("MultiUserChatManager: Unable to add "+service.getServiceName()+" as component.", e); } }
protected MUCRoomTask(LocalMUCRoom room) { this.roomName = room.getName(); this.subdomain = room.getMUCService().getServiceName(); }
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())); } } }
/** * Checks if the room may be included in search results. This is almost * identical to {@link MultiUserChatServiceImpl#canDiscoverRoom(org.jivesoftware.openfire.muc.MUCRoom, org.xmpp.packet.JID)}, * but that method is private and cannot be re-used here. * * @param room * The room to check * @return ''true'' if the room may be included in search results, ''false'' * otherwise. */ private static boolean canBeIncludedInResult(MUCRoom room) { // Check if locked rooms may be discovered final boolean discoverLocked = MUCPersistenceManager.getBooleanProperty(room.getMUCService().getServiceName(), "discover.locked", true); if (!discoverLocked && room.isLocked()) { return false; } return room.isPublicRoom(); } }
/** * Called when manager is stopped, to clean things up. */ @Override public void stop() { super.stop(); ClusterManager.removeListener(this); UserEventDispatcher.removeListener(this); // Remove the statistics. StatisticsManager.getInstance().removeStatistic(roomsStatKey); StatisticsManager.getInstance().removeStatistic(occupantsStatKey); StatisticsManager.getInstance().removeStatistic(usersStatKey); StatisticsManager.getInstance().removeStatistic(incomingStatKey); StatisticsManager.getInstance().removeStatistic(outgoingStatKey); for (MultiUserChatService service : mucServices.values()) { unregisterMultiUserChatService(service.getServiceName()); } }
ExternalizableUtil.getInstance().writeSafeUTF(out, mucService.getServiceName());