Commit 35927ff9 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[GATE-15] Fixed multiple resource functionality.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk/src/plugins/gateway@5071 b35dd754-fafc-0310-a699-88a17e54d16e
parent c8ba1526
...@@ -202,10 +202,16 @@ public abstract class BaseTransport implements Component { ...@@ -202,10 +202,16 @@ public abstract class BaseTransport implements Component {
session = sessionManager.getSession(from); session = sessionManager.getSession(from);
if (session.hasResource(from.getResource())) { if (session.hasResource(from.getResource())) {
// Well, this could represent a status change. Log.debug("An existing resource has changed status: " + from);
session.updateStatus(getPresenceType(packet), packet.getStatus());
if (session.isHighestPriority(from.getResource())) {
// Well, this could represent a status change.
session.updateStatus(getPresenceType(packet), packet.getStatus());
}
} }
else { else {
Log.debug("A new resource has come online: " + from);
// This is a new resource, lets send them what we know. // This is a new resource, lets send them what we know.
session.addResource(from.getResource(), packet.getPriority()); session.addResource(from.getResource(), packet.getPriority());
// Tell the new resource what the state of their buddy list is. // Tell the new resource what the state of their buddy list is.
...@@ -225,6 +231,8 @@ public abstract class BaseTransport implements Component { ...@@ -225,6 +231,8 @@ public abstract class BaseTransport implements Component {
throw new UserNotFoundException("Unable to find roster."); throw new UserNotFoundException("Unable to find roster.");
} }
Log.debug("A new session has come online: " + from);
session = this.registrationLoggedIn(registration, from, getPresenceType(packet), packet.getStatus(), packet.getPriority()); session = this.registrationLoggedIn(registration, from, getPresenceType(packet), packet.getStatus(), packet.getPriority());
sessionManager.storeSession(from, session); sessionManager.storeSession(from, session);
...@@ -240,6 +248,8 @@ public abstract class BaseTransport implements Component { ...@@ -240,6 +248,8 @@ public abstract class BaseTransport implements Component {
// Just one of the resources, lets adjust accordingly. // Just one of the resources, lets adjust accordingly.
if (session.isHighestPriority(resource)) { if (session.isHighestPriority(resource)) {
Log.debug("A high priority resource (of multiple) has gone offline: " + from);
// Ooh, the highest resource went offline, drop to next highest. // Ooh, the highest resource went offline, drop to next highest.
session.removeResource(resource); session.removeResource(resource);
...@@ -250,11 +260,15 @@ public abstract class BaseTransport implements Component { ...@@ -250,11 +260,15 @@ public abstract class BaseTransport implements Component {
sendPacket(p); sendPacket(p);
} }
else { else {
Log.debug("A low priority resource (of multiple) has gone offline: " + from);
// Meh, lower priority, big whoop. // Meh, lower priority, big whoop.
session.removeResource(resource); session.removeResource(resource);
} }
} }
else { else {
Log.debug("A final resource has gone offline: " + from);
// No more resources, byebye. // No more resources, byebye.
if (session.isLoggedIn()) { if (session.isLoggedIn()) {
this.registrationLoggedOut(session); this.registrationLoggedOut(session);
......
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