private void sendRoomSubjectAfterJoin(@Nonnull final JID realAddress, @Nonnull MUCOccupant joiningOccupant )
    {
        Log.trace( "Sending room subject to user '{}' that joined room '{}'.", realAddress, this.getJID() );

        Message roomSubject = roomHistory.getChangedSubject();
        if (roomSubject != null) {
            // OF-2163: Prevent modifying the original subject stanza (that can be retrieved by others later) by making a defensive copy.
            //          This prevents the stanza kept in memory to have the 'to' address for the last user that it was sent to.
            roomSubject.createCopy();
        } else {
            // 7.2.15 If there is no subject set, the room MUST return an empty <subject/> element.
            roomSubject = new Message();
            roomSubject.setFrom( this.getJID() );
            roomSubject.setType( Message.Type.groupchat );
            roomSubject.setID( UUID.randomUUID().toString() );
            roomSubject.getElement().addElement( "subject" );
        }
        joiningOccupant.send(roomSubject);
    }
Sends the room subject to a user that just joined the room.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java