@Override
    public void writeExternal(ObjectOutput out) throws IOException {
        try {
            ExternalizableUtil.getInstance().writeSafeUTF(out, roomJid.toString());
            ExternalizableUtil.getInstance().writeBoolean(out, userJid != null);
            if (userJid != null) {
                ExternalizableUtil.getInstance().writeSafeUTF(out, userJid.toString());
            }
            ExternalizableUtil.getInstance().writeSafeUTF(out, nick);
            ExternalizableUtil.getInstance().writeSafeUTF(out, occupantId);
            synchronized (this) {
                ExternalizableUtil.getInstance().writeBoolean(out, presence != null);
                if (presence != null) {
                    ExternalizableUtil.getInstance().writeSerializable(out, (DefaultElement) presence.getElement());
                }
            }
            ExternalizableUtil.getInstance().writeSerializable(out, role);
            ExternalizableUtil.getInstance().writeSerializable(out, affiliation);
            ExternalizableUtil.getInstance().writeBoolean(out, voiceOnly);
            ExternalizableUtil.getInstance().writeSafeUTF(out, occupantJID.toString());
            synchronized (this) {
                ExternalizableUtil.getInstance().writeSerializable(out, (DefaultElement) extendedInformation);
            }
            ExternalizableUtil.getInstance().writeBoolean(out, reportedFmucJID != null);
            if (reportedFmucJID != null) {
                ExternalizableUtil.getInstance().writeSafeUTF(out, reportedFmucJID.toString());
            }
        } catch (IOException | RuntimeException e ) {
            Log.error("write error", e);
            throw e;
        }
    }
Calculates and sets the extended presence information to add to the presence.
The information to add contains the user's jid, affiliation and role.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCOccupant.java