Commit 1d025c51 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Fixed serializationb of object.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10224 b35dd754-fafc-0310-a699-88a17e54d16e
parent ce99999a
...@@ -39,7 +39,7 @@ import java.io.ObjectOutput; ...@@ -39,7 +39,7 @@ import java.io.ObjectOutput;
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class RemoteMUCRole implements MUCRole, Externalizable { public class RemoteMUCRole implements MUCRole, Externalizable {
private MultiUserChatService server; private String serviceDomain;
private Presence presence; private Presence presence;
private Role role; private Role role;
private Affiliation affiliation; private Affiliation affiliation;
...@@ -57,7 +57,7 @@ public class RemoteMUCRole implements MUCRole, Externalizable { ...@@ -57,7 +57,7 @@ public class RemoteMUCRole implements MUCRole, Externalizable {
} }
public RemoteMUCRole(MultiUserChatService server, OccupantAddedEvent event) { public RemoteMUCRole(MultiUserChatService server, OccupantAddedEvent event) {
this.server = server; this.serviceDomain = server.getServiceDomain();
presence = event.getPresence(); presence = event.getPresence();
role = event.getRole(); role = event.getRole();
affiliation = event.getAffiliation(); affiliation = event.getAffiliation();
...@@ -95,7 +95,7 @@ public class RemoteMUCRole implements MUCRole, Externalizable { ...@@ -95,7 +95,7 @@ public class RemoteMUCRole implements MUCRole, Externalizable {
public void changeNickname(String nickname) { public void changeNickname(String nickname) {
this.nickname = nickname; this.nickname = nickname;
setRoleAddress(new JID(room.getName(), server.getServiceDomain(), nickname, true)); setRoleAddress(new JID(room.getName(), serviceDomain, nickname, true));
} }
private void setRoleAddress(JID jid) { private void setRoleAddress(JID jid) {
...@@ -141,6 +141,7 @@ public class RemoteMUCRole implements MUCRole, Externalizable { ...@@ -141,6 +141,7 @@ public class RemoteMUCRole implements MUCRole, Externalizable {
} }
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
ExternalizableUtil.getInstance().writeSafeUTF(out, serviceDomain);
ExternalizableUtil.getInstance().writeSerializable(out, (DefaultElement) presence.getElement()); ExternalizableUtil.getInstance().writeSerializable(out, (DefaultElement) presence.getElement());
ExternalizableUtil.getInstance().writeInt(out, role.ordinal()); ExternalizableUtil.getInstance().writeInt(out, role.ordinal());
ExternalizableUtil.getInstance().writeInt(out, affiliation.ordinal()); ExternalizableUtil.getInstance().writeInt(out, affiliation.ordinal());
...@@ -152,6 +153,7 @@ public class RemoteMUCRole implements MUCRole, Externalizable { ...@@ -152,6 +153,7 @@ public class RemoteMUCRole implements MUCRole, Externalizable {
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
serviceDomain = ExternalizableUtil.getInstance().readSafeUTF(in);
presence = new Presence((Element)ExternalizableUtil.getInstance().readSerializable(in), true); presence = new Presence((Element)ExternalizableUtil.getInstance().readSerializable(in), true);
role = Role.values()[ExternalizableUtil.getInstance().readInt(in)]; role = Role.values()[ExternalizableUtil.getInstance().readInt(in)];
affiliation = Affiliation.values()[ExternalizableUtil.getInstance().readInt(in)]; affiliation = Affiliation.values()[ExternalizableUtil.getInstance().readInt(in)];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment