@Override
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        try {
            roomJid = new JID(ExternalizableUtil.getInstance().readSafeUTF(in), false);
            if (ExternalizableUtil.getInstance().readBoolean(in)) {
                userJid = new JID(ExternalizableUtil.getInstance().readSafeUTF(in), false);
            } else {
                userJid = null;
            }
            nick = ExternalizableUtil.getInstance().readSafeUTF(in);
            occupantId = ExternalizableUtil.getInstance().readSafeUTF(in);
            synchronized (this) { // Unlikely to be needed, as this should operate on a new instance. Will prevent static analyzers from complaining at negligible cost.
                if (ExternalizableUtil.getInstance().readBoolean(in)) {
                    presence = new Presence((Element) ExternalizableUtil.getInstance().readSerializable(in));
                } else {
                    presence = null;
                }
            }
            role = (Role) ExternalizableUtil.getInstance().readSerializable(in);
            affiliation = (Affiliation) ExternalizableUtil.getInstance().readSerializable(in);
            voiceOnly = ExternalizableUtil.getInstance().readBoolean(in);
            occupantJID = new JID(ExternalizableUtil.getInstance().readSafeUTF(in), false);
            synchronized (this) { // Unlikely to be needed, as this should operate on a new instance. Will prevent static analyzers from complaining at negligible cost.
                extendedInformation = (Element) ExternalizableUtil.getInstance().readSerializable(in);
            }
            if (ExternalizableUtil.getInstance().readBoolean(in)) {
                reportedFmucJID = new JID(ExternalizableUtil.getInstance().readSafeUTF(in), false);
            }
            cacheSize = -1;
        } catch (IOException | RuntimeException e ) {
            Log.error("read 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