<%-- - $Revision$ - $Date$ - - Copyright (C) 2004-2008 Jive Software. 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.openfire.PresenceManager, org.jivesoftware.openfire.SessionManager, org.jivesoftware.openfire.session.ClientSession, org.jivesoftware.openfire.user.User, org.jivesoftware.openfire.user.UserManager, org.jivesoftware.util.JiveGlobals, org.jivesoftware.util.ParamUtils, java.text.NumberFormat, java.util.Collection" errorPage="error.jsp" %> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> <% webManager.init(request, response, session, application, out ); %> <% // Get parameters String jid = ParamUtils.getParameter(request, "jid"); // Handle a "go back" click: if (request.getParameter("back") != null) { response.sendRedirect("session-summary.jsp"); return; } // Get the session & address objects SessionManager sessionManager = webManager.getSessionManager(); JID address = new JID(jid); org.jivesoftware.openfire.session.ClientSession currentSess = sessionManager.getSession(address); boolean isAnonymous = webManager.getXMPPServer().isLocal(address) && !UserManager.getInstance().isRegisteredUser(address.getNode()); // No current session found if (currentSess == null) { response.sendRedirect("session-summary.jsp"); return; } // Get a presence manager PresenceManager presenceManager = webManager.getPresenceManager(); // Get user object User user = null; if (!isAnonymous) { user = webManager.getUserManager().getUser(address.getNode()); } // Handle a "message" click: if (request.getParameter("message") != null) { response.sendRedirect("user-message.jsp?username=" + URLEncoder.encode(user.getUsername(), "UTF-8")); return; } // See if there are multiple sessions for this user: Collection sessions = null; int sessionCount = sessionManager.getSessionCount(address.getNode()); if (!isAnonymous && sessionCount > 1) { sessions = sessionManager.getSessions(address.getNode()); } // Number dateFormatter for all numbers on this page: NumberFormat numFormatter = NumberFormat.getNumberInstance(); %> <fmt:message key="session.details.title"/>

" + StringUtils.escapeForXML(address.toString()) + "" %>" /> "+address.getNode()+"" %>" />

<%= StringUtils.escapeForXML(address.toString()) %>
<% String n = address.getNode(); %> <% if (isAnonymous) { %> - <%= address.getResource()==null?"":StringUtils.escapeForXML(address.getResource()) %> <% } else { %> "><%= JID.unescapeNode(n) %> - <%= address.getResource()==null?"":StringUtils.escapeForXML(address.getResource()) %> <% } %>
: <% int status = currentSess.getStatus(); if (status == Session.STATUS_CLOSED) { %> <% } else if (status == Session.STATUS_CONNECTED) { %> <% } else if (status == Session.STATUS_AUTHENTICATED) { %> <% } else { %> <% } %>
: <% Presence.Show show = currentSess.getPresence().getShow(); String statusTxt = currentSess.getPresence().getStatus(); if (statusTxt != null) { statusTxt = " -- " + StringUtils.escapeForXML(statusTxt); } else { statusTxt = ""; } if (!currentSess.getPresence().isAvailable()) { %> " alt=""> <% } else if (show == Presence.Show.away) { %> " alt=""> <%= statusTxt %> <% } else if (show == Presence.Show.chat) { %> " alt=""> <%= statusTxt %> <% } else if (show == Presence.Show.dnd) { %> " alt=""> <%= statusTxt %> <% } else if (show == null) { %> " alt=""> <%= statusTxt %> <% } else if (show == Presence.Show.xa) { %> " alt=""> <%= statusTxt %> <% } else { %> <% } %>
<%= currentSess.getPresence().getPriority() %>
<%= JiveGlobals.formatDateTime(currentSess.getCreationDate()) %>
<%= JiveGlobals.formatDateTime(currentSess.getLastActiveDate()) %>
<%= numFormatter.format(currentSess.getNumClientPackets()) %>/<%= numFormatter.format(currentSess.getNumServerPackets()) %>
<%= currentSess.getHostAddress() %> / <%= currentSess.getHostName() %>
<% // Show a list of multiple user sessions if there is more than 1 session: if (sessionCount > 1) { %>

<% int count = 0; String linkURL = "session-details.jsp"; for (ClientSession sess : sessions) { count++; boolean current = sess.getAddress().equals(address); %> <%@ include file="session-row.jspf" %> <% } %>
 

  =
<% } %>
">
<%--<% if (!isAnonymous && presenceManager.isAvailable(user)) { %>--%> <%----%> <%-- --%> <%----%> <%--<% } %>--%> ">