%@ page contentType="text/html; charset=UTF-8" %>
<%--
-
- Copyright (C) 2004-2008 Jive Software, 2017-2025 Ignite Realtime Foundation. All rights reserved.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--%>
<%@ page import="org.jivesoftware.util.*,
org.jivesoftware.openfire.muc.MUCRoom,
java.util.*,
java.net.URLEncoder"
errorPage="error.jsp"
%>
<%@ page import="org.jivesoftware.openfire.muc.MultiUserChatService" %>
<%@ page import="org.xmpp.packet.JID" %>
<%@ page import="java.util.stream.Collectors" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="admin" uri="admin" %>
<% webManager.init(request, response, session, application, out ); %>
<% // Get parameters
String mucname = ParamUtils.getParameter(request,"mucname");
String roomJIDStr = ParamUtils.getParameter(request,"roomJID");
JID roomJID = null;
if (roomJIDStr != null) roomJID = new JID(roomJIDStr);
MultiUserChatService mucService = null;
if (roomJID != null) {
mucService = webManager.getMultiUserChatManager().getMultiUserChatService(roomJID);
}
else if (mucname != null && webManager.getMultiUserChatManager().isServiceRegistered(mucname)) {
mucService = webManager.getMultiUserChatManager().getMultiUserChatService(mucname);
}
else {
for (MultiUserChatService muc : webManager.getMultiUserChatManager().getMultiUserChatServices()) {
if (muc.isHidden()) {
// Private and hidden, skip it.
continue;
}
mucService = muc;
break;
}
}
if (mucService == null) {
// No services exist, so redirect to where one can configure the services
response.sendRedirect("muc-service-summary.jsp");
return;
}
// Get the rooms in the server
final List names = mucService.getAllRoomNames().stream()
.sorted(Comparator.comparing(String::toLowerCase))
.collect(Collectors.toList());
// paginator vars
final ListPager listPager = new ListPager<>(request, response, names, "mucname");
%>
<% // Print the list of rooms
if (listPager.getTotalItemCount() < 1) {
%>
<%
}
final List itemsOnCurrentPage = listPager.getItemsOnCurrentPage();
int i = listPager.getFirstItemNumberOnPage();
for(String name : itemsOnCurrentPage) {
MUCRoom room = mucService.getChatRoom(name); // This will load the room on-demand if it's not yet in memory.
i++;
%>