Index: src/java/org/jivesoftware/openfire/muc/MUCRoom.java
===================================================================
--- src/java/org/jivesoftware/openfire/muc/MUCRoom.java	(revision 11100)
+++ src/java/org/jivesoftware/openfire/muc/MUCRoom.java	(working copy)
@@ -298,10 +298,23 @@
      * @return the list of updated presences of all the client resources that the client used to
      *         join the room.
      * @throws ForbiddenException If the user is not allowed to modify the owner list.
+     * @deprecated Replaced by {@link #addOwner(JID, MUCRole)}
      */
+    @Deprecated
     public List<Presence> addOwner(String bareJID, MUCRole senderRole) throws ForbiddenException;
 
     /**
+     * Adds a new user to the list of owners.
+     * 
+     * @param jid The JID of the user to add as owner.
+     * @param senderRole the role of the user that is trying to modify the owners list.
+     * @return the list of updated presences of all the client resources that the client used to
+     *         join the room.
+     * @throws ForbiddenException If the user is not allowed to modify the owner list.
+     */
+    public List<Presence> addOwner(JID jid, MUCRole senderRole) throws ForbiddenException;
+
+    /**
      * Adds a list of users to the list of owners.
      *
      * @param newOwners the list of bare JIDs of the users to add to the list of existing owners.
@@ -335,9 +348,24 @@
      *         join the room.
      * @throws ForbiddenException If the user is not allowed to modify the admin list.
      * @throws ConflictException If the room was going to lose all its owners.
+     * @deprecated Replaced by {@link #addAdmin(JID, MUCRole)}
      */
+    @Deprecated
     public List<Presence> addAdmin(String bareJID, MUCRole senderRole) throws ForbiddenException,
             ConflictException;
+    
+    /**
+     * Adds a new user to the list of admins.
+     * 
+     * @param jid The JID of the user to add as admin.
+     * @param senderRole The role of the user that is trying to modify the admins list.
+     * @return the list of updated presences of all the client resources that the client used to
+     *         join the room.
+     * @throws ForbiddenException If the user is not allowed to modify the admin list.
+     * @throws ConflictException If the room was going to lose all its owners.
+     */
+    public List<Presence> addAdmin(JID jid, MUCRole senderRole) throws ForbiddenException,
+            ConflictException;
 
     /**
      * Adds a new user to the list of members.
@@ -350,11 +378,28 @@
      * @throws ForbiddenException If the user is not allowed to modify the members list.
      * @throws ConflictException If the desired room nickname is already reserved for the room or if
      *             the room was going to lose all its owners.
+     * @deprecated Replaced by {@link #addMember(JID, String, MUCRole)}
      */
+    @Deprecated
     public List<Presence> addMember(String bareJID, String nickname, MUCRole senderRole)
             throws ForbiddenException, ConflictException;
 
     /**
+     * Adds a new user to the list of members.
+     * 
+     * @param jid The JID of the user to add as a member.
+     * @param nickname The reserved nickname of the member for the room or null if none.
+     * @param senderRole the role of the user that is trying to modify the members list.
+     * @return the list of updated presences of all the client resources that the client used to
+     *         join the room.
+     * @throws ForbiddenException If the user is not allowed to modify the members list.
+     * @throws ConflictException If the desired room nickname is already reserved for the room or if
+     *             the room was going to lose all its owners.
+     */
+    public List<Presence> addMember(JID jid, String nickname, MUCRole senderRole)
+            throws ForbiddenException, ConflictException;
+
+    /**
      * Adds a new user to the list of outcast users.
      * 
      * @param bareJID The bare JID of the user to add as an outcast.
@@ -365,11 +410,28 @@
      * @throws NotAllowedException Thrown if trying to ban an owner or an administrator.
      * @throws ForbiddenException If the user is not allowed to modify the outcast list.
      * @throws ConflictException If the room was going to lose all its owners.
+     * @deprecated Replaced by {@link #addOutcast(JID, String, MUCRole)}
      */
+    @Deprecated
     public List<Presence> addOutcast(String bareJID, String reason, MUCRole senderRole)
             throws NotAllowedException, ForbiddenException, ConflictException;
 
     /**
+     * Adds a new user to the list of outcast users.
+     * 
+     * @param jid The JID of the user to add as an outcast.
+     * @param reason The reason why the user was banned.
+     * @param senderRole The role of the user that initiated the ban.
+     * @return the list of updated presences of all the client resources that the client used to
+     *         join the room.
+     * @throws NotAllowedException Thrown if trying to ban an owner or an administrator.
+     * @throws ForbiddenException If the user is not allowed to modify the outcast list.
+     * @throws ConflictException If the room was going to lose all its owners.
+     */
+    public List<Presence> addOutcast(JID jid, String reason, MUCRole senderRole)
+            throws NotAllowedException, ForbiddenException, ConflictException;
+
+    /**
      * Removes the user from all the other affiliation list thus giving the user a NONE affiliation.
      * 
      * @param bareJID The bare JID of the user to keep with a NONE affiliation.
@@ -378,11 +440,25 @@
      *         join the room or null if none was updated.
      * @throws ForbiddenException If the user is not allowed to modify the none list.
      * @throws ConflictException If the room was going to lose all its owners.
+     * @deprecated Replaced by {@link #addNone(JID, MUCRole)}
      */
     public List<Presence> addNone(String bareJID, MUCRole senderRole) throws ForbiddenException,
             ConflictException;
 
     /**
+     * Removes the user from all the other affiliation list thus giving the user a NONE affiliation.
+     * 
+     * @param jid The JID of the user to keep with a NONE affiliation.
+     * @param senderRole The role of the user that set the affiliation to none.
+     * @return the list of updated presences of all the client resources that the client used to
+     *         join the room or null if none was updated.
+     * @throws ForbiddenException If the user is not allowed to modify the none list.
+     * @throws ConflictException If the room was going to lose all its owners.
+     */
+    public List<Presence> addNone(JID jid, MUCRole senderRole) throws ForbiddenException,
+            ConflictException;
+
+    /**
      * Changes the role of the user within the room to moderator. A moderator is allowed to kick
      * occupants as well as granting/revoking voice from occupants.
      *
Index: src/java/org/jivesoftware/openfire/muc/spi/LocalMUCRoom.java
===================================================================
--- src/java/org/jivesoftware/openfire/muc/spi/LocalMUCRoom.java	(revision 11100)
+++ src/java/org/jivesoftware/openfire/muc/spi/LocalMUCRoom.java	(working copy)
@@ -1151,11 +1151,11 @@
      * @throws NotAllowedException If trying to change the moderator role to an owner or an admin or
      *         if trying to ban an owner or an administrator.
      */
-    private List<Presence> changeOccupantAffiliation(String bareJID, MUCRole.Affiliation newAffiliation, MUCRole.Role newRole)
+    private List<Presence> changeOccupantAffiliation(JID jid, MUCRole.Affiliation newAffiliation, MUCRole.Role newRole)
             throws NotAllowedException {
         List<Presence> presences = new ArrayList<Presence>();
         // Get all the roles (i.e. occupants) of this user based on his/her bare JID
-        List<MUCRole> roles = occupantsByBareJID.get(bareJID);
+        List<MUCRole> roles = occupantsByBareJID.get(jid.toBareJID());
         if (roles == null) {
             return presences;
         }
@@ -1232,7 +1232,12 @@
         owners.add(bareJID);
     }
 
+    @Deprecated
     public List<Presence> addOwner(String bareJID, MUCRole sendRole) throws ForbiddenException {
+        return addOwner(new JID(bareJID), sendRole);
+    }
+
+    public List<Presence> addOwner(JID jid, MUCRole sendRole) throws ForbiddenException {
         lock.writeLock().lock();
         try {
             MUCRole.Affiliation oldAffiliation = MUCRole.Affiliation.none;
@@ -1240,25 +1245,25 @@
                 throw new ForbiddenException();
             }
             // Check if user is already an owner
-            if (owners.contains(bareJID)) {
+            if (owners.contains(jid.toBareJID())) {
                 // Do nothing
                 return Collections.emptyList();
             }
-            owners.add(bareJID);
+            owners.add(jid.toBareJID());
             // Remove the user from other affiliation lists
-            if (removeAdmin(bareJID)) {
+            if (removeAdmin(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.admin;
             }
-            else if (removeMember(bareJID)) {
+            else if (removeMember(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.member;
             }
-            else if (removeOutcast(bareJID)) {
+            else if (removeOutcast(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.outcast;
             }
             // Update the DB if the room is persistent
             MUCPersistenceManager.saveAffiliationToDB(
                 this,
-                bareJID,
+                jid.toBareJID(),
                 null,
                 MUCRole.Affiliation.owner,
                 oldAffiliation);
@@ -1268,7 +1273,7 @@
         }
         // Update the presence with the new affiliation and inform all occupants
         try {
-            return changeOccupantAffiliation(bareJID, MUCRole.Affiliation.owner,
+            return changeOccupantAffiliation(jid, MUCRole.Affiliation.owner,
                     MUCRole.Role.moderator);
         }
         catch (NotAllowedException e) {
@@ -1281,7 +1286,13 @@
         return owners.remove(bareJID);
     }
 
+    @Deprecated
     public List<Presence> addAdmin(String bareJID, MUCRole sendRole) throws ForbiddenException,
+    ConflictException {
+    	return addAdmin(new JID(bareJID), sendRole);
+    }
+
+    public List<Presence> addAdmin(JID jid, MUCRole sendRole) throws ForbiddenException,
             ConflictException {
         lock.writeLock().lock();
         try {
@@ -1290,29 +1301,29 @@
                 throw new ForbiddenException();
             }
             // Check that the room always has an owner
-            if (owners.contains(bareJID) && owners.size() == 1) {
+            if (owners.contains(jid.toBareJID()) && owners.size() == 1) {
                 throw new ConflictException();
             }
             // Check if user is already an admin
-            if (admins.contains(bareJID)) {
+            if (admins.contains(jid.toBareJID())) {
                 // Do nothing
                 return Collections.emptyList();
             }
-            admins.add(bareJID);
+            admins.add(jid.toBareJID());
             // Remove the user from other affiliation lists
-            if (removeOwner(bareJID)) {
+            if (removeOwner(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.owner;
             }
-            else if (removeMember(bareJID)) {
+            else if (removeMember(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.member;
             }
-            else if (removeOutcast(bareJID)) {
+            else if (removeOutcast(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.outcast;
             }
             // Update the DB if the room is persistent
             MUCPersistenceManager.saveAffiliationToDB(
                 this,
-                bareJID,
+                jid.toBareJID(),
                 null,
                 MUCRole.Affiliation.admin,
                 oldAffiliation);
@@ -1322,7 +1333,7 @@
         }
         // Update the presence with the new affiliation and inform all occupants
         try {
-            return changeOccupantAffiliation(bareJID, MUCRole.Affiliation.admin,
+            return changeOccupantAffiliation(jid, MUCRole.Affiliation.admin,
                     MUCRole.Role.moderator);
         }
         catch (NotAllowedException e) {
@@ -1335,11 +1346,17 @@
         return admins.remove(bareJID);
     }
 
+    @Deprecated
     public List<Presence> addMember(String bareJID, String nickname, MUCRole sendRole)
             throws ForbiddenException, ConflictException {
+        return addMember(new JID(bareJID), nickname, sendRole);
+    }
+
+    public List<Presence> addMember(JID jid, String nickname, MUCRole sendRole)
+            throws ForbiddenException, ConflictException {
         lock.writeLock().lock();
         try {
-            MUCRole.Affiliation oldAffiliation = (members.containsKey(bareJID) ?
+            MUCRole.Affiliation oldAffiliation = (members.containsKey(jid.toBareJID()) ?
                     MUCRole.Affiliation.member : MUCRole.Affiliation.none);
             if (isMembersOnly()) {
                 if (!canOccupantsInvite()) {
@@ -1357,31 +1374,31 @@
             }
             // Check if the desired nickname is already reserved for another member
             if (nickname != null && nickname.trim().length() > 0 && members.containsValue(nickname)) {
-                if (!nickname.equals(members.get(bareJID))) {
+                if (!nickname.equals(members.get(jid.toBareJID()))) {
                     throw new ConflictException();
                 }
             }
             // Check that the room always has an owner
-            if (owners.contains(bareJID) && owners.size() == 1) {
+            if (owners.contains(jid.toBareJID()) && owners.size() == 1) {
                 throw new ConflictException();
             }
             // Associate the reserved nickname with the bareJID. If nickname is null then associate an
             // empty string
-            members.put(bareJID, (nickname == null ? "" : nickname));
+            members.put(jid.toBareJID(), (nickname == null ? "" : nickname));
             // Remove the user from other affiliation lists
-            if (removeOwner(bareJID)) {
+            if (removeOwner(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.owner;
             }
-            else if (removeAdmin(bareJID)) {
+            else if (removeAdmin(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.admin;
             }
-            else if (removeOutcast(bareJID)) {
+            else if (removeOutcast(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.outcast;
             }
             // Update the DB if the room is persistent
             MUCPersistenceManager.saveAffiliationToDB(
                 this,
-                bareJID,
+                jid.toBareJID(),
                 nickname,
                 MUCRole.Affiliation.member,
                 oldAffiliation);
@@ -1390,10 +1407,10 @@
             lock.writeLock().unlock();
         }
         // Update other cluster nodes with new member
-        CacheFactory.doClusterTask(new AddMember(this, bareJID, (nickname == null ? "" : nickname)));
+        CacheFactory.doClusterTask(new AddMember(this, jid.toBareJID(), (nickname == null ? "" : nickname)));
         // Update the presence with the new affiliation and inform all occupants
         try {
-            return changeOccupantAffiliation(bareJID, MUCRole.Affiliation.member,
+            return changeOccupantAffiliation(jid, MUCRole.Affiliation.member,
                     MUCRole.Role.participant);
         }
         catch (NotAllowedException e) {
@@ -1408,8 +1425,14 @@
         return answer;
     }
 
+    @Deprecated
     public List<Presence> addOutcast(String bareJID, String reason, MUCRole senderRole)
             throws NotAllowedException, ForbiddenException, ConflictException {
+        return addOutcast(new JID(bareJID), reason, senderRole);
+    }
+
+    public List<Presence> addOutcast(JID jid, String reason, MUCRole senderRole)
+            throws NotAllowedException, ForbiddenException, ConflictException {
         lock.writeLock().lock();
         try {
             MUCRole.Affiliation oldAffiliation = MUCRole.Affiliation.none;
@@ -1418,31 +1441,31 @@
                 throw new ForbiddenException();
             }
             // Check that the room always has an owner
-            if (owners.contains(bareJID) && owners.size() == 1) {
+            if (owners.contains(jid.toBareJID()) && owners.size() == 1) {
                 throw new ConflictException();
             }
             // Check if user is already an outcast
-            if (outcasts.contains(bareJID)) {
+            if (outcasts.contains(jid.toBareJID())) {
                 // Do nothing
                 return Collections.emptyList();
             }
 
             // Update the affiliation lists
-            outcasts.add(bareJID);
+            outcasts.add(jid.toBareJID());
             // Remove the user from other affiliation lists
-            if (removeOwner(bareJID)) {
+            if (removeOwner(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.owner;
             }
-            else if (removeAdmin(bareJID)) {
+            else if (removeAdmin(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.admin;
             }
-            else if (removeMember(bareJID)) {
+            else if (removeMember(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.member;
             }
             // Update the DB if the room is persistent
             MUCPersistenceManager.saveAffiliationToDB(
                 this,
-                bareJID,
+                jid.toBareJID(),
                 null,
                 MUCRole.Affiliation.outcast,
                 oldAffiliation);
@@ -1454,7 +1477,7 @@
         // actorJID will be null if the room itself (ie. via admin console) made the request
         JID actorJID = senderRole.getUserAddress();
         List<Presence> updatedPresences = changeOccupantAffiliation(
-                bareJID,
+                jid,
                 MUCRole.Affiliation.outcast,
                 MUCRole.Role.none);
         Element frag;
@@ -1481,8 +1504,14 @@
         return outcasts.remove(bareJID);
     }
 
+    @Deprecated
     public List<Presence> addNone(String bareJID, MUCRole senderRole) throws ForbiddenException,
             ConflictException {
+        return addNone(new JID(bareJID), senderRole);
+    }
+
+    public List<Presence> addNone(JID jid, MUCRole senderRole) throws ForbiddenException,
+            ConflictException {
         List<Presence> updatedPresences = null;
         boolean wasMember = false;
         lock.writeLock().lock();
@@ -1493,25 +1522,25 @@
                 throw new ForbiddenException();
             }
             // Check that the room always has an owner
-            if (owners.contains(bareJID) && owners.size() == 1) {
+            if (owners.contains(jid.toBareJID()) && owners.size() == 1) {
                 throw new ConflictException();
             }
-            wasMember = members.containsKey(bareJID) || admins.contains(bareJID) || owners.contains(bareJID);
+            wasMember = members.containsKey(jid.toBareJID()) || admins.contains(jid.toBareJID()) || owners.contains(jid.toBareJID());
             // Remove the user from ALL the affiliation lists
-            if (removeOwner(bareJID)) {
+            if (removeOwner(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.owner;
             }
-            else if (removeAdmin(bareJID)) {
+            else if (removeAdmin(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.admin;
             }
-            else if (removeMember(bareJID)) {
+            else if (removeMember(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.member;
             }
-            else if (removeOutcast(bareJID)) {
+            else if (removeOutcast(jid.toBareJID())) {
                 oldAffiliation = MUCRole.Affiliation.outcast;
             }
             // Remove the affiliation of this user from the DB if the room is persistent
-            MUCPersistenceManager.removeAffiliationFromDB(this, bareJID, oldAffiliation);
+            MUCPersistenceManager.removeAffiliationFromDB(this, jid.toBareJID(), oldAffiliation);
         }
         finally {
             lock.writeLock().unlock();
@@ -1525,7 +1554,7 @@
             else {
                 newRole = isModerated() ? MUCRole.Role.visitor : MUCRole.Role.participant;
             }
-            updatedPresences = changeOccupantAffiliation(bareJID, MUCRole.Affiliation.none, newRole);
+            updatedPresences = changeOccupantAffiliation(jid, MUCRole.Affiliation.none, newRole);
             if (isMembersOnly() && wasMember) {
                 // If the room is members-only, remove the user from the room including a status
                 // code of 321 to indicate that the user was removed because of an affiliation
@@ -2180,7 +2209,7 @@
         List<Presence> answer = new ArrayList<Presence>(newOwners.size());
         for (String newOwner : newOwners) {
             if (newOwner.trim().length() > 0 && !owners.contains(newOwner)) {
-                answer.addAll(addOwner(newOwner, senderRole));
+                answer.addAll(addOwner(new JID(newOwner), senderRole));
             }
         }
         return answer;
Index: src/java/org/jivesoftware/openfire/muc/spi/IQAdminHandler.java
===================================================================
--- src/java/org/jivesoftware/openfire/muc/spi/IQAdminHandler.java	(revision 11100)
+++ src/java/org/jivesoftware/openfire/muc/spi/IQAdminHandler.java	(working copy)
@@ -230,7 +230,7 @@
                     } else if ("member".equals(target)) {
                         // Add the user as a member of the room based on the bare JID
                         boolean hadAffiliation = room.getAffiliation(jid.toBareJID()) != MUCRole.Affiliation.none;
-                        presences.addAll(room.addMember(jid.toBareJID(), nick, senderRole));
+                        presences.addAll(room.addMember(jid, nick, senderRole));
                         // If the user had an affiliation don't send an invitation. Otherwise
                         // send an invitation if the room is members-only
                         if (!hadAffiliation && room.isMembersOnly()) {
@@ -238,11 +238,11 @@
                         }
                     } else if ("outcast".equals(target)) {
                         // Add the user as an outcast of the room based on the bare JID
-                        presences.addAll(room.addOutcast(jid.toBareJID(), item.elementTextTrim("reason"), senderRole));
+                        presences.addAll(room.addOutcast(jid, item.elementTextTrim("reason"), senderRole));
                     } else if ("none".equals(target)) {
                         if (hasAffiliation) {
                             // Set that this jid has a NONE affiliation based on the bare JID
-                            presences.addAll(room.addNone(jid.toBareJID(), senderRole));
+                            presences.addAll(room.addNone(jid, senderRole));
                         } else {
                             // Kick the user from the room
                             if (MUCRole.Role.moderator != senderRole.getRole()) {
Index: src/java/org/jivesoftware/openfire/muc/spi/IQMUCRegisterHandler.java
===================================================================
--- src/java/org/jivesoftware/openfire/muc/spi/IQMUCRegisterHandler.java	(revision 11100)
+++ src/java/org/jivesoftware/openfire/muc/spi/IQMUCRegisterHandler.java	(working copy)
@@ -158,7 +158,7 @@
 
                 if (ElementUtil.includesProperty(iq, "query.remove")) {
                     // The user is deleting his registration
-                    presences.addAll(room.addNone(packet.getFrom().toBareJID(), room.getRole()));
+                    presences.addAll(room.addNone(packet.getFrom(), room.getRole()));
                 }
                 else {
                     // The user is trying to register with a room
@@ -177,7 +177,7 @@
                         // MUCRoom.addMember in order to receive a RegistrationInfo (new class)
 
                         // Add the new member to the members list
-                        presences.addAll(room.addMember(packet.getFrom().toBareJID(),
+                        presences.addAll(room.addMember(packet.getFrom(),
                                 nickname,
                                 room.getRole()));
                     }
Index: src/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java
===================================================================
--- src/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java	(revision 11100)
+++ src/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java	(working copy)
@@ -207,21 +207,21 @@
         }
         else {
             // The client is modifying the list of owners or admins
-            Map<String,String> jids = new HashMap<String,String>();
+            Map<JID,String> jids = new HashMap<JID,String>();
             String nick;
             // Collect the new affiliations for the specified jids
             for (final Element item : itemsList) {
                 try {
                     String affiliation = item.attributeValue("affiliation");
-                    String bareJID;
+                    JID jid;
                     if (hasJID) {
-                        bareJID = new JID(item.attributeValue("jid")).toBareJID();
+                        jid = new JID(item.attributeValue("jid"));
                     } else {
                         // Get the bare JID based on the requested nick
                         nick = item.attributeValue("nick");
-                        bareJID = room.getOccupant(nick).getUserAddress().toBareJID();
+                        jid = room.getOccupant(nick).getUserAddress();
                     }
-                    jids.put(bareJID, affiliation);
+                    jids.put(jid, affiliation);
                 }
                 catch (UserNotFoundException e) {
                     // Do nothing
@@ -243,26 +243,26 @@
 
                 room.lock.readLock().unlock();
                 try {
-                    for (String bareJID : jids.keySet()) {
-                        String targetAffiliation = jids.get(bareJID);
+                    for (JID jid : jids.keySet()) {
+                        String targetAffiliation = jids.get(jid);
                         if ("owner".equals(targetAffiliation)) {
                             // Add the new user as an owner of the room
-                            presences.addAll(room.addOwner(bareJID, senderRole));
+                            presences.addAll(room.addOwner(jid, senderRole));
                         } else if ("admin".equals(targetAffiliation)) {
                             // Add the new user as an admin of the room
-                            presences.addAll(room.addAdmin(bareJID, senderRole));
+                            presences.addAll(room.addAdmin(jid, senderRole));
                         } else if ("member".equals(targetAffiliation)) {
                             // Add the new user as a member of the room
-                            boolean hadAffiliation = room.getAffiliation(bareJID) != MUCRole.Affiliation.none;
-                            presences.addAll(room.addMember(bareJID, null, senderRole));
+                            boolean hadAffiliation = room.getAffiliation(jid.toBareJID()) != MUCRole.Affiliation.none;
+                            presences.addAll(room.addMember(jid, null, senderRole));
                             // If the user had an affiliation don't send an invitation. Otherwise
                             // send an invitation if the room is members-only
                             if (!hadAffiliation && room.isMembersOnly()) {
-                                room.sendInvitation(new JID(bareJID), null, senderRole, null);
+                                room.sendInvitation(jid, null, senderRole, null);
                             }
                         } else if ("none".equals(targetAffiliation)) {
                             // Set that this jid has a NONE affiliation
-                            presences.addAll(room.addNone(bareJID, senderRole));
+                            presences.addAll(room.addNone(jid, senderRole));
                         }
                     }
                 }
@@ -512,7 +512,7 @@
             ownersToRemove.removeAll(admins);
             ownersToRemove.removeAll(owners);
             for (String jid : ownersToRemove) {
-                presences.addAll(room.addMember(jid, null, senderRole));
+                presences.addAll(room.addMember(new JID(jid), null, senderRole));
             }
         }
 
@@ -523,7 +523,7 @@
             adminsToRemove.removeAll(admins);
             adminsToRemove.removeAll(owners);
             for (String jid : adminsToRemove) {
-                presences.addAll(room.addMember(jid, null, senderRole));
+                presences.addAll(room.addMember(new JID(jid), null, senderRole));
             }
         }
 
Index: src/java/org/jivesoftware/openfire/muc/spi/MUCPersistenceManager.java
===================================================================
--- src/java/org/jivesoftware/openfire/muc/spi/MUCPersistenceManager.java	(revision 11100)
+++ src/java/org/jivesoftware/openfire/muc/spi/MUCPersistenceManager.java	(working copy)
@@ -245,7 +245,7 @@
             pstmt.setLong(1, room.getID());
             rs = pstmt.executeQuery();
             while (rs.next()) {
-                String jid = rs.getString(1);
+                JID jid = new JID(rs.getString(1));
                 MUCRole.Affiliation affiliation = MUCRole.Affiliation.valueOf(rs.getInt(2));
                 try {
                     switch (affiliation) {
@@ -260,7 +260,7 @@
                             break;
                         default:
                             Log.error("Unkown affiliation value " + affiliation + " for user "
-                                    + jid + " in persistent room " + room.getID());
+                                    + jid.toBareJID() + " in persistent room " + room.getID());
                     }
                 }
                 catch (Exception e) {
@@ -275,7 +275,7 @@
             rs = pstmt.executeQuery();
             while (rs.next()) {
                 try {
-                    room.addMember(rs.getString(1), rs.getString(2), room.getRole());
+                    room.addMember(new JID(rs.getString(1)), rs.getString(2), room.getRole());
                 }
                 catch (Exception e) {
                     Log.error(e);
@@ -538,7 +538,7 @@
             rs = pstmt.executeQuery();
             while (rs.next()) {
                 long roomID = rs.getLong(1);
-                String jid = rs.getString(2);
+                JID jid = new JID(rs.getString(2));
                 MUCRole.Affiliation affiliation = MUCRole.Affiliation.valueOf(rs.getInt(3));
                 LocalMUCRoom room = rooms.get(roomID);
                 // Skip to the next position if the room does not exist
@@ -578,7 +578,7 @@
                     continue;
                 }
                 try {
-                    room.addMember(rs.getString(2), rs.getString(3), room.getRole());
+                    room.addMember(new JID(rs.getString(2)), rs.getString(3), room.getRole());
                 }
                 catch (Exception e) {
                     Log.error(e);
Index: src/java/org/jivesoftware/openfire/muc/spi/LocalMUCUser.java
===================================================================
--- src/java/org/jivesoftware/openfire/muc/spi/LocalMUCUser.java	(revision 11100)
+++ src/java/org/jivesoftware/openfire/muc/spi/LocalMUCUser.java	(working copy)
@@ -282,15 +282,16 @@
                                     // Send invitations to invitees
                                     for (Iterator it=userInfo.elementIterator("invite");it.hasNext();) {
                                         Element info = (Element) it.next();
+                                        JID jid = new JID(info.attributeValue("to"));
 
                                         // Add the user as a member of the room if the room is
                                         // members only
                                         if (room.isMembersOnly()) {
-                                            room.addMember(info.attributeValue("to"), null, role);
+                                            room.addMember(jid, null, role);
                                         }
 
                                         // Send the invitation to the invitee
-                                        room.sendInvitation(new JID(info.attributeValue("to")),
+                                        room.sendInvitation(jid,
                                                 info.elementTextTrim("reason"), role, extensions);
                                     }
                                 }

