Commit 883e29d1 authored by guus's avatar guus

Applying Guenthers patch that will prevent illegal affiliation JIDs in MUC (OF-42)

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11471 b35dd754-fafc-0310-a699-88a17e54d16e
parent 8d184d20
......@@ -306,9 +306,22 @@ public interface MUCRoom extends Externalizable, Result {
* @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.
*
......@@ -343,10 +356,25 @@ public interface MUCRoom extends Externalizable, Result {
* 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.
*
......@@ -358,10 +386,27 @@ public interface MUCRoom extends Externalizable, Result {
* @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.
*
......@@ -373,10 +418,27 @@ public interface MUCRoom extends Externalizable, Result {
* @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.
*
......@@ -386,10 +448,24 @@ public interface MUCRoom extends Externalizable, Result {
* 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.
......
......@@ -243,7 +243,7 @@ public class IQAdminHandler {
} 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()) {
......@@ -251,11 +251,11 @@ public class IQAdminHandler {
}
} 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()) {
......
......@@ -169,7 +169,7 @@ class IQMUCRegisterHandler {
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
......@@ -188,7 +188,7 @@ class IQMUCRegisterHandler {
// 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()));
}
......
......@@ -219,21 +219,21 @@ public class IQOwnerHandler {
}
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
......@@ -255,26 +255,26 @@ public class IQOwnerHandler {
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));
}
}
}
......@@ -524,7 +524,7 @@ public class IQOwnerHandler {
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));
}
}
......@@ -535,7 +535,7 @@ public class IQOwnerHandler {
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));
}
}
......
......@@ -1226,11 +1226,11 @@ public class LocalMUCRoom implements MUCRoom {
* @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;
}
......@@ -1307,7 +1307,12 @@ public class LocalMUCRoom implements MUCRoom {
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;
......@@ -1315,25 +1320,25 @@ public class LocalMUCRoom implements MUCRoom {
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);
......@@ -1343,7 +1348,7 @@ public class LocalMUCRoom implements MUCRoom {
}
// 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) {
......@@ -1356,7 +1361,13 @@ public class LocalMUCRoom implements MUCRoom {
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 {
......@@ -1365,29 +1376,29 @@ public class LocalMUCRoom implements MUCRoom {
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);
......@@ -1397,7 +1408,7 @@ public class LocalMUCRoom implements MUCRoom {
}
// 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) {
......@@ -1410,11 +1421,17 @@ public class LocalMUCRoom implements MUCRoom {
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()) {
......@@ -1432,31 +1449,31 @@ public class LocalMUCRoom implements MUCRoom {
}
// 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);
......@@ -1465,10 +1482,10 @@ public class LocalMUCRoom implements MUCRoom {
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) {
......@@ -1483,8 +1500,14 @@ public class LocalMUCRoom implements MUCRoom {
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;
......@@ -1493,31 +1516,31 @@ public class LocalMUCRoom implements MUCRoom {
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);
......@@ -1529,7 +1552,7 @@ public class LocalMUCRoom implements MUCRoom {
// 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;
......@@ -1556,8 +1579,14 @@ public class LocalMUCRoom implements MUCRoom {
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();
......@@ -1568,25 +1597,25 @@ public class LocalMUCRoom implements MUCRoom {
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();
......@@ -1600,7 +1629,7 @@ public class LocalMUCRoom implements MUCRoom {
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
......@@ -2255,7 +2284,7 @@ public class LocalMUCRoom implements MUCRoom {
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;
......
......@@ -315,15 +315,16 @@ public class LocalMUCUser implements MUCUser {
// 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);
}
}
......
......@@ -263,7 +263,7 @@ public class MUCPersistenceManager {
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) {
......@@ -278,7 +278,7 @@ public class MUCPersistenceManager {
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) {
......@@ -293,7 +293,7 @@ public class MUCPersistenceManager {
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.getMessage(), e);
......@@ -556,7 +556,7 @@ public class MUCPersistenceManager {
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
......@@ -596,7 +596,7 @@ public class MUCPersistenceManager {
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.getMessage(), 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