Commit 7d1e5df1 authored by Dave Cridland's avatar Dave Cridland

Merge pull request #536 from derekmcl/master

Cannot join room in a cluster after an availability update.
parents 3b42538c 1a5781c9
...@@ -1868,20 +1868,35 @@ public class LocalMUCRoom implements MUCRoom, GroupEventListener { ...@@ -1868,20 +1868,35 @@ public class LocalMUCRoom implements MUCRoom, GroupEventListener {
public boolean isManuallyLocked() { public boolean isManuallyLocked() {
return lockedTime > 0 && creationDate.getTime() != lockedTime; return lockedTime > 0 && creationDate.getTime() != lockedTime;
} }
@Override /**
public void presenceUpdated(MUCRole occupantRole, Presence newPresence) { * Handles occupants updating their presence in the chatroom. Assumes the user updates their presence whenever their
// Ask other cluster nodes to update the presence of the occupant * availability in the room changes. This method should not be called to handle other presence related updates, such
UpdatePresence request = new UpdatePresence(this, newPresence.createCopy(), occupantRole.getNickname()); * as nickname changes.
CacheFactory.doClusterTask(request); * {@inheritDoc}
*/
// Update the presence of the occupant @Override
request = new UpdatePresence(this, newPresence.createCopy(), occupantRole.getNickname()); public void presenceUpdated(final MUCRole occupantRole, final Presence newPresence) {
request.setOriginator(true); final String occupantNickName = occupantRole.getNickname();
request.run();
// Update the presence of the occupant on the local node with the occupant's new availability. Updates the
// Broadcast new presence of occupant // local node first so the remote nodes receive presence that correctly reflects the occupant's new
broadcastPresence(occupantRole.getPresence().createCopy(), false); // availability and previously existing role and affiliation with the room.
final UpdatePresence localUpdateRequest = new UpdatePresence(this, newPresence.createCopy(), occupantNickName);
localUpdateRequest.setOriginator(true);
localUpdateRequest.run();
// Get the new, updated presence for the occupant in the room. The presence reflects the occupant's updated
// availability and their existing association.
final Presence updatedPresence = occupantRole.getPresence().createCopy();
// Ask other cluster nodes to update the presence of the occupant. Uses the updated presence from the local
// MUC role.
final UpdatePresence clusterUpdateRequest = new UpdatePresence(this, updatedPresence, occupantNickName);
CacheFactory.doClusterTask(clusterUpdateRequest);
// Broadcast updated presence of occupant.
broadcastPresence(updatedPresence, false);
} }
/** /**
......
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