Search in sources :

Example 1 with OccupantUpdatedTask

use of org.jivesoftware.openfire.muc.cluster.OccupantUpdatedTask in project Openfire by igniterealtime.

the class OccupantManager method nicknameChanged.

/**
 * When an XMPP entity / user that is an occupant of a room changes its nickname, this event handler will ensure that
 * the relevant data that is maintained in this instance of OccupantManager, as well as all instances for the same
 * server on every other cluster node, is updated.
 *
 * @param roomJID the JID of the room where the occupant has joined.
 * @param userJID The 'real' JID (not room-at-service-slash-nickname) of the XMPP user that joined.
 * @param oldNickname nickname of the user in the room prior to the change.
 * @param newNickname nickname of the user in the room after the change.
 */
@Override
public void nicknameChanged(JID roomJID, JID userJID, String oldNickname, String newNickname) {
    if (!isForThisService(roomJID)) {
        return;
    }
    Log.debug("Updated local occupancy in room '{}' of service '{}': entity '{}' now nickname '{}' (was: '{}')", roomJID.getNode(), serviceName, newNickname, oldNickname, userJID);
    final OccupantUpdatedTask task = new OccupantUpdatedTask(serviceName, roomJID.getNode(), oldNickname, newNickname, userJID, XMPPServer.getInstance().getNodeID());
    // On this cluster node.
    process(task);
    // On all other cluster nodes
    if (PROPERTY_USE_NONBLOCKING_CLUSTERTASKS.getValue()) {
        CacheFactory.doClusterTask(task);
    } else {
        CacheFactory.doSynchronousClusterTask(task, false);
    }
}
Also used : OccupantUpdatedTask(org.jivesoftware.openfire.muc.cluster.OccupantUpdatedTask)

Aggregations

OccupantUpdatedTask (org.jivesoftware.openfire.muc.cluster.OccupantUpdatedTask)1