Index: src/web/gateway-registrations.jsp
===================================================================
--- src/web/gateway-registrations.jsp	(revision 9641)
+++ src/web/gateway-registrations.jsp	(working copy)
@@ -10,11 +10,16 @@
 %>
 <%@ page contentType="text/html;charset=UTF-8" %>
 <%@ page import="org.jivesoftware.openfire.gateway.session.cluster.TransportSessionRouter" %>
+<%@ page import="org.jivesoftware.openfire.gateway.BaseTransport" %>
+<%@ page import="org.jivesoftware.openfire.gateway.TransportInstance" %>
+<%@ page import="org.jivesoftware.openfire.gateway.session.TransportSession" %>
+<%@ page import="org.jivesoftware.openfire.gateway.session.TransportSessionManager" %>
 <%@ page import="org.jivesoftware.openfire.session.ClientSession" %>
 <%@ page import="org.jivesoftware.util.LocaleUtils" %>
 <%@ page import="org.jivesoftware.util.ParamUtils" %>
 <%@ page import="org.xmpp.packet.JID" %>
 <%@ page import="org.xmpp.packet.Presence" %>
+<%@ page import="java.util.concurrent.ConcurrentHashMap" %>
 <%@ page import="java.util.*" %>
 
 <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
@@ -38,8 +43,6 @@
 
     webManager.init(request, response, session, application, out);
 
-    Collection<Registration> registrations = RegistrationManager.getInstance().getRegistrations();
-
     // Get the user manager
     SessionManager sessionManager = webManager.getSessionManager();
 
@@ -137,76 +140,118 @@
             }
         }
     }
+    
     int resCount = 0;
-    for (Registration registration : registrations) {
-        regResult res = new regResult();
-        res.id = registration.getRegistrationID();
-        res.jid = registration.getJID();
-        if (filtervars.containsKey("filterUser") && !(filtervars.get("filterUser").equalsIgnoreCase(res.jid.toString()) || filtervars.get("filterUser").equalsIgnoreCase(res.jid.getNode()))) {
-            continue;
-        }
-        res.username = registration.getUsername();
-        if (filtervars.containsKey("filterLegacyUsername") && !filtervars.get("filterLegacyUsername").equalsIgnoreCase(res.username)) {
-            continue;
-        }
-        res.nickname = registration.getNickname();
-        res.type = registration.getTransportType().toString();
-        if (!filteropts.contains(res.type)) {
-            continue;
-        }
+    if (filteropts.contains("signedon")) {
+        for (String transportName : plugin.getTransports()) {
+            if (filteropts.contains(transportName)) {
+                TransportInstance trInstance = plugin.getTransportInstance(transportName);
+                if (trInstance != null) {
+                    BaseTransport transport = trInstance.getTransport();
+                    if (transport != null) {
+                        Collection<TransportSession> trSessions =  transport.getSessionManager().getSessions();
+                        for (TransportSession trSession : trSessions) {
+                            Registration registration = trSession.getRegistration();
+                            regResult res = new regResult();
+                            res.id = registration.getRegistrationID();
+                            res.jid = registration.getJID();
+                            if (filtervars.containsKey("filterUser") && !(filtervars.get("filterUser").equalsIgnoreCase(res.jid.toString()) || filtervars.get("filterUser").equalsIgnoreCase(res.jid.getNode()))) {
+                                continue;
+                            }
+                            res.username = registration.getUsername();
+                            if (filtervars.containsKey("filterLegacyUsername") && !filtervars.get("filterLegacyUsername").equalsIgnoreCase(res.username)) {
+                                continue;
+                            }
+                            res.nickname = registration.getNickname();
+                            res.type = registration.getTransportType().toString();
+                            res.sessionActive = trSession.isLoggedIn();
+                            res.status = trSession.getPresence().toString();
+                            res.linestatus = "online";
+                            
+                            Date lastLogin = registration.getLastLogin();
+                            res.lastLogin = ((lastLogin != null) ? lastLogin.toString() : "<i>" + LocaleUtils.getLocalizedString("gateway.web.registrations.never", "gateway") + "</i>");
 
-        res.sessionActive = false;
-        byte[] nodeID = sessionRouter.getSession(res.type, res.jid.toBareJID());
-        if (nodeID != null) {
-            if (Arrays.equals(thisNode, nodeID)) {
-                res.clusterNode = LocaleUtils.getLocalizedString("gateway.web.registrations.local", "gateway");
+                            resCount++;
+                            regResults.add(res);
+                        }
+                    }
+                }
             }
-            else {
-                res.clusterNode = nodeIDToName.get(NodeID.getInstance(nodeID));
+        }     
+    } else {
+        
+        Collection<Registration> registrations = RegistrationManager.getInstance().getRegistrations();
+    
+        for (Registration registration : registrations) {
+            regResult res = new regResult();
+            res.id = registration.getRegistrationID();
+            res.jid = registration.getJID();
+            if (filtervars.containsKey("filterUser") && !(filtervars.get("filterUser").equalsIgnoreCase(res.jid.toString()) || filtervars.get("filterUser").equalsIgnoreCase(res.jid.getNode()))) {
+                continue;
             }
-            res.sessionActive = true;
-        }
+            res.username = registration.getUsername();
+            if (filtervars.containsKey("filterLegacyUsername") && !filtervars.get("filterLegacyUsername").equalsIgnoreCase(res.username)) {
+                continue;
+            }
+            res.nickname = registration.getNickname();
+            res.type = registration.getTransportType().toString();
+            if (!filteropts.contains(res.type)) {
+                continue;
+            }
 
-        if (!res.sessionActive && filteropts.contains("signedon")) {
-            continue;
-        }
+            res.sessionActive = false;
+            byte[] nodeID = sessionRouter.getSession(res.type, res.jid.toBareJID());
+            if (nodeID != null) {
+                if (Arrays.equals(thisNode, nodeID)) {
+                    res.clusterNode = LocaleUtils.getLocalizedString("gateway.web.registrations.local", "gateway");
+                }
+                else {
+                    res.clusterNode = nodeIDToName.get(NodeID.getInstance(nodeID));
+                }
+                res.sessionActive = true;
+            }
 
-        try {
-            ClientSession clientSession = (ClientSession) sessionManager.getSessions(res.jid.getNode()).toArray()[0];
-            if (clientSession != null) {
-                Presence presence = clientSession.getPresence();
-                if (presence == null) {
-                    // not logged in, leave alone
-                } else if (presence.getShow() == Presence.Show.xa) {
-                    res.status = "away";
-                    res.linestatus = "online";
-                } else if (presence.getShow() == Presence.Show.away) {
-                    res.status = "away";
-                    res.linestatus = "online";
-                } else if (presence.getShow() == Presence.Show.chat) {
-                    res.status = "free_chat";
-                    res.linestatus = "online";
-                } else if (presence.getShow() == Presence.Show.dnd) {
-                    res.status = "dnd";
-                    res.linestatus = "online";
-                } else if (presence.isAvailable()) {
-                    res.status = "available";
-                    res.linestatus = "online";
+            if (!res.sessionActive && filteropts.contains("signedon")) {
+                continue;
+            }
+
+            try {
+                ClientSession clientSession = (ClientSession) sessionManager.getSessions(res.jid.getNode()).toArray()[0];
+                if (clientSession != null) {
+                    Presence presence = clientSession.getPresence();
+                    if (presence == null) {
+                        // not logged in, leave alone
+                    } else if (presence.getShow() == Presence.Show.xa) {
+                        res.status = "away";
+                        res.linestatus = "online";
+                    } else if (presence.getShow() == Presence.Show.away) {
+                        res.status = "away";
+                        res.linestatus = "online";
+                    } else if (presence.getShow() == Presence.Show.chat) {
+                        res.status = "free_chat";
+                        res.linestatus = "online";
+                    } else if (presence.getShow() == Presence.Show.dnd) {
+                        res.status = "dnd";
+                        res.linestatus = "online";
+                    } else if (presence.isAvailable()) {
+                        res.status = "available";
+                        res.linestatus = "online";
+                    }
                 }
             }
-        }
-        catch (Exception e) {
-        }
+            catch (Exception e) {
+            }
 
-        if (res.linestatus.equals("offline") && filteropts.contains("signedon")) {
-            continue;
-        }
+            if (res.linestatus.equals("offline") && filteropts.contains("signedon")) {
+                continue;
+            }
 
-        Date lastLogin = registration.getLastLogin();
-        res.lastLogin = ((lastLogin != null) ? lastLogin.toString() : "<i>" + LocaleUtils.getLocalizedString("gateway.web.registrations.never", "gateway") + "</i>");
+            Date lastLogin = registration.getLastLogin();
+            res.lastLogin = ((lastLogin != null) ? lastLogin.toString() : "<i>" + LocaleUtils.getLocalizedString("gateway.web.registrations.never", "gateway") + "</i>");
 
-        resCount++;
-        regResults.add(res);
+            resCount++;
+            regResults.add(res);
+        }
     }
 
     final int DEFAULT_RANGE = 15;
