Skip to content

Commit

Permalink
Merge pull request #503 from surevine/OF-454
Browse files Browse the repository at this point in the history
OF-454 Reflect presence to originator
  • Loading branch information
dwd committed Jan 11, 2016
2 parents a742703 + 20e1b08 commit 1d02181
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/java/org/jivesoftware/openfire/SessionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -675,6 +669,10 @@ 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.
// Also RFC 6121 4.2.2 for updates.
presence.setTo(originatingResource);
routingTable.routePacket(originatingResource, presence, false);
if (!SessionManager.isOtherResourcePresenceEnabled()) {
return;
}
Expand Down

0 comments on commit 1d02181

Please sign in to comment.