/** * Updates the presence of an occupant with the new presence included in the request. * * @param updatePresence request to update an occupant's presence. */ public void presenceUpdated(UpdatePresence updatePresence) { List <MUCRole> occupants = occupantsByNickname.get(updatePresence.getNickname().toLowerCase()); if (occupants == null || occupants.size() == 0) { Log.debug("LocalMUCRoom: Failed to update presence of room occupant. Occupant nickname: " + updatePresence.getNickname()); } else { for (MUCRole occupant : occupants) { occupant.setPresence(updatePresence.getPresence()); } } }
public void nicknameChanged(ChangeNickname changeNickname) { List<MUCRole> occupants = occupantsByNickname.get(changeNickname.getOldNick().toLowerCase()); if (occupants != null && occupants.size() > 0) { for (MUCRole occupant : occupants) { // Update the role with the new info occupant.setPresence(changeNickname.getPresence()); occupant.changeNickname(changeNickname.getNewNick()); } if (changeNickname.isOriginator()) { // Fire event that user changed his nickname MUCEventDispatcher.nicknameChanged(getRole().getRoleAddress(), occupants.get(0).getUserAddress(), changeNickname.getOldNick(), changeNickname.getNewNick()); } // Associate the existing MUCRole with the new nickname occupantsByNickname.put(changeNickname.getNewNick().toLowerCase(), occupants); // Remove the old nickname occupantsByNickname.remove(changeNickname.getOldNick().toLowerCase()); } }
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())); } } } }
/** * Updates the presence of an occupant with the new presence included in the request. * * @param updatePresence request to update an occupant's presence. */ public void presenceUpdated(UpdatePresence updatePresence) { List <MUCRole> occupants = occupantsByNickname.get(updatePresence.getNickname().toLowerCase()); if (occupants == null || occupants.size() == 0) { Log.debug("LocalMUCRoom: Failed to update presence of room occupant. Occupant nickname: " + updatePresence.getNickname()); } else { for (MUCRole occupant : occupants) { occupant.setPresence(updatePresence.getPresence()); } } }
public void nicknameChanged(ChangeNickname changeNickname) { List<MUCRole> occupants = occupantsByNickname.get(changeNickname.getOldNick().toLowerCase()); if (occupants != null && occupants.size() > 0) { for (MUCRole occupant : occupants) { // Update the role with the new info occupant.setPresence(changeNickname.getPresence()); occupant.changeNickname(changeNickname.getNewNick()); } if (changeNickname.isOriginator()) { // Fire event that user changed his nickname MUCEventDispatcher.nicknameChanged(getRole().getRoleAddress(), occupants.get(0).getUserAddress(), changeNickname.getOldNick(), changeNickname.getNewNick()); } // Associate the existing MUCRole with the new nickname occupantsByNickname.put(changeNickname.getNewNick().toLowerCase(), occupants); // Remove the old nickname occupantsByNickname.remove(changeNickname.getOldNick().toLowerCase()); } }
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())); } } } }