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

Send unavailable direct presence for those sessions that were never available. JM-466

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@3111 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1af0beaf
......@@ -67,6 +67,11 @@ public class ClientSession extends Session {
*/
private boolean initialized;
/**
* Flag that indicates if the session was available ever.
*/
private boolean wasAvailable = false;
/**
* Flag indicating if the user requested to not receive offline messages when sending
* an available presence. The user may send a disco request with node
......@@ -432,6 +437,15 @@ public class ClientSession extends Session {
initialized = isInit;
}
/**
* Returns true if the session was available ever.
*
* @return true if the session was available ever.
*/
public boolean wasAvailable() {
return wasAvailable;
}
/**
* Returns true if the offline messages of the user should be sent to the user when
* the user becomes online. If the user sent a disco request with node
......@@ -508,6 +522,7 @@ public class ClientSession extends Session {
else if (!oldPresence.isAvailable() && this.presence.isAvailable()) {
// The client is available
sessionManager.sessionAvailable(this);
wasAvailable = true;
}
else if (oldPresence.getPriority() != this.presence.getPriority()) {
// The client has changed the priority of his presence
......
......@@ -1279,7 +1279,7 @@ public class SessionManager extends BasicModule {
try {
ClientSession session = (ClientSession)handback;
try {
if (session.getPresence().isAvailable()) {
if (session.getPresence().isAvailable() || !session.wasAvailable()) {
// Send an unavailable presence to the user's subscribers
// Note: This gives us a chance to send an unavailable presence to the
// entities that the user sent directed presences
......
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