From d6a1e7882779d57e0c08bd2ecc5f43866948c66c Mon Sep 17 00:00:00 2001 From: Dave Cridland Date: Fri, 8 Jan 2016 19:57:45 +0000 Subject: [PATCH 1/2] OF-454 Reflect presence to originator --- src/java/org/jivesoftware/openfire/SessionManager.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/java/org/jivesoftware/openfire/SessionManager.java b/src/java/org/jivesoftware/openfire/SessionManager.java index 8678392e15..ebe61418af 100644 --- a/src/java/org/jivesoftware/openfire/SessionManager.java +++ b/src/java/org/jivesoftware/openfire/SessionManager.java @@ -675,6 +675,9 @@ private void broadcastPresenceOfOtherResource(LocalClientSession session) { * @param presence the presence. */ public void broadcastPresenceToOtherResources(JID originatingResource, Presence presence) { + // RFC 6121 4.4.2 says we always send to the originating resource. + presence.setTo(originatingResource); + routingTable.routePacket(originatingResource, presence, false); if (!SessionManager.isOtherResourcePresenceEnabled()) { return; } From 20e1b087333a5dca8642f02c3f2472c967441275 Mon Sep 17 00:00:00 2001 From: Dave Cridland Date: Sat, 9 Jan 2016 09:24:23 +0000 Subject: [PATCH 2/2] Remove double-reflection --- src/java/org/jivesoftware/openfire/SessionManager.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/java/org/jivesoftware/openfire/SessionManager.java b/src/java/org/jivesoftware/openfire/SessionManager.java index ebe61418af..0b8720c82a 100644 --- a/src/java/org/jivesoftware/openfire/SessionManager.java +++ b/src/java/org/jivesoftware/openfire/SessionManager.java @@ -620,12 +620,6 @@ public void sessionAvailable(LocalClientSession session, Presence presence) { routingTable.addClientRoute(session.getAddress(), session); // Broadcast presence between the user's resources 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); } } @@ -676,6 +670,7 @@ private void broadcastPresenceOfOtherResource(LocalClientSession session) { */ 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()) {