Commit 1d021814 authored by Dave Cridland's avatar Dave Cridland

Merge pull request #503 from surevine/OF-454

OF-454 Reflect presence to originator
parents a742703d 20e1b087
...@@ -620,12 +620,6 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -620,12 +620,6 @@ public class SessionManager extends BasicModule implements ClusterEventListener/
routingTable.addClientRoute(session.getAddress(), session); routingTable.addClientRoute(session.getAddress(), session);
// Broadcast presence between the user's resources // Broadcast presence between the user's resources
broadcastPresenceOfOtherResource(session); broadcastPresenceOfOtherResource(session);
// RFC 6121 § 4.4.2.
// The user's server MUST also send the presence stanza to all of the user's available resources (including the resource that generated the presence notification in the first place).
Presence selfPresence = presence.createCopy();
selfPresence.setTo(session.getAddress());
routingTable.routePacket(session.getAddress(), selfPresence, false);
} }
} }
...@@ -675,6 +669,10 @@ public class SessionManager extends BasicModule implements ClusterEventListener/ ...@@ -675,6 +669,10 @@ 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) {
// RFC 6121 4.4.2 says we always send to the originating resource.
// Also RFC 6121 4.2.2 for updates.
presence.setTo(originatingResource);
routingTable.routePacket(originatingResource, presence, false);
if (!SessionManager.isOtherResourcePresenceEnabled()) { if (!SessionManager.isOtherResourcePresenceEnabled()) {
return; return;
} }
......
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