public synchronized void setPresence(Presence newPresence) {
        // Try to remove the element whose namespace is "http://jabber.org/protocol/muc" since we
        // don't need to include that element in future presence broadcasts
        final Element presenceEl = newPresence.getElement();
        presenceEl.elements(QName.get("x", "http://jabber.org/protocol/muc"))
            .forEach(presenceEl::remove);

        synchronized (this) {
            this.presence = newPresence;
            this.presence.setFrom(getOccupantJID());
            updatePresence();
        }
    }
Set the current presence status of a user in a chatroom.

@param newPresence The presence of the user in the room.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCOccupant.java