Commit 1a227445 authored by guus's avatar guus

OF-727: Applying patch provided by Benjamin and Gato.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13921 b35dd754-fafc-0310-a699-88a17e54d16e
parent 2d65c9e8
...@@ -588,12 +588,27 @@ public class SessionManager extends BasicModule implements ClusterEventListener ...@@ -588,12 +588,27 @@ public class SessionManager extends BasicModule implements ClusterEventListener
} }
} }
/**
* Returns true if the session should broadcast presences to all other resources for the
* current client. When disabled it is not possible to broadcast presence packets to another
* resource of the connected user. This is desirable if you have a use case where you have
* many resources attached to the same user account.
*
* @return true if presence should be broadcast to other resources of the same account
*/
public static boolean isOtherResourcePresenceEnabled() {
return JiveGlobals.getBooleanProperty("xmpp.client.other-resource.presence", true);
}
/** /**
* Sends the presences of other connected resources to the resource that just connected. * Sends the presences of other connected resources to the resource that just connected.
* *
* @param session the newly created session. * @param session the newly created session.
*/ */
private void broadcastPresenceOfOtherResource(LocalClientSession session) { private void broadcastPresenceOfOtherResource(LocalClientSession session) {
if (!SessionManager.isOtherResourcePresenceEnabled()) {
return;
}
Presence presence; Presence presence;
// Get list of sessions of the same user // Get list of sessions of the same user
JID searchJID = new JID(session.getAddress().getNode(), session.getAddress().getDomain(), null); JID searchJID = new JID(session.getAddress().getNode(), session.getAddress().getDomain(), null);
...@@ -619,6 +634,9 @@ public class SessionManager extends BasicModule implements ClusterEventListener ...@@ -619,6 +634,9 @@ public class SessionManager extends BasicModule implements ClusterEventListener
* @param presence the presence. * @param presence the presence.
*/ */
public void broadcastPresenceToOtherResources(JID originatingResource, Presence presence) { public void broadcastPresenceToOtherResources(JID originatingResource, Presence presence) {
if (!SessionManager.isOtherResourcePresenceEnabled()) {
return;
}
// Get list of sessions of the same user // Get list of sessions of the same user
JID searchJID = new JID(originatingResource.getNode(), originatingResource.getDomain(), null); JID searchJID = new JID(originatingResource.getNode(), originatingResource.getDomain(), null);
List<JID> addresses = routingTable.getRoutes(searchJID, null); List<JID> addresses = routingTable.getRoutes(searchJID, null);
......
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