@Nonnull
    private Presence createSelfPresenceCopy(@Nonnull final Presence presence, final boolean isJoinPresence)
    {
        final Presence result = presence.createCopy();
        Element fragSelfPresence = result.getChildElement("x", "http://jabber.org/protocol/muc#user");
        fragSelfPresence.addElement("status").addAttribute("code", "110");

        // Only in the context of entering the room status code 100, 201 and 210 should be sent.
        // http://xmpp.org/registrar/mucstatus.html
        if ( isJoinPresence )
        {
            boolean isRoomNew = isLocked() && creationDate.getTime() == lockedTime;
            if ( canAnyoneDiscoverJID() )
            {
                // XEP-0045: Example 26.
                // If the user is entering a room that is non-anonymous (i.e., which informs all occupants of each occupant's full JID as shown above),
                // the service MUST warn the user by including a status code of "100" in the initial presence that the room sends to the new occupant
                fragSelfPresence.addElement("status").addAttribute("code", "100");
            }

            if ( isLogEnabled() )
            {
                // XEP-0045 section 7.2.12: Room Logging:
                // If the user is entering a room in which the discussions are logged (...), the service (..) MUST also
                // warn the user that the discussions are logged. This is done by including a status code of "170" in
                // the initial presence that the room sends to the new occupant
                fragSelfPresence.addElement("status").addAttribute("code", "170");
            }

            if ( isRoomNew )
            {
                fragSelfPresence.addElement("status").addAttribute("code", "201");
            }
        }

        return result;
    }
Creates a copy of the presence stanza encapsulated in the argument, that is suitable to be sent back to the
entity that is the subject of the presence update (a 'self-presence'). The returned stanza contains several
flags that indicate to the receiving client that the information relates to their user.

@param presence The object encapsulating the presence to be broadcast.
@param isJoinPresence If the presence is sent in the context of joining the room.
@return A copy of the stanza to be broadcast.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java