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 void occupantUpdated(UpdateOccupant update) { List <MUCRole> occupants = occupantsByNickname.get(update.getNickname().toLowerCase()); if (occupants == null || occupants.size() == 0) { Log.debug("LocalMUCRoom: Failed to update information of room occupant. Occupant nickname: " + update.getNickname()); } else { for (MUCRole occupant : occupants) { if (!occupant.isLocal()) { occupant.setPresence(update.getPresence()); try { occupant.setRole(update.getRole()); occupant.setAffiliation(update.getAffiliation()); } catch (NotAllowedException e) { // Ignore. Should never happen with remote roles } } else { Log.error(MessageFormat.format("Ignoring update of local occupant with info from a remote occupant. " + "Occupant nickname: {0} new role: {1} new affiliation: {2}", update.getNickname(), update.getRole(), update.getAffiliation())); } } } }
role.setRole(newRole);
if (role.isLocal()) { role.setRole(newRole);
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 void occupantUpdated(UpdateOccupant update) { List <MUCRole> occupants = occupantsByNickname.get(update.getNickname().toLowerCase()); if (occupants == null || occupants.size() == 0) { Log.debug("LocalMUCRoom: Failed to update information of room occupant. Occupant nickname: " + update.getNickname()); } else { for (MUCRole occupant : occupants) { if (!occupant.isLocal()) { occupant.setPresence(update.getPresence()); try { occupant.setRole(update.getRole()); occupant.setAffiliation(update.getAffiliation()); } catch (NotAllowedException e) { // Ignore. Should never happen with remote roles } } else { Log.error(MessageFormat.format("Ignoring update of local occupant with info from a remote occupant. " + "Occupant nickname: {0} new role: {1} new affiliation: {2}", update.getNickname(), update.getRole(), update.getAffiliation())); } } } }
role.setRole(newRole);
if (role.isLocal()) { role.setRole(newRole);