Commit 4d4fb6a2 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Removed passwordProtected column and instance variable. The method...

Removed passwordProtected column and instance variable. The method MUCRoom.setPasswordProtected(boolean) was also removed.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@130 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1165ee34
......@@ -155,7 +155,6 @@ CREATE TABLE mucRoom (
moderated INTEGER NOT NULL,
invitationRequired INTEGER NOT NULL,
canInvite INTEGER NOT NULL,
passwordProtected INTEGER NOT NULL,
password VARCHAR(50) NULL,
canDiscoverJID INTEGER NOT NULL,
logEnabled INTEGER NOT NULL,
......
......@@ -157,7 +157,6 @@ CREATE TABLE mucRoom (
moderated INTEGER NOT NULL,
invitationRequired INTEGER NOT NULL,
canInvite INTEGER NOT NULL,
passwordProtected INTEGER NOT NULL,
password VARCHAR(50) NULL,
canDiscoverJID INTEGER NOT NULL,
logEnabled INTEGER NOT NULL,
......
......@@ -142,7 +142,6 @@ CREATE TABLE mucRoom (
moderated TINYINT NOT NULL,
invitationRequired TINYINT NOT NULL,
canInvite TINYINT NOT NULL,
passwordProtected TINYINT NOT NULL,
password VARCHAR(50) NULL,
canDiscoverJID TINYINT NOT NULL,
logEnabled TINYINT NOT NULL,
......
......@@ -177,7 +177,6 @@ CREATE TABLE mucRoom(
moderated INTEGER NOT NULL,
invitationRequired INTEGER NOT NULL,
canInvite INTEGER NOT NULL,
passwordProtected INTEGER NOT NULL,
password VARCHAR2(50) NULL,
canDiscoverJID INTEGER NOT NULL,
logEnabled INTEGER NOT NULL,
......
......@@ -179,7 +179,6 @@ CREATE TABLE mucRoom (
moderated INTEGER NOT NULL,
invitationRequired INTEGER NOT NULL,
canInvite INTEGER NOT NULL,
passwordProtected INTEGER NOT NULL,
password VARCHAR(50) NULL,
canDiscoverJID INTEGER NOT NULL,
logEnabled INTEGER NOT NULL,
......
......@@ -179,7 +179,6 @@ CREATE TABLE mucRoom (
moderated INT NOT NULL,
invitationRequired INT NOT NULL,
canInvite INT NOT NULL,
passwordProtected INT NOT NULL,
password NVARCHAR(50) NULL,
canDiscoverJID INT NOT NULL,
logEnabled INT NOT NULL,
......
......@@ -425,8 +425,6 @@ public interface MUCRoom extends ChatDeliverer {
public boolean isPasswordProtected();
public void setPasswordProtected(boolean passwordProtected);
public boolean isPersistent();
public void setPersistent(boolean persistent);
......
......@@ -432,13 +432,19 @@ public class IQOwnerHandler {
if (field != null) {
values = field.getValues();
booleanValue = (values.hasNext() ? (String)values.next() : "1");
room.setPasswordProtected(("1".equals(booleanValue) ? true : false));
}
field = completedForm.getField("muc#owner_roomsecret");
if (field != null) {
values = completedForm.getField("muc#owner_roomsecret").getValues();
room.setPassword((values.hasNext() ? (String)values.next() : " "));
boolean isPasswordProtected = "1".equals(booleanValue);
if (isPasswordProtected) {
// The room is password protected so set the new password
field = completedForm.getField("muc#owner_roomsecret");
if (field != null) {
values = completedForm.getField("muc#owner_roomsecret").getValues();
room.setPassword((values.hasNext() ? (String)values.next() : null));
}
}
else {
// The room is not password protected so remove any previous password
room.setPassword(null);
}
}
field = completedForm.getField("muc#owner_whois");
......
......@@ -41,15 +41,15 @@ public class MUCPersistenceManager {
private static final String LOAD_ROOM_SURROGATES =
"SELECT roomID, name, description, canChangeSubject, maxUsers, " +
"moderated, invitationRequired, canInvite, passwordProtected, " +
"moderated, invitationRequired, canInvite, " +
"password, canDiscoverJID, logEnabled, subject, rolesToBroadcast " +
"FROM mucRoom WHERE inMemory=0 and publicRoom=1";
private static final String GET_RESERVED_NAME =
"SELECT nickname FROM mucMember WHERE roomID=? AND jid=?";
private static final String LOAD_ROOM =
"SELECT roomID, description, canChangeSubject, maxUsers, publicRoom, " +
"moderated, invitationRequired, canInvite, passwordProtected, " +
"password, canDiscoverJID, logEnabled, subject, rolesToBroadcast " +
"moderated, invitationRequired, canInvite, password, " +
"canDiscoverJID, logEnabled, subject, rolesToBroadcast " +
"FROM mucRoom WHERE name=?";
private static final String LOAD_AFFILIATIONS =
"SELECT jid,affiliation FROM mucAffiliation WHERE roomID=?";
......@@ -57,12 +57,12 @@ public class MUCPersistenceManager {
"SELECT jid, nickname FROM mucMember WHERE roomID=?";
private static final String UPDATE_ROOM =
"UPDATE mucRoom SET name=?, description=?, canChangeSubject=?, maxUsers=?, publicRoom=?, " +
"moderated=?, invitationRequired=?, canInvite=?, passwordProtected=?, password=?, " +
"moderated=?, invitationRequired=?, canInvite=?, password=?, " +
"canDiscoverJID=?, logEnabled=?, rolesToBroadcast=?, inMemory=? WHERE roomID=?";
private static final String ADD_ROOM =
"INSERT INTO mucRoom (roomID, name, description, canChangeSubject, maxUsers, publicRoom, " +
"moderated, invitationRequired, canInvite, passwordProtected, password, canDiscoverJID, " +
"logEnabled, subject, rolesToBroadcast, inMemory) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
"moderated, invitationRequired, canInvite, password, canDiscoverJID, " +
"logEnabled, subject, rolesToBroadcast, inMemory) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
private static final String UPDATE_SUBJECT =
"UPDATE mucRoom SET subject=? WHERE roomID=?";
private static final String UPDATE_IN_MEMORY =
......@@ -111,13 +111,12 @@ public class MUCPersistenceManager {
room.setModerated(rs.getInt(6) == 1 ? true : false);
room.setInvitationRequiredToEnter(rs.getInt(7) == 1 ? true : false);
room.setCanOccupantsInvite(rs.getInt(8) == 1 ? true : false);
room.setPasswordProtected(rs.getInt(9) == 1 ? true : false);
room.setPassword(rs.getString(10));
room.setCanAnyoneDiscoverJID(rs.getInt(11) == 1 ? true : false);
room.setLogEnabled(rs.getInt(12) == 1 ? true : false);
room.setSubject(rs.getString(13));
room.setPassword(rs.getString(9));
room.setCanAnyoneDiscoverJID(rs.getInt(10) == 1 ? true : false);
room.setLogEnabled(rs.getInt(11) == 1 ? true : false);
room.setSubject(rs.getString(12));
List rolesToBroadcast = new ArrayList();
String roles = Integer.toBinaryString(rs.getInt(14));
String roles = Integer.toBinaryString(rs.getInt(13));
if (roles.charAt(0) == '1') {
rolesToBroadcast.add("moderator");
}
......@@ -204,13 +203,12 @@ public class MUCPersistenceManager {
room.setModerated(rs.getInt(6) == 1 ? true : false);
room.setInvitationRequiredToEnter(rs.getInt(7) == 1 ? true : false);
room.setCanOccupantsInvite(rs.getInt(8) == 1 ? true : false);
room.setPasswordProtected(rs.getInt(9) == 1 ? true : false);
room.setPassword(rs.getString(10));
room.setCanAnyoneDiscoverJID(rs.getInt(11) == 1 ? true : false);
room.setLogEnabled(rs.getInt(12) == 1 ? true : false);
room.setSubject(rs.getString(13));
room.setPassword(rs.getString(9));
room.setCanAnyoneDiscoverJID(rs.getInt(10) == 1 ? true : false);
room.setLogEnabled(rs.getInt(11) == 1 ? true : false);
room.setSubject(rs.getString(12));
List rolesToBroadcast = new ArrayList();
String roles = Integer.toBinaryString(rs.getInt(14));
String roles = Integer.toBinaryString(rs.getInt(13));
if (roles.charAt(0) == '1') {
rolesToBroadcast.add("moderator");
}
......@@ -298,13 +296,12 @@ public class MUCPersistenceManager {
pstmt.setInt(6, (room.isModerated() ? 1 : 0));
pstmt.setInt(7, (room.isInvitationRequiredToEnter() ? 1 : 0));
pstmt.setInt(8, (room.canOccupantsInvite() ? 1 : 0));
pstmt.setInt(9, (room.isPasswordProtected() ? 1 : 0));
pstmt.setString(10, room.getPassword());
pstmt.setInt(11, (room.canAnyoneDiscoverJID() ? 1 : 0));
pstmt.setInt(12, (room.isLogEnabled() ? 1 : 0));
pstmt.setInt(13, marshallRolesToBroadcast(room));
pstmt.setInt(14, 1);
pstmt.setLong(15, room.getID());
pstmt.setString(9, room.getPassword());
pstmt.setInt(10, (room.canAnyoneDiscoverJID() ? 1 : 0));
pstmt.setInt(11, (room.isLogEnabled() ? 1 : 0));
pstmt.setInt(12, marshallRolesToBroadcast(room));
pstmt.setInt(13, 1);
pstmt.setLong(14, room.getID());
pstmt.executeUpdate();
}
else {
......@@ -318,13 +315,12 @@ public class MUCPersistenceManager {
pstmt.setInt(7, (room.isModerated() ? 1 : 0));
pstmt.setInt(8, (room.isInvitationRequiredToEnter() ? 1 : 0));
pstmt.setInt(9, (room.canOccupantsInvite() ? 1 : 0));
pstmt.setInt(10, (room.isPasswordProtected() ? 1 : 0));
pstmt.setString(11, room.getPassword());
pstmt.setInt(12, (room.canAnyoneDiscoverJID() ? 1 : 0));
pstmt.setInt(13, (room.isLogEnabled() ? 1 : 0));
pstmt.setString(14, room.getSubject());
pstmt.setInt(15, marshallRolesToBroadcast(room));
pstmt.setInt(16, 1); // the room starts always "in memory"
pstmt.setString(10, room.getPassword());
pstmt.setInt(11, (room.canAnyoneDiscoverJID() ? 1 : 0));
pstmt.setInt(12, (room.isLogEnabled() ? 1 : 0));
pstmt.setString(13, room.getSubject());
pstmt.setInt(14, marshallRolesToBroadcast(room));
pstmt.setInt(15, 1); // the room starts always "in memory"
pstmt.execute();
}
}
......
......@@ -106,15 +106,10 @@ class MUCPersistentRoomSurrogate implements MUCRoom, Cacheable {
*/
private boolean canOccupantsInvite = false;
/**
* Indicates if the room is password protected.
*/
private boolean passwordProtected = false;
/**
* The password that every occupant should provide in order to enter the room.
*/
private String password = "";
private String password = null;
/**
* Every presence packet can include the JID of every occupant unless the owner deactives this
......@@ -415,13 +410,9 @@ class MUCPersistentRoomSurrogate implements MUCRoom, Cacheable {
}
public boolean isPasswordProtected() {
return passwordProtected;
return password != null && password.trim().length() > 0;
}
public void setPasswordProtected(boolean passwordProtected) {
this.passwordProtected = passwordProtected;
}
public boolean isPersistent() {
return true;
}
......@@ -613,7 +604,6 @@ class MUCPersistentRoomSurrogate implements MUCRoom, Cacheable {
size += CacheSizes.sizeOfBoolean(); // moderated
size += CacheSizes.sizeOfBoolean(); // invitationRequiredToEnter
size += CacheSizes.sizeOfBoolean(); // canOccupantsInvite
size += CacheSizes.sizeOfBoolean(); // passwordProtected
size += CacheSizes.sizeOfString(password); // password
size += CacheSizes.sizeOfBoolean(); // canAnyoneDiscoverJID
size += CacheSizes.sizeOfBoolean(); // logEnabled
......
......@@ -182,15 +182,10 @@ public class MUCRoomImpl implements MUCRoom {
*/
private boolean canOccupantsInvite = false;
/**
* Indicates if the room is password protected.
*/
private boolean passwordProtected = false;
/**
* The password that every occupant should provide in order to enter the room.
*/
private String password = "";
private String password = null;
/**
* Every presence packet can include the JID of every occupant unless the owner deactives this
......@@ -1679,11 +1674,7 @@ public class MUCRoomImpl implements MUCRoom {
}
public boolean isPasswordProtected() {
return passwordProtected;
}
public void setPasswordProtected(boolean passwordProtected) {
this.passwordProtected = passwordProtected;
return password != null && password.trim().length() > 0;
}
public boolean isPersistent() {
......
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