private void afterJoinSendHistory( @Nonnull final JID joiningPeer )
    {
        if ( !joiningPeer.asBareJID().equals(joiningPeer) ) {
            throw new IllegalArgumentException( "Expected argument 'joiningPeer' to be a bare JID, but it was not: " + joiningPeer );
        }

        // TODO. Can org.jivesoftware.openfire.muc.spi.MUCRoom.sendRoomHistoryAfterJoin be reused to reduce duplicate code and responsibilities?
        Log.trace("(room: '{}'): Sending history to joining node '{}'.", room.getJID(), joiningPeer );
        final MUCRoomHistory roomHistory = room.getRoomHistory();
        final Iterator<Message> history = roomHistory.getMessageHistory();
        while (history.hasNext()) {
            // The message stanza in the history is the original stanza (with original addressing), which we can leverage
            // to obtain the 'real' jid of the sender. Note that this sender need not be in the room any more, so we can't
            // depend on having a MUCOccupant for it.
            final Message oldMessage = history.next();

            final JID originalAuthorUserAddress = oldMessage.getFrom();
            final JID originalAuthorRoleAddress = new JID( room.getJID().getNode(), room.getJID().getDomain(), originalAuthorUserAddress.getResource() );

            final Message enriched = enrichWithFMUCElement( oldMessage, originalAuthorUserAddress );

            // Correct the addressing of the stanza.
            enriched.setFrom( originalAuthorRoleAddress );
            enriched.setTo( joiningPeer );

            XMPPServer.getInstance().getPacketRouter().route( enriched );
        }
    }
Sends a stanza back to a remote, joining FMUC node that represents acceptance of a FMUC join request.

@param joinRequest The request to join that is being accepted.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/FMUCHandler.java