Commit 5139ad7d authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Added property that indicates if user stopped flooding of offline messages. JM-8


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1699 b35dd754-fafc-0310-a699-88a17e54d16e
parent 04c62463
...@@ -71,6 +71,15 @@ public class ClientSession extends Session { ...@@ -71,6 +71,15 @@ public class ClientSession extends Session {
*/ */
private boolean initialized; private boolean initialized;
/**
* 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
* "http://jabber.org/protocol/offline" so that no offline messages are sent to the
* user when he becomes online. If the user is connected from many resources then
* if one of the sessions stopped the flooding then no session should flood the user.
*/
private boolean offlineFloodStopped = false;
private Presence presence = null; private Presence presence = null;
private int conflictCount = 0; private int conflictCount = 0;
...@@ -390,6 +399,53 @@ public class ClientSession extends Session { ...@@ -390,6 +399,53 @@ public class ClientSession extends Session {
initialized = isInit; initialized = isInit;
} }
/**
* 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
* "http://jabber.org/protocol/offline" before the available presence then do not
* flood the user with the offline messages. If the user is connected from many resources
* then if one of the sessions stopped the flooding then no session should flood the user.
*
* @return true if the offline messages of the user should be sent to the user when the user
* becomes online.
*/
public boolean canFloodOfflineMessages() {
for (ClientSession session : sessionManager.getSessions()) {
if (session.isOfflineFloodStopped()) {
return false;
}
}
return true;
}
/**
* Returns true if the user requested to not receive offline messages when sending
* an available presence. The user may send a disco request with node
* "http://jabber.org/protocol/offline" so that no offline messages are sent to the
* user when he becomes online. If the user is connected from many resources then
* if one of the sessions stopped the flooding then no session should flood the user.
*
* @return true if the user requested to not receive offline messages when sending
* an available presence.
*/
public boolean isOfflineFloodStopped() {
return offlineFloodStopped;
}
/**
* Sets if the user requested to not receive offline messages when sending
* an available presence. The user may send a disco request with node
* "http://jabber.org/protocol/offline" so that no offline messages are sent to the
* user when he becomes online. If the user is connected from many resources then
* if one of the sessions stopped the flooding then no session should flood the user.
*
* @param offlineFloodStopped if the user requested to not receive offline messages when
* sending an available presence.
*/
public void setOfflineFloodStopped(boolean offlineFloodStopped) {
this.offlineFloodStopped = offlineFloodStopped;
}
/** /**
* Obtain the presence of this session. * Obtain the presence of this 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