Commit d34ccf6b authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Finished #getActiveSessionCount(String username).

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6356 b35dd754-fafc-0310-a699-88a17e54d16e
parent 5a2e745b
...@@ -21,6 +21,7 @@ import org.jivesoftware.wildfire.component.InternalComponentManager; ...@@ -21,6 +21,7 @@ import org.jivesoftware.wildfire.component.InternalComponentManager;
import org.jivesoftware.wildfire.container.BasicModule; import org.jivesoftware.wildfire.container.BasicModule;
import org.jivesoftware.wildfire.event.SessionEventDispatcher; import org.jivesoftware.wildfire.event.SessionEventDispatcher;
import org.jivesoftware.wildfire.handler.PresenceUpdateHandler; import org.jivesoftware.wildfire.handler.PresenceUpdateHandler;
import org.jivesoftware.wildfire.http.HttpSession;
import org.jivesoftware.wildfire.multiplex.ConnectionMultiplexerManager; import org.jivesoftware.wildfire.multiplex.ConnectionMultiplexerManager;
import org.jivesoftware.wildfire.multiplex.ConnectionMultiplexerSession; import org.jivesoftware.wildfire.multiplex.ConnectionMultiplexerSession;
import org.jivesoftware.wildfire.net.SocketConnection; import org.jivesoftware.wildfire.net.SocketConnection;
...@@ -30,7 +31,6 @@ import org.jivesoftware.wildfire.server.OutgoingSessionPromise; ...@@ -30,7 +31,6 @@ import org.jivesoftware.wildfire.server.OutgoingSessionPromise;
import org.jivesoftware.wildfire.spi.BasicStreamIDFactory; import org.jivesoftware.wildfire.spi.BasicStreamIDFactory;
import org.jivesoftware.wildfire.user.UserManager; import org.jivesoftware.wildfire.user.UserManager;
import org.jivesoftware.wildfire.user.UserNotFoundException; import org.jivesoftware.wildfire.user.UserNotFoundException;
import org.jivesoftware.wildfire.http.HttpSession;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
import org.xmpp.packet.Message; import org.xmpp.packet.Message;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
...@@ -1282,12 +1282,15 @@ public class SessionManager extends BasicModule { ...@@ -1282,12 +1282,15 @@ public class SessionManager extends BasicModule {
return 0; return 0;
} }
int sessionCount = 0; int sessionCount = 0;
for (Session session: sessions.get(username).getSessions()) { SessionMap sessionMap = sessions.get(username);
if (session.getStatus() != Session.STATUS_CLOSED) { if (sessionMap != null) {
sessionCount++; for (ClientSession session: sessionMap.getSessions()) {
if (session.getPresence().isAvailable()) {
sessionCount++;
}
} }
} }
return sessionCount; return sessionCount;
} }
public int getSessionCount(String username) { public int getSessionCount(String username) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment