void sendInitialPresencesToNewOccupant(MUCOccupant joinedOccupant) {
        if (!JOIN_PRESENCE_ENABLE.getValue()) {
            Log.debug( "Skip exchanging presence between existing occupants of room '{}' and new occupant '{}' as it is disabled by configuration.", this.getJID(), joinedOccupant.getUserAddress() );
            return;
        }

        Log.trace( "Send presence of existing occupants of room '{}' to new occupant '{}'.", this.getJID(), joinedOccupant.getUserAddress() );
        for ( final MUCOccupant occupant : getOccupants() ) {
            if (occupant == joinedOccupant) {
                continue;
            }

            // Skip to the next occupant if we cannot send presence of this occupant
            if (!canBroadcastPresence(occupant.getRole())) {
                continue;
            }

            final Presence occupantPresence = occupant.getPresence(); // This returns a copy. Modifications will not be applied to the original.
            if (!canAnyoneDiscoverJID() && Role.moderator != joinedOccupant.getRole()) {
                // Don't include the occupant's JID if the room is semi-anon and the new occupant is not a moderator
                final Element frag = occupantPresence.getChildElement("x", "http://jabber.org/protocol/muc#user");
                frag.element("item").addAttribute("jid", null);
            }
            joinedOccupant.send(occupantPresence);
        }
    }
Sends presence of existing occupants to new occupant.

@param joinedOccupant the occupant data of the new occupant in the room.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java