Commit dc6cc970 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Fixed ghost problem that might happen under heavy load. JM-531

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3324 b35dd754-fafc-0310-a699-88a17e54d16e
parent e0b0205d
......@@ -66,8 +66,16 @@ public interface MUCUser extends ChannelHandler {
Iterator<MUCRole> getRoles();
/**
* Removes the role of the use in a particular room.<p>
* <p/>
* Adds the role of the user in a particular room.
*
* @param roomName The name of the room.
* @param role The new role of the user.
*/
void addRole(String roomName, MUCRole role);
/**
* Removes the role of the user in a particular room.<p>
*
* Note: PREREQUISITE: A lock on this object has already been obtained.
*
* @param roomName The name of the room we're being removed
......
......@@ -120,6 +120,8 @@ public class MUCRoleImpl implements MUCRole {
calculateExtendedInformation();
rJID = new JID(room.getName(), server.getServiceDomain(), nick);
setPresence(presence);
// Add the new role to the list of roles
user.addRole(room.getName(), this);
}
public Presence getPresence() {
......
......@@ -78,6 +78,10 @@ public class MUCUserImpl implements MUCUser {
return Collections.unmodifiableCollection(roles.values()).iterator();
}
public void addRole(String roomName, MUCRole role) {
roles.put(roomName.toLowerCase(), role);
}
public void removeRole(String roomName) {
roles.remove(roomName.toLowerCase());
}
......@@ -406,7 +410,6 @@ public class MUCUserImpl implements MUCUser {
historyRequest,
this,
packet.createCopy());
roles.put(group.toLowerCase(), role);
// If the client that created the room is non-MUC compliant then
// unlock the room thus creating an "instant" room
if (mucInfo == null && room.isLocked() && !room.isManuallyLocked()) {
......@@ -464,7 +467,7 @@ public class MUCUserImpl implements MUCUser {
else {
if (Presence.Type.unavailable == packet.getType()) {
try {
roles.remove(group.toLowerCase());
removeRole(group);
role.getChatRoom().leaveRoom(role.getNickname());
}
catch (UserNotFoundException e) {
......
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