public Presence updateOccupant(UpdateOccupantRequest updateRequest) throws NotAllowedException { Presence result = null; List <MUCRole> occupants = occupantsByNickname.get(updateRequest.getNickname().toLowerCase()); if (occupants == null || occupants.size() == 0) { Log.debug("Failed to update information of local room occupant; nickname: " + updateRequest.getNickname()); } else { for (MUCRole occupant : occupants) { if (updateRequest.isAffiliationChanged()) { occupant.setAffiliation(updateRequest.getAffiliation()); } occupant.setRole(updateRequest.getRole()); // Notify the the cluster nodes to update the occupant CacheFactory.doClusterTask(new UpdateOccupant(this, occupant)); if (result == null) { result = occupant.getPresence(); } } } return result; }
public UpdateOccupant(LocalMUCRoom room, MUCRole role) { super(room); this.presence = role.getPresence(); this.nickname = role.getNickname(); this.role = role.getRole().ordinal(); this.affiliation = role.getAffiliation().ordinal(); }
continue; Presence occupantPresence = occupant.getPresence();
presences.add(role.getPresence().createCopy());
@Override public void nicknameChanged(MUCRole occupantRole, Presence newPresence, String oldNick, String newNick) { // Ask other cluster nodes to update the nickname of the occupant ChangeNickname request = new ChangeNickname(this, oldNick, newNick, newPresence.createCopy()); CacheFactory.doClusterTask(request); // Update the nickname of the occupant request = new ChangeNickname(this, oldNick, newNick, newPresence.createCopy()); request.setOriginator(true); request.run(); // Broadcast new presence of occupant broadcastPresence(occupantRole.getPresence().createCopy(), false); }
public OccupantAddedEvent(LocalMUCRoom room, MUCRole occupant) { super(room); presence = occupant.getPresence(); role = occupant.getRole().ordinal(); affiliation = occupant.getAffiliation().ordinal(); voiceOnly = occupant.isVoiceOnly(); roleAddress = occupant.getRoleAddress(); userAddress = occupant.getUserAddress(); nodeID = XMPPServer.getInstance().getNodeID(); }
Presence originalPresence = leaveRole.getPresence(); Presence presence = originalPresence.createCopy(); presence.setType(Presence.Type.unavailable);
if (occupant.getPresence().getFrom().equals(to)) { Presence selfPresence = presence.createCopy(); Element fragSelfPresence = selfPresence.getChildElement("x", "http://jabber.org/protocol/muc#user");
/** * Handles occupants updating their presence in the chatroom. Assumes the user updates their presence whenever their * availability in the room changes. This method should not be called to handle other presence related updates, such * as nickname changes. * {@inheritDoc} */ @Override public void presenceUpdated(final MUCRole occupantRole, final Presence newPresence) { final String occupantNickName = occupantRole.getNickname(); // Update the presence of the occupant on the local node with the occupant's new availability. Updates the // local node first so the remote nodes receive presence that correctly reflects the occupant's new // 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); }
return role.getPresence().createCopy();
Presence presence = role.getPresence().createCopy();
public Presence updateOccupant(UpdateOccupantRequest updateRequest) throws NotAllowedException { Presence result = null; List <MUCRole> occupants = occupantsByNickname.get(updateRequest.getNickname().toLowerCase()); if (occupants == null || occupants.size() == 0) { Log.debug("Failed to update information of local room occupant; nickname: " + updateRequest.getNickname()); } else { for (MUCRole occupant : occupants) { if (updateRequest.isAffiliationChanged()) { occupant.setAffiliation(updateRequest.getAffiliation()); } occupant.setRole(updateRequest.getRole()); // Notify the the cluster nodes to update the occupant CacheFactory.doClusterTask(new UpdateOccupant(this, occupant)); if (result == null) { result = occupant.getPresence(); } } } return result; }
public UpdateOccupant(LocalMUCRoom room, MUCRole role) { super(room); this.presence = role.getPresence(); this.nickname = role.getNickname(); this.role = role.getRole().ordinal(); this.affiliation = role.getAffiliation().ordinal(); }
continue; Presence occupantPresence = occupant.getPresence();
@Override public void nicknameChanged(MUCRole occupantRole, Presence newPresence, String oldNick, String newNick) { // Ask other cluster nodes to update the nickname of the occupant ChangeNickname request = new ChangeNickname(this, oldNick, newNick, newPresence.createCopy()); CacheFactory.doClusterTask(request); // Update the nickname of the occupant request = new ChangeNickname(this, oldNick, newNick, newPresence.createCopy()); request.setOriginator(true); request.run(); // Broadcast new presence of occupant broadcastPresence(occupantRole.getPresence().createCopy(), false); }
public OccupantAddedEvent(LocalMUCRoom room, MUCRole occupant) { super(room); presence = occupant.getPresence(); role = occupant.getRole().ordinal(); affiliation = occupant.getAffiliation().ordinal(); voiceOnly = occupant.isVoiceOnly(); roleAddress = occupant.getRoleAddress(); userAddress = occupant.getUserAddress(); nodeID = XMPPServer.getInstance().getNodeID(); }
Presence originalPresence = leaveRole.getPresence(); Presence presence = originalPresence.createCopy(); presence.setType(Presence.Type.unavailable);
if (occupant.getPresence().getFrom().equals(to)) { Presence selfPresence = presence.createCopy(); Element fragSelfPresence = selfPresence.getChildElement("x", "http://jabber.org/protocol/muc#user");
/** * Handles occupants updating their presence in the chatroom. Assumes the user updates their presence whenever their * availability in the room changes. This method should not be called to handle other presence related updates, such * as nickname changes. * {@inheritDoc} */ @Override public void presenceUpdated(final MUCRole occupantRole, final Presence newPresence) { final String occupantNickName = occupantRole.getNickname(); // Update the presence of the occupant on the local node with the occupant's new availability. Updates the // local node first so the remote nodes receive presence that correctly reflects the occupant's new // 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); }
return role.getPresence().createCopy();