From ddfdb2e6aa594d13686e435fce8683b59ab5f777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CHuy?= Date: Tue, 26 Nov 2024 13:40:36 +0000 Subject: [PATCH 1/7] OF-2916 and OF-2917: Add preserveHistOnRoomDeletion field to the ofMucRoom table creation scripts. This new field determines whether a room's chat history is preserved or removed upon its deletion. --- distribution/src/database/openfire_db2.sql | 57 ++++++++++--------- distribution/src/database/openfire_hsqldb.sql | 57 ++++++++++--------- distribution/src/database/openfire_mysql.sql | 57 ++++++++++--------- distribution/src/database/openfire_oracle.sql | 57 ++++++++++--------- .../src/database/openfire_postgresql.sql | 57 ++++++++++--------- .../src/database/openfire_sqlserver.sql | 57 ++++++++++--------- distribution/src/database/openfire_sybase.sql | 57 ++++++++++--------- 7 files changed, 203 insertions(+), 196 deletions(-) diff --git a/distribution/src/database/openfire_db2.sql b/distribution/src/database/openfire_db2.sql index a9376a0bcd..8fdef92fb0 100644 --- a/distribution/src/database/openfire_db2.sql +++ b/distribution/src/database/openfire_db2.sql @@ -192,34 +192,35 @@ CREATE TABLE ofMucServiceProp ( ); CREATE TABLE ofMucRoom ( - serviceID INTEGER NOT NULL, - roomID INTEGER NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name VARCHAR(50) NOT NULL, - naturalName VARCHAR(255) NOT NULL, - description VARCHAR(255), - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15), - canChangeSubject INTEGER NOT NULL, - maxUsers INTEGER NOT NULL, - publicRoom INTEGER NOT NULL, - moderated INTEGER NOT NULL, - membersOnly INTEGER NOT NULL, - canInvite INTEGER NOT NULL, - roomPassword VARCHAR(50), - canDiscoverJID INTEGER NOT NULL, - logEnabled INTEGER NOT NULL, - subject VARCHAR(100), - rolesToBroadcast INTEGER NOT NULL, - useReservedNick INTEGER NOT NULL, - canChangeNick INTEGER NOT NULL, - canRegister INTEGER NOT NULL, - allowpm INTEGER NULL, - fmucEnabled INTEGER NULL, - fmucOutboundNode VARCHAR(255) NULL, - fmucOutboundMode INTEGER NULL, - fmucInboundNodes VARCHAR(2000) NULL, + serviceID INTEGER NOT NULL, + roomID INTEGER NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name VARCHAR(50) NOT NULL, + naturalName VARCHAR(255) NOT NULL, + description VARCHAR(255), + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15), + canChangeSubject INTEGER NOT NULL, + maxUsers INTEGER NOT NULL, + publicRoom INTEGER NOT NULL, + moderated INTEGER NOT NULL, + membersOnly INTEGER NOT NULL, + canInvite INTEGER NOT NULL, + roomPassword VARCHAR(50), + canDiscoverJID INTEGER NOT NULL, + logEnabled INTEGER NOT NULL, + preserveHistOnRoomDeletion INTEGER NOT NULL, + subject VARCHAR(100), + rolesToBroadcast INTEGER NOT NULL, + useReservedNick INTEGER NOT NULL, + canChangeNick INTEGER NOT NULL, + canRegister INTEGER NOT NULL, + allowpm INTEGER NULL, + fmucEnabled INTEGER NULL, + fmucOutboundNode VARCHAR(255) NULL, + fmucOutboundMode INTEGER NULL, + fmucInboundNodes VARCHAR(2000) NULL, CONSTRAINT ofMucRoom_pk PRIMARY KEY (serviceID, name) ); CREATE INDEX ofMucRoom_roomid_idx ON ofMucRoom (roomID); diff --git a/distribution/src/database/openfire_hsqldb.sql b/distribution/src/database/openfire_hsqldb.sql index 85dc895d40..1938c32fb7 100644 --- a/distribution/src/database/openfire_hsqldb.sql +++ b/distribution/src/database/openfire_hsqldb.sql @@ -188,34 +188,35 @@ CREATE TABLE ofMucServiceProp ( ); CREATE TABLE ofMucRoom ( - serviceID BIGINT NOT NULL, - roomID BIGINT NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name VARCHAR(50) NOT NULL, - naturalName VARCHAR(255) NOT NULL, - description VARCHAR(255), - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15) NULL, - canChangeSubject INTEGER NOT NULL, - maxUsers INTEGER NOT NULL, - publicRoom INTEGER NOT NULL, - moderated INTEGER NOT NULL, - membersOnly INTEGER NOT NULL, - canInvite INTEGER NOT NULL, - roomPassword VARCHAR(50) NULL, - canDiscoverJID INTEGER NOT NULL, - logEnabled INTEGER NOT NULL, - subject VARCHAR(100) NULL, - rolesToBroadcast INTEGER NOT NULL, - useReservedNick INTEGER NOT NULL, - canChangeNick INTEGER NOT NULL, - canRegister INTEGER NOT NULL, - allowpm INTEGER NULL, - fmucEnabled INTEGER NULL, - fmucOutboundNode VARCHAR(255) NULL, - fmucOutboundMode INTEGER NULL, - fmucInboundNodes VARCHAR(4000) NULL, + serviceID BIGINT NOT NULL, + roomID BIGINT NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name VARCHAR(50) NOT NULL, + naturalName VARCHAR(255) NOT NULL, + description VARCHAR(255), + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15) NULL, + canChangeSubject INTEGER NOT NULL, + maxUsers INTEGER NOT NULL, + publicRoom INTEGER NOT NULL, + moderated INTEGER NOT NULL, + membersOnly INTEGER NOT NULL, + canInvite INTEGER NOT NULL, + roomPassword VARCHAR(50) NULL, + canDiscoverJID INTEGER NOT NULL, + logEnabled INTEGER NOT NULL, + preserveHistOnRoomDeletion INTEGER NOT NULL, + subject VARCHAR(100) NULL, + rolesToBroadcast INTEGER NOT NULL, + useReservedNick INTEGER NOT NULL, + canChangeNick INTEGER NOT NULL, + canRegister INTEGER NOT NULL, + allowpm INTEGER NULL, + fmucEnabled INTEGER NULL, + fmucOutboundNode VARCHAR(255) NULL, + fmucOutboundMode INTEGER NULL, + fmucInboundNodes VARCHAR(4000) NULL, CONSTRAINT ofMucRoom_pk PRIMARY KEY (serviceID, name) ); CREATE INDEX ofMucRoom_roomid_idx ON ofMucRoom (roomID); diff --git a/distribution/src/database/openfire_mysql.sql b/distribution/src/database/openfire_mysql.sql index 393ac530a0..6931262265 100644 --- a/distribution/src/database/openfire_mysql.sql +++ b/distribution/src/database/openfire_mysql.sql @@ -178,34 +178,35 @@ CREATE TABLE ofMucServiceProp ( ); CREATE TABLE ofMucRoom ( - serviceID BIGINT NOT NULL, - roomID BIGINT NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name VARCHAR(50) NOT NULL, - naturalName VARCHAR(255) NOT NULL, - description VARCHAR(255), - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15) NULL, - canChangeSubject TINYINT NOT NULL, - maxUsers INTEGER NOT NULL, - publicRoom TINYINT NOT NULL, - moderated TINYINT NOT NULL, - membersOnly TINYINT NOT NULL, - canInvite TINYINT NOT NULL, - roomPassword VARCHAR(50) NULL, - canDiscoverJID TINYINT NOT NULL, - logEnabled TINYINT NOT NULL, - subject VARCHAR(100) NULL, - rolesToBroadcast TINYINT NOT NULL, - useReservedNick TINYINT NOT NULL, - canChangeNick TINYINT NOT NULL, - canRegister TINYINT NOT NULL, - allowpm TINYINT NULL, - fmucEnabled TINYINT NULL, - fmucOutboundNode VARCHAR(255) NULL, - fmucOutboundMode TINYINT NULL, - fmucInboundNodes VARCHAR(4000) NULL, + serviceID BIGINT NOT NULL, + roomID BIGINT NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name VARCHAR(50) NOT NULL, + naturalName VARCHAR(255) NOT NULL, + description VARCHAR(255), + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15) NULL, + canChangeSubject TINYINT NOT NULL, + maxUsers INTEGER NOT NULL, + publicRoom TINYINT NOT NULL, + moderated TINYINT NOT NULL, + membersOnly TINYINT NOT NULL, + canInvite TINYINT NOT NULL, + roomPassword VARCHAR(50) NULL, + canDiscoverJID TINYINT NOT NULL, + logEnabled TINYINT NOT NULL, + preserveHistOnRoomDeletion TINYINT NOT NULL, + subject VARCHAR(100) NULL, + rolesToBroadcast TINYINT NOT NULL, + useReservedNick TINYINT NOT NULL, + canChangeNick TINYINT NOT NULL, + canRegister TINYINT NOT NULL, + allowpm TINYINT NULL, + fmucEnabled TINYINT NULL, + fmucOutboundNode VARCHAR(255) NULL, + fmucOutboundMode TINYINT NULL, + fmucInboundNodes VARCHAR(4000) NULL, PRIMARY KEY (serviceID,name), INDEX ofMucRoom_roomid_idx (roomID), INDEX ofMucRoom_serviceid_idx (serviceID) diff --git a/distribution/src/database/openfire_oracle.sql b/distribution/src/database/openfire_oracle.sql index 86d6e09dd0..5b254d7112 100644 --- a/distribution/src/database/openfire_oracle.sql +++ b/distribution/src/database/openfire_oracle.sql @@ -185,34 +185,35 @@ CREATE TABLE ofMucServiceProp ( ); CREATE TABLE ofMucRoom( - serviceID INT NOT NULL, - roomID INT NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name VARCHAR2(50) NOT NULL, - naturalName VARCHAR2(255) NOT NULL, - description VARCHAR2(255), - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15) NULL, - canChangeSubject INTEGER NOT NULL, - maxUsers INTEGER NOT NULL, - publicRoom INTEGER NOT NULL, - moderated INTEGER NOT NULL, - membersOnly INTEGER NOT NULL, - canInvite INTEGER NOT NULL, - roomPassword VARCHAR2(50) NULL, - canDiscoverJID INTEGER NOT NULL, - logEnabled INTEGER NOT NULL, - subject VARCHAR2(100) NULL, - rolesToBroadcast INTEGER NOT NULL, - useReservedNick INTEGER NOT NULL, - canChangeNick INTEGER NOT NULL, - canRegister INTEGER NOT NULL, - allowpm INTEGER NULL, - fmucEnabled INTEGER NULL, - fmucOutboundNode VARCHAR2(255) NULL, - fmucOutboundMode INTEGER NULL, - fmucInboundNodes VARCHAR2(4000) NULL, + serviceID INT NOT NULL, + roomID INT NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name VARCHAR2(50) NOT NULL, + naturalName VARCHAR2(255) NOT NULL, + description VARCHAR2(255), + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15) NULL, + canChangeSubject INTEGER NOT NULL, + maxUsers INTEGER NOT NULL, + publicRoom INTEGER NOT NULL, + moderated INTEGER NOT NULL, + membersOnly INTEGER NOT NULL, + canInvite INTEGER NOT NULL, + roomPassword VARCHAR2(50) NULL, + canDiscoverJID INTEGER NOT NULL, + logEnabled INTEGER NOT NULL, + preserveHistOnRoomDeletion INTEGER NOT NULL, + subject VARCHAR2(100) NULL, + rolesToBroadcast INTEGER NOT NULL, + useReservedNick INTEGER NOT NULL, + canChangeNick INTEGER NOT NULL, + canRegister INTEGER NOT NULL, + allowpm INTEGER NULL, + fmucEnabled INTEGER NULL, + fmucOutboundNode VARCHAR2(255) NULL, + fmucOutboundMode INTEGER NULL, + fmucInboundNodes VARCHAR2(4000) NULL, CONSTRAINT ofMucRoom_pk PRIMARY KEY (serviceID, name) ); CREATE INDEX ofMucRoom_roomid_idx ON ofMucRoom (roomID); diff --git a/distribution/src/database/openfire_postgresql.sql b/distribution/src/database/openfire_postgresql.sql index ae1a3d7626..2d25a06252 100644 --- a/distribution/src/database/openfire_postgresql.sql +++ b/distribution/src/database/openfire_postgresql.sql @@ -193,34 +193,35 @@ CREATE TABLE ofMucServiceProp ( ); CREATE TABLE ofMucRoom ( - serviceID INTEGER NOT NULL, - roomID INTEGER NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name VARCHAR(50) NOT NULL, - naturalName VARCHAR(255) NOT NULL, - description VARCHAR(255), - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15) NULL, - canChangeSubject INTEGER NOT NULL, - maxUsers INTEGER NOT NULL, - publicRoom INTEGER NOT NULL, - moderated INTEGER NOT NULL, - membersOnly INTEGER NOT NULL, - canInvite INTEGER NOT NULL, - roomPassword VARCHAR(50) NULL, - canDiscoverJID INTEGER NOT NULL, - logEnabled INTEGER NOT NULL, - subject VARCHAR(100) NULL, - rolesToBroadcast INTEGER NOT NULL, - useReservedNick INTEGER NOT NULL, - canChangeNick INTEGER NOT NULL, - canRegister INTEGER NOT NULL, - allowpm INTEGER NULL, - fmucEnabled INTEGER NULL, - fmucOutboundNode TEXT NULL, - fmucOutboundMode INTEGER NULL, - fmucInboundNodes TEXT NULL, + serviceID INTEGER NOT NULL, + roomID INTEGER NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name VARCHAR(50) NOT NULL, + naturalName VARCHAR(255) NOT NULL, + description VARCHAR(255), + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15) NULL, + canChangeSubject INTEGER NOT NULL, + maxUsers INTEGER NOT NULL, + publicRoom INTEGER NOT NULL, + moderated INTEGER NOT NULL, + membersOnly INTEGER NOT NULL, + canInvite INTEGER NOT NULL, + roomPassword VARCHAR(50) NULL, + canDiscoverJID INTEGER NOT NULL, + logEnabled INTEGER NOT NULL, + preserveHistOnRoomDeletion INTEGER NOT NULL, + subject VARCHAR(100) NULL, + rolesToBroadcast INTEGER NOT NULL, + useReservedNick INTEGER NOT NULL, + canChangeNick INTEGER NOT NULL, + canRegister INTEGER NOT NULL, + allowpm INTEGER NULL, + fmucEnabled INTEGER NULL, + fmucOutboundNode TEXT NULL, + fmucOutboundMode INTEGER NULL, + fmucInboundNodes TEXT NULL, CONSTRAINT ofMucRoom_pk PRIMARY KEY (serviceID, name) ); CREATE INDEX ofMucRoom_roomid_idx ON ofMucRoom(roomID); diff --git a/distribution/src/database/openfire_sqlserver.sql b/distribution/src/database/openfire_sqlserver.sql index 37e9135485..a57834f993 100644 --- a/distribution/src/database/openfire_sqlserver.sql +++ b/distribution/src/database/openfire_sqlserver.sql @@ -191,34 +191,35 @@ CREATE TABLE ofMucServiceProp ( ); CREATE TABLE ofMucRoom ( - serviceID INT NOT NULL, - roomID INT NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name NVARCHAR(50) NOT NULL, - naturalName NVARCHAR(255) NOT NULL, - description NVARCHAR(255), - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15) NULL, - canChangeSubject INT NOT NULL, - maxUsers INT NOT NULL, - publicRoom INT NOT NULL, - moderated INT NOT NULL, - membersOnly INT NOT NULL, - canInvite INT NOT NULL, - roomPassword NVARCHAR(50) NULL, - canDiscoverJID INT NOT NULL, - logEnabled INT NOT NULL, - subject NVARCHAR(100) NULL, - rolesToBroadcast INT NOT NULL, - useReservedNick INT NOT NULL, - canChangeNick INT NOT NULL, - canRegister INT NOT NULL, - allowpm INT NULL, - fmucEnabled INT NULL, - fmucOutboundNode NVARCHAR(255) NULL, - fmucOutboundMode INT NULL, - fmucInboundNodes NVARCHAR(2000) NULL, + serviceID INT NOT NULL, + roomID INT NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name NVARCHAR(50) NOT NULL, + naturalName NVARCHAR(255) NOT NULL, + description NVARCHAR(255), + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15) NULL, + canChangeSubject INT NOT NULL, + maxUsers INT NOT NULL, + publicRoom INT NOT NULL, + moderated INT NOT NULL, + membersOnly INT NOT NULL, + canInvite INT NOT NULL, + roomPassword NVARCHAR(50) NULL, + canDiscoverJID INT NOT NULL, + logEnabled INT NOT NULL, + preserveHistOnRoomDeletion INT NOT NULL, + subject NVARCHAR(100) NULL, + rolesToBroadcast INT NOT NULL, + useReservedNick INT NOT NULL, + canChangeNick INT NOT NULL, + canRegister INT NOT NULL, + allowpm INT NULL, + fmucEnabled INT NULL, + fmucOutboundNode NVARCHAR(255) NULL, + fmucOutboundMode INT NULL, + fmucInboundNodes NVARCHAR(2000) NULL, CONSTRAINT ofMucRoom_pk PRIMARY KEY (serviceID, name) ); CREATE INDEX ofMucRoom_roomid_idx on ofMucRoom(roomID); diff --git a/distribution/src/database/openfire_sybase.sql b/distribution/src/database/openfire_sybase.sql index 6210d0fa6e..d775ad468c 100644 --- a/distribution/src/database/openfire_sybase.sql +++ b/distribution/src/database/openfire_sybase.sql @@ -190,34 +190,35 @@ CREATE TABLE ofMucServiceProp ( ) CREATE TABLE ofMucRoom ( - serviceID INT NOT NULL, - roomID INT NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name NVARCHAR(50) NOT NULL, - naturalName NVARCHAR(255) NOT NULL, - description NVARCHAR(255) NULL, - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15) NULL, - canChangeSubject INT NOT NULL, - maxUsers INT NOT NULL, - publicRoom INT NOT NULL, - moderated INT NOT NULL, - membersOnly INT NOT NULL, - canInvite INT NOT NULL, - roomPassword NVARCHAR(50) NULL, - canDiscoverJID INT NOT NULL, - logEnabled INT NOT NULL, - subject NVARCHAR(100) NULL, - rolesToBroadcast INT NOT NULL, - useReservedNick INT NOT NULL, - canChangeNick INT NOT NULL, - canRegister INT NOT NULL, - allowpm INT NULL, - fmucEnabled INT NULL, - fmucOutboundNode NVARCHAR(255) NULL, - fmucOutboundMode INT NULL, - fmucInboundNodes NVARCHAR(2000) NULL, + serviceID INT NOT NULL, + roomID INT NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name NVARCHAR(50) NOT NULL, + naturalName NVARCHAR(255) NOT NULL, + description NVARCHAR(255) NULL, + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15) NULL, + canChangeSubject INT NOT NULL, + maxUsers INT NOT NULL, + publicRoom INT NOT NULL, + moderated INT NOT NULL, + membersOnly INT NOT NULL, + canInvite INT NOT NULL, + roomPassword NVARCHAR(50) NULL, + canDiscoverJID INT NOT NULL, + logEnabled INT NOT NULL, + preserveHistOnRoomDeletion INT NOT NULL, + subject NVARCHAR(100) NULL, + rolesToBroadcast INT NOT NULL, + useReservedNick INT NOT NULL, + canChangeNick INT NOT NULL, + canRegister INT NOT NULL, + allowpm INT NULL, + fmucEnabled INT NULL, + fmucOutboundNode NVARCHAR(255) NULL, + fmucOutboundMode INT NULL, + fmucInboundNodes NVARCHAR(2000) NULL, CONSTRAINT ofMucRoom_pk PRIMARY KEY (serviceID, name) ) CREATE INDEX ofMucRoom_roomid_idx on ofMucRoom(roomID) From 98622cebf73b3cb400f105a5c55291760a5672ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CHuy?= Date: Tue, 26 Nov 2024 13:52:20 +0000 Subject: [PATCH 2/7] OF-2916 and OF-2917: Add new language-specific labels for the preserveHistOnRoomDeletion field.[C --- i18n/src/main/resources/openfire_i18n.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/i18n/src/main/resources/openfire_i18n.properties b/i18n/src/main/resources/openfire_i18n.properties index 1cca96b52a..91f18ef5b0 100644 --- a/i18n/src/main/resources/openfire_i18n.properties +++ b/i18n/src/main/resources/openfire_i18n.properties @@ -379,6 +379,7 @@ muc.form.conf.owner_roomsecret=Password muc.form.conf.owner_whois=Role that May Discover Real JIDs of Occupants muc.form.conf.anyone=Anyone muc.form.conf.owner_enablelogging=Log Room Conversations +muc.form.conf.owner_preservehistondel=Preserve Chat History on Room Deletion muc.form.conf.owner_reservednick=Only login with registered nickname muc.form.conf.owner_canchangenick=Allow Occupants to change nicknames muc.form.conf.owner_registration=Allow Users to register with the room @@ -772,6 +773,7 @@ muc.default.settings.reserved_nick=Only login with registered nickname muc.default.settings.can_change_nick=Allow Occupants to change nicknames muc.default.settings.registration=Allow Users to register with the room muc.default.settings.enable_logging=Log Room Conversations +muc.default.settings.preserve_hist_on_room_deletion=Preserve Chat History on Room Deletion muc.default.settings.max_users=Maximum Room Occupants muc.default.settings.error=Error while saving default settings. muc.default.settings.update=Settings updated successfully. @@ -892,6 +894,7 @@ muc.room.edit.form.reservednick=Only login with registered nickname muc.room.edit.form.canchangenick=Allow Occupants to change nicknames muc.room.edit.form.registration=Allow Users to register with the room muc.room.edit.form.log=Log Room Conversations +muc.room.edit.form.preserve_hist_on_room_deletion=Preserve Chat History on Room Deletion muc.room.edit.form.required_field=Required Field # Muc room federation (FMUC) page From cd5507b2e8d937c65867eebf088e519b83d27f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CHuy?= Date: Tue, 26 Nov 2024 14:41:30 +0000 Subject: [PATCH 3/7] OF-2916 and OF-2917: Add a new preserveHistOnRoomDeletion field to the MUCRoom class so it can be accessed during runtime. --- .../jivesoftware/openfire/muc/MUCRoom.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java b/xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java index 208b1e0110..001346a47a 100644 --- a/xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java +++ b/xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java @@ -235,6 +235,12 @@ public class MUCRoom implements GroupEventListener, UserEventListener, Externali */ private boolean logEnabled; + /** + * Enables the preservation of chat history after a room is deleted. The chat history logged + * when logEnabled is true will be removed, on room deletion, if this is false. + */ + private boolean preserveHistOnRoomDeletion; + /** * Enables the logging of the conversation. The conversation in the room will be saved to the * database. @@ -369,6 +375,7 @@ public MUCRoom(@Nonnull MultiUserChatService chatService, @Nonnull String roomNa this.canOccupantsInvite = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.canOccupantsInvite", false); this.canAnyoneDiscoverJID = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.canAnyoneDiscoverJID", true); this.logEnabled = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.logEnabled", true); + this.preserveHistOnRoomDeletion = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.preserveHistOnRoomDeletion", true); this.loginRestrictedToNickname = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.loginRestrictedToNickname", false); this.canChangeNickname = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.canChangeNickname", true); this.registrationEnabled = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.registrationEnabled", true); @@ -3135,6 +3142,24 @@ public boolean isLogEnabled() { return logEnabled; } + /** + * Sets if the room's conversation will be preserved when the room is deleted. + * + * @param preserveHistOnRoomDeletion boolean that specified if the room's conversation will be preserved on deletion. + */ + public void setPreserveHistOnRoomDeletionEnabled(boolean preserveHistOnRoomDeletion) { + this.preserveHistOnRoomDeletion = preserveHistOnRoomDeletion; + } + + /** + * Returns true if the room's conversation will be preserved when the room is deleted. + * + * @return true if the room's conversation is being logged. + */ + public boolean isPreserveHistOnRoomDeletionEnabled() { + return preserveHistOnRoomDeletion; + } + /** * Sets if the room's conversation is being logged. If logging is activated the room * conversation will be saved to the database every couple of minutes. The saving frequency is @@ -3633,6 +3658,7 @@ public int getCachedSize() throws CannotCalculateSizeException { size += CacheSizes.sizeOfBoolean(); // canAnyoneDiscoverJID size += CacheSizes.sizeOfString(canSendPrivateMessage); size += CacheSizes.sizeOfBoolean(); // logEnabled + size += CacheSizes.sizeOfBoolean(); // preserveHistOnRoomDeletion size += CacheSizes.sizeOfBoolean(); // loginRestrictedToNickname size += CacheSizes.sizeOfBoolean(); // canChangeNickname size += CacheSizes.sizeOfBoolean(); // registrationEnabled @@ -3679,6 +3705,7 @@ public void writeExternal(ObjectOutput out) throws IOException { ExternalizableUtil.getInstance().writeBoolean(out, canAnyoneDiscoverJID); ExternalizableUtil.getInstance().writeSafeUTF(out, canSendPrivateMessage); ExternalizableUtil.getInstance().writeBoolean(out, logEnabled); + ExternalizableUtil.getInstance().writeBoolean(out, preserveHistOnRoomDeletion); ExternalizableUtil.getInstance().writeBoolean(out, loginRestrictedToNickname); ExternalizableUtil.getInstance().writeBoolean(out, canChangeNickname); ExternalizableUtil.getInstance().writeBoolean(out, registrationEnabled); @@ -3737,6 +3764,7 @@ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundExcept canAnyoneDiscoverJID = ExternalizableUtil.getInstance().readBoolean(in); canSendPrivateMessage = ExternalizableUtil.getInstance().readSafeUTF(in); logEnabled = ExternalizableUtil.getInstance().readBoolean(in); + preserveHistOnRoomDeletion = ExternalizableUtil.getInstance().readBoolean(in); loginRestrictedToNickname = ExternalizableUtil.getInstance().readBoolean(in); canChangeNickname = ExternalizableUtil.getInstance().readBoolean(in); registrationEnabled = ExternalizableUtil.getInstance().readBoolean(in); @@ -3801,6 +3829,7 @@ public void updateConfiguration(MUCRoom otherRoom) { password = otherRoom.password; canAnyoneDiscoverJID = otherRoom.canAnyoneDiscoverJID; logEnabled = otherRoom.logEnabled; + preserveHistOnRoomDeletion = otherRoom.preserveHistOnRoomDeletion; loginRestrictedToNickname = otherRoom.loginRestrictedToNickname; canChangeNickname = otherRoom.canChangeNickname; registrationEnabled = otherRoom.registrationEnabled; From d83f6a03f3c7c740d0e79ea0f497c2a4b59a0820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CHuy?= Date: Tue, 26 Nov 2024 14:41:58 +0000 Subject: [PATCH 4/7] OF-2916 and OF-2917: Update processConfigurationForm in IQOwnerHandler to use the new preserveHistOnRoomDeletion field for processing room configuration. --- .../openfire/muc/spi/IQOwnerHandler.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java b/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java index 31f0ec04bc..a44d106e0f 100644 --- a/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java +++ b/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java @@ -278,6 +278,12 @@ private void processConfigurationForm(@Nonnull final DataForm completedForm, @No room.setPublicRoom( parseFirstValueAsBoolean( field, true ) ); } + field = completedForm.getField("muc#roomconfig_preservehistondel"); + if (field != null) { + final boolean newValue = parseFirstValueAsBoolean(field, true); + room.setPreserveHistOnRoomDeletionEnabled(newValue); + } + field = completedForm.getField("muc#roomconfig_persistentroom"); if (field != null) { boolean isPersistent = parseFirstValueAsBoolean( field, true ); @@ -570,6 +576,10 @@ private Element generateProbeResult(Locale preferredLocale) { LocaleUtils.getLocalizedString("muc.form.conf.owner_enablelogging", preferredLocale), Type.boolean_type); + configurationForm.addField("muc#roomconfig_preservehistondel", + LocaleUtils.getLocalizedString("muc.form.conf.owner_preservehistondel", preferredLocale), + Type.boolean_type); + configurationForm.addField("x-muc#roomconfig_reservednick", LocaleUtils.getLocalizedString("muc.form.conf.owner_reservednick", preferredLocale), Type.boolean_type); @@ -663,6 +673,10 @@ private Element generateProbeResult(Locale preferredLocale) { field.clearValues(); field.addValue((room.isLogEnabled() ? "1" : "0")); + field = configurationForm.getField("muc#roomconfig_preservehistondel"); + field.clearValues(); + field.addValue((room.isPreserveHistOnRoomDeletionEnabled() ? "1" : "0")); + field = configurationForm.getField("x-muc#roomconfig_reservednick"); field.clearValues(); field.addValue((room.isLoginRestrictedToNickname() ? "1" : "0")); From 0adb42eafddf8fb11e8fc93ab860ea4b13e428d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CHuy?= Date: Tue, 26 Nov 2024 14:42:32 +0000 Subject: [PATCH 5/7] OF-2916 and OF-2917: 1. Update the SQL queries used in MUCPersistenceManager to load and store room settings and history, incorporating the new preserveHistOnRoomDeletion field. 2. Add functionality to remove room history stored in ofMucConversationLog upon room deletion. 3. Add the new preserveHistOnRoomDeletion field to the MUC default room settings screen, as well as to the room edit and creation screens. --- .../muc/spi/MUCPersistenceManager.java | 88 +++++++++++-------- .../src/main/webapp/muc-default-settings.jsp | 12 +++ .../src/main/webapp/muc-room-edit-form.jsp | 9 ++ 3 files changed, 71 insertions(+), 38 deletions(-) diff --git a/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/MUCPersistenceManager.java b/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/MUCPersistenceManager.java index 3763a9194a..ba7f4cd4df 100644 --- a/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/MUCPersistenceManager.java +++ b/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/MUCPersistenceManager.java @@ -61,7 +61,7 @@ public class MUCPersistenceManager { private static final String LOAD_ROOM = "SELECT roomID, creationDate, modificationDate, naturalName, description, lockedDate, " + "emptyDate, canChangeSubject, maxUsers, publicRoom, moderated, membersOnly, canInvite, " + - "roomPassword, canDiscoverJID, logEnabled, subject, rolesToBroadcast, useReservedNick, " + + "roomPassword, canDiscoverJID, logEnabled, preserveHistOnRoomDeletion, subject, rolesToBroadcast, useReservedNick, " + "canChangeNick, canRegister, allowpm, fmucEnabled, fmucOutboundNode, fmucOutboundMode, " + "fmucInboundNodes " + " FROM ofMucRoom WHERE serviceID=? AND name=?"; @@ -75,14 +75,14 @@ public class MUCPersistenceManager { private static final String RELOAD_ALL_ROOMS_WITH_RECENT_ACTIVITY = "SELECT roomID, creationDate, modificationDate, name, naturalName, description, " + "lockedDate, emptyDate, canChangeSubject, maxUsers, publicRoom, moderated, membersOnly, " + - "canInvite, roomPassword, canDiscoverJID, logEnabled, subject, rolesToBroadcast, " + + "canInvite, roomPassword, canDiscoverJID, logEnabled, preserveHistOnRoomDeletion, subject, rolesToBroadcast, " + "useReservedNick, canChangeNick, canRegister, allowpm, fmucEnabled, fmucOutboundNode, " + "fmucOutboundMode, fmucInboundNodes " + "FROM ofMucRoom WHERE serviceID=? AND (emptyDate IS NULL or emptyDate > ?)"; private static final String LOAD_ALL_ROOMS = "SELECT roomID, creationDate, modificationDate, name, naturalName, description, " + "lockedDate, emptyDate, canChangeSubject, maxUsers, publicRoom, moderated, membersOnly, " + - "canInvite, roomPassword, canDiscoverJID, logEnabled, subject, rolesToBroadcast, " + + "canInvite, roomPassword, canDiscoverJID, logEnabled, preserveHistOnRoomDeletion, subject, rolesToBroadcast, " + "useReservedNick, canChangeNick, canRegister, allowpm, fmucEnabled, fmucOutboundNode, " + "fmucOutboundMode, fmucInboundNodes " + "FROM ofMucRoom WHERE serviceID=?"; @@ -105,16 +105,16 @@ public class MUCPersistenceManager { private static final String UPDATE_ROOM = "UPDATE ofMucRoom SET modificationDate=?, naturalName=?, description=?, " + "canChangeSubject=?, maxUsers=?, publicRoom=?, moderated=?, membersOnly=?, " + - "canInvite=?, roomPassword=?, canDiscoverJID=?, logEnabled=?, rolesToBroadcast=?, " + + "canInvite=?, roomPassword=?, canDiscoverJID=?, logEnabled=?, preserveHistOnRoomDeletion=?, rolesToBroadcast=?, " + "useReservedNick=?, canChangeNick=?, canRegister=?, allowpm=?, fmucEnabled=?, " + "fmucOutboundNode=?, fmucOutboundMode=?, fmucInboundNodes=? " + "WHERE roomID=?"; private static final String ADD_ROOM = "INSERT INTO ofMucRoom (serviceID, roomID, creationDate, modificationDate, name, naturalName, " + "description, lockedDate, emptyDate, canChangeSubject, maxUsers, publicRoom, moderated, " + - "membersOnly, canInvite, roomPassword, canDiscoverJID, logEnabled, subject, " + + "membersOnly, canInvite, roomPassword, canDiscoverJID, logEnabled, preserveHistOnRoomDeletion, subject, " + "rolesToBroadcast, useReservedNick, canChangeNick, canRegister, allowpm, fmucEnabled, fmucOutboundNode, " + - "fmucOutboundMode, fmucInboundNodes) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + "fmucOutboundMode, fmucInboundNodes) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; private static final String UPDATE_SUBJECT = "UPDATE ofMucRoom SET subject=? WHERE roomID=?"; private static final String UPDATE_LOCK = @@ -145,6 +145,8 @@ public class MUCPersistenceManager { "DELETE FROM ofMucAffiliation WHERE jid=?"; private static final String ADD_CONVERSATION_LOG = "INSERT INTO ofMucConversationLog (roomID,messageID,sender,nickname,logTime,subject,body,stanza) VALUES (?,?,?,?,?,?,?,?)"; + private static final String DELETE_ROOM_HISTORY = + "DELETE FROM ofMucConversationLog WHERE roomID=?"; /* Map of subdomains to their associated properties */ private static ConcurrentHashMap propertyMaps = new ConcurrentHashMap<>(); @@ -258,6 +260,7 @@ public static void loadFromDB(MUCRoom room) { room.setPassword(rs.getString("roomPassword")); room.setCanAnyoneDiscoverJID(rs.getInt("canDiscoverJID") == 1); room.setLogEnabled(rs.getInt("logEnabled") == 1); + room.setPreserveHistOnRoomDeletionEnabled(rs.getInt("preserveHistOnRoomDeletion") == 1); room.setSubject(rs.getString("subject")); List rolesToBroadcast = new ArrayList<>(); String roles = StringUtils.zeroPadString(Integer.toBinaryString(rs.getInt("rolesToBroadcast")), 3); @@ -402,38 +405,39 @@ public static void saveToDB(MUCRoom room) { 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, (room.isLoginRestrictedToNickname() ? 1 : 0)); - pstmt.setInt(15, (room.canChangeNickname() ? 1 : 0)); - pstmt.setInt(16, (room.isRegistrationEnabled() ? 1 : 0)); + pstmt.setInt(13, (room.isPreserveHistOnRoomDeletionEnabled() ? 1 : 0)); + pstmt.setInt(14, marshallRolesToBroadcast(room)); + pstmt.setInt(15, (room.isLoginRestrictedToNickname() ? 1 : 0)); + pstmt.setInt(16, (room.canChangeNickname() ? 1 : 0)); + pstmt.setInt(17, (room.isRegistrationEnabled() ? 1 : 0)); switch (room.canSendPrivateMessage()) { default: - case "anyone": pstmt.setInt(17, 0); break; - case "participants": pstmt.setInt(17, 1); break; - case "moderators": pstmt.setInt(17, 2); break; - case "none": pstmt.setInt(17, 3); break; + case "anyone": pstmt.setInt(18, 0); break; + case "participants": pstmt.setInt(18, 1); break; + case "moderators": pstmt.setInt(18, 2); break; + case "none": pstmt.setInt(18, 3); break; } - pstmt.setInt(18, (room.isFmucEnabled() ? 1 : 0 )); + pstmt.setInt(19, (room.isFmucEnabled() ? 1 : 0 )); if ( room.getFmucOutboundNode() == null ) { - pstmt.setNull(19, Types.VARCHAR); + pstmt.setNull(20, Types.VARCHAR); } else { - pstmt.setString(19, room.getFmucOutboundNode().toString()); + pstmt.setString(20, room.getFmucOutboundNode().toString()); } if ( room.getFmucOutboundMode() == null ) { - pstmt.setNull(20, Types.INTEGER); + pstmt.setNull(21, Types.INTEGER); } else { - pstmt.setInt(20, room.getFmucOutboundMode().equals(MasterMaster) ? 0 : 1); + pstmt.setInt(21, room.getFmucOutboundMode().equals(MasterMaster) ? 0 : 1); } // Store a newline-separated collection, which is an 'allow only on list' configuration. Note that the list can be empty (effectively: disallow all), or null: this is an 'allow all' configuration. if (room.getFmucInboundNodes() == null) { - pstmt.setNull(21, Types.VARCHAR); // Null: allow all. + pstmt.setNull(22, Types.VARCHAR); // Null: allow all. } else { final String content = room.getFmucInboundNodes().stream().map(JID::toString).collect(Collectors.joining("\n")); // result potentially is an empty String, but will not be null. - pstmt.setString(21, content); + pstmt.setString(22, content); } - pstmt.setLong(22, room.getID()); + pstmt.setLong(23, room.getID()); pstmt.executeUpdate(); } else { @@ -462,37 +466,38 @@ public static void saveToDB(MUCRoom room) { pstmt.setString(16, room.getPassword()); pstmt.setInt(17, (room.canAnyoneDiscoverJID() ? 1 : 0)); pstmt.setInt(18, (room.isLogEnabled() ? 1 : 0)); - pstmt.setString(19, room.getSubject()); - pstmt.setInt(20, marshallRolesToBroadcast(room)); - pstmt.setInt(21, (room.isLoginRestrictedToNickname() ? 1 : 0)); - pstmt.setInt(22, (room.canChangeNickname() ? 1 : 0)); - pstmt.setInt(23, (room.isRegistrationEnabled() ? 1 : 0)); + pstmt.setInt(19, (room.isPreserveHistOnRoomDeletionEnabled() ? 1 : 0)); + pstmt.setString(20, room.getSubject()); + pstmt.setInt(21, marshallRolesToBroadcast(room)); + pstmt.setInt(22, (room.isLoginRestrictedToNickname() ? 1 : 0)); + pstmt.setInt(23, (room.canChangeNickname() ? 1 : 0)); + pstmt.setInt(24, (room.isRegistrationEnabled() ? 1 : 0)); switch (room.canSendPrivateMessage()) { default: - case "anyone": pstmt.setInt(24, 0); break; - case "participants": pstmt.setInt(24, 1); break; - case "moderators": pstmt.setInt(24, 2); break; - case "none": pstmt.setInt(24, 3); break; + case "anyone": pstmt.setInt(25, 0); break; + case "participants": pstmt.setInt(25, 1); break; + case "moderators": pstmt.setInt(25, 2); break; + case "none": pstmt.setInt(25, 3); break; } - pstmt.setInt(25, (room.isFmucEnabled() ? 1 : 0 )); + pstmt.setInt(26, (room.isFmucEnabled() ? 1 : 0 )); if ( room.getFmucOutboundNode() == null ) { - pstmt.setNull(26, Types.VARCHAR); + pstmt.setNull(27, Types.VARCHAR); } else { - pstmt.setString(26, room.getFmucOutboundNode().toString()); + pstmt.setString(27, room.getFmucOutboundNode().toString()); } if ( room.getFmucOutboundMode() == null ) { - pstmt.setNull(27, Types.INTEGER); + pstmt.setNull(28, Types.INTEGER); } else { - pstmt.setInt(27, room.getFmucOutboundMode().equals(MasterMaster) ? 0 : 1); + pstmt.setInt(28, room.getFmucOutboundMode().equals(MasterMaster) ? 0 : 1); } // Store a newline-separated collection, which is an 'allow only on list' configuration. Note that the list can be empty (effectively: disallow all), or null: this is an 'allow all' configuration. if (room.getFmucInboundNodes() == null) { - pstmt.setNull(28, Types.VARCHAR); // Null: allow all. + pstmt.setNull(29, Types.VARCHAR); // Null: allow all. } else { final String content = room.getFmucInboundNodes().stream().map(JID::toString).collect(Collectors.joining("\n")); // result potentially is an empty String, but will not be null. - pstmt.setString(28, content); + pstmt.setString(29, content); } pstmt.executeUpdate(); } @@ -535,6 +540,12 @@ public static void deleteFromDB(MUCRoom room) { pstmt.setLong(1, room.getID()); pstmt.executeUpdate(); + if(!room.isPreserveHistOnRoomDeletionEnabled()) { + pstmt = con.prepareStatement(DELETE_ROOM_HISTORY); + pstmt.setLong(1, room.getID()); + pstmt.executeUpdate(); + } + // Update the room (in memory) to indicate the it's no longer in the database. room.setSavedToDB(false); } @@ -678,6 +689,7 @@ private static Map loadRooms(Long serviceID, Date cleanupDate, Mu room.setPassword(resultSet.getString("roomPassword")); room.setCanAnyoneDiscoverJID(resultSet.getInt("canDiscoverJID") == 1); room.setLogEnabled(resultSet.getInt("logEnabled") == 1); + room.setPreserveHistOnRoomDeletionEnabled(resultSet.getInt("preserveHistOnRoomDeletion") == 1); room.setSubject(resultSet.getString("subject")); List rolesToBroadcast = new ArrayList<>(); String roles = StringUtils.zeroPadString(Integer.toBinaryString(resultSet.getInt("rolesToBroadcast")), 3); diff --git a/xmppserver/src/main/webapp/muc-default-settings.jsp b/xmppserver/src/main/webapp/muc-default-settings.jsp index 6e40010d53..d4cfc8103d 100644 --- a/xmppserver/src/main/webapp/muc-default-settings.jsp +++ b/xmppserver/src/main/webapp/muc-default-settings.jsp @@ -47,6 +47,7 @@ String canChangeNick = ParamUtils.getParameter(request, "roomconfig_canchangenick"); String registrationEnabled = ParamUtils.getParameter(request, "roomconfig_registration"); String enableLog = ParamUtils.getParameter(request, "roomconfig_enablelogging"); + String preserveHistOnRoomDeletion = ParamUtils.getParameter(request, "roomconfig_preservehistondel"); String maxUsers = ParamUtils.getParameter(request, "roomconfig_maxusers"); String broadcastModerator = ParamUtils.getParameter(request, "roomconfig_broadcastmoderator"); String broadcastParticipant = ParamUtils.getParameter(request, "roomconfig_broadcastparticipant"); @@ -156,6 +157,12 @@ else { MUCPersistenceManager.setProperty(mucname, "room.logEnabled", "false"); } + if (preserveHistOnRoomDeletion != null && preserveHistOnRoomDeletion.trim().length() > 0) { + MUCPersistenceManager.setProperty(mucname, "room.preserveHistOnRoomDeletion", "true"); + } + else { + MUCPersistenceManager.setProperty(mucname, "room.preserveHistOnRoomDeletion", "false"); + } if (broadcastModerator != null && broadcastModerator.trim().length() > 0) { MUCPersistenceManager.setProperty(mucname, "room.broadcastModerator", "true"); } @@ -194,6 +201,7 @@ pageContext.setAttribute("canChangeNickname", MUCPersistenceManager.getBooleanProperty(mucname, "room.canChangeNickname", true)); pageContext.setAttribute("registrationEnabled", MUCPersistenceManager.getBooleanProperty(mucname, "room.registrationEnabled", true)); pageContext.setAttribute("logEnabled", MUCPersistenceManager.getBooleanProperty(mucname, "room.logEnabled", true)); + pageContext.setAttribute("preserveHistOnRoomDeletion", MUCPersistenceManager.getBooleanProperty(mucname, "room.preserveHistOnRoomDeletion", true)); pageContext.setAttribute("maxUsers", MUCPersistenceManager.getIntProperty(mucname, "room.maxUsers", 30)); pageContext.setAttribute("broadcastModerator", MUCPersistenceManager.getBooleanProperty(mucname, "room.broadcastModerator", true)); pageContext.setAttribute("broadcastParticipant", MUCPersistenceManager.getBooleanProperty(mucname, "room.broadcastParticipant", true)); @@ -298,6 +306,10 @@ + + + +   diff --git a/xmppserver/src/main/webapp/muc-room-edit-form.jsp b/xmppserver/src/main/webapp/muc-room-edit-form.jsp index 4a42fd9c11..3278091906 100644 --- a/xmppserver/src/main/webapp/muc-room-edit-form.jsp +++ b/xmppserver/src/main/webapp/muc-room-edit-form.jsp @@ -100,6 +100,7 @@ boolean allowInvites = ParamUtils.getBooleanParameter(request, "roomconfig_allowinvites"); boolean changeSubject = ParamUtils.getBooleanParameter(request, "roomconfig_changesubject"); boolean enableLog = ParamUtils.getBooleanParameter(request, "roomconfig_enablelogging"); + boolean preserveHistOnRoomDeletion = ParamUtils.getBooleanParameter(request, "roomconfig_preservehistondel"); boolean reservedNick = ParamUtils.getBooleanParameter(request, "roomconfig_reservednick"); boolean canchangenick = ParamUtils.getBooleanParameter(request, "roomconfig_canchangenick"); boolean registration = ParamUtils.getBooleanParameter(request, "roomconfig_registration"); @@ -246,6 +247,7 @@ dataForm.addField("muc#roomconfig_whois", null, null).addValue(whois); dataForm.addField("muc#roomconfig_allowpm", null, null).addValue(allowpm); dataForm.addField("muc#roomconfig_enablelogging", null, null).addValue(enableLog ? "1": "0"); + dataForm.addField("muc#roomconfig_preservehistondel", null, null).addValue(preserveHistOnRoomDeletion ? "1": "0"); dataForm.addField("x-muc#roomconfig_reservednick", null, null).addValue(reservedNick ? "1": "0"); dataForm.addField("x-muc#roomconfig_canchangenick", null, null).addValue(canchangenick ? "1": "0"); dataForm.addField("x-muc#roomconfig_registration", null, null).addValue(registration ? "1": "0"); @@ -313,6 +315,7 @@ allowInvites = MUCPersistenceManager.getBooleanProperty(serviceName, "room.canOccupantsInvite", false); changeSubject = MUCPersistenceManager.getBooleanProperty(serviceName, "room.canOccupantsChangeSubject", false); enableLog = MUCPersistenceManager.getBooleanProperty(serviceName, "room.logEnabled", true); + preserveHistOnRoomDeletion = MUCPersistenceManager.getBooleanProperty(serviceName, "room.preserveHistOnRoomDeletion", true); reservedNick = MUCPersistenceManager.getBooleanProperty(serviceName, "room.loginRestrictedToNickname", false); canchangenick = MUCPersistenceManager.getBooleanProperty(serviceName, "room.canChangeNickname", true); registration = MUCPersistenceManager.getBooleanProperty(serviceName, "room.registrationEnabled", true); @@ -336,6 +339,7 @@ allowInvites = room.canOccupantsInvite(); changeSubject = room.canOccupantsChangeSubject(); enableLog = room.isLogEnabled(); + preserveHistOnRoomDeletion = room.isPreserveHistOnRoomDeletionEnabled(); reservedNick = room.isLoginRestrictedToNickname(); canchangenick = room.canChangeNickname(); registration = room.isRegistrationEnabled(); @@ -373,6 +377,7 @@ pageContext.setAttribute("canchangenick", canchangenick); pageContext.setAttribute("registration", registration); pageContext.setAttribute("enableLog", enableLog); + pageContext.setAttribute("preserveHistOnRoomDeletion", preserveHistOnRoomDeletion); %> @@ -651,6 +656,10 @@ + + + + From d9d6a3e7a51ac83fd6ebdddf5f5d45be08655634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CHuy?= Date: Wed, 27 Nov 2024 14:51:28 +0000 Subject: [PATCH 6/7] OF-2916 and OF-2917: Add the option to control MUC history preservation Add a preserveHistOnDel field to the OfMucRoom table to specify chat history preservation on the deletion of a chat room. Updated MUCPersistenceManager to make use of the new preserveHistOnDel field. --- distribution/src/database/openfire_db2.sql | 60 +++++++++---------- distribution/src/database/openfire_hsqldb.sql | 60 +++++++++---------- distribution/src/database/openfire_mysql.sql | 60 +++++++++---------- distribution/src/database/openfire_oracle.sql | 60 +++++++++---------- .../src/database/openfire_postgresql.sql | 60 +++++++++---------- .../src/database/openfire_sqlserver.sql | 60 +++++++++---------- distribution/src/database/openfire_sybase.sql | 60 +++++++++---------- .../src/database/upgrade/35/openfire_db2.sql | 3 + .../database/upgrade/35/openfire_hsqldb.sql | 3 + .../database/upgrade/35/openfire_mysql.sql | 3 + .../database/upgrade/35/openfire_oracle.sql | 3 + .../upgrade/35/openfire_postgresql.sql | 3 + .../upgrade/35/openfire_sqlserver.sql | 3 + .../database/upgrade/35/openfire_sybase.sql | 3 + .../jivesoftware/database/SchemaManager.java | 2 +- .../muc/spi/MUCPersistenceManager.java | 14 ++--- 16 files changed, 239 insertions(+), 218 deletions(-) create mode 100644 distribution/src/database/upgrade/35/openfire_db2.sql create mode 100644 distribution/src/database/upgrade/35/openfire_hsqldb.sql create mode 100644 distribution/src/database/upgrade/35/openfire_mysql.sql create mode 100644 distribution/src/database/upgrade/35/openfire_oracle.sql create mode 100644 distribution/src/database/upgrade/35/openfire_postgresql.sql create mode 100644 distribution/src/database/upgrade/35/openfire_sqlserver.sql create mode 100644 distribution/src/database/upgrade/35/openfire_sybase.sql diff --git a/distribution/src/database/openfire_db2.sql b/distribution/src/database/openfire_db2.sql index 8fdef92fb0..b4cb328f8d 100644 --- a/distribution/src/database/openfire_db2.sql +++ b/distribution/src/database/openfire_db2.sql @@ -192,35 +192,35 @@ CREATE TABLE ofMucServiceProp ( ); CREATE TABLE ofMucRoom ( - serviceID INTEGER NOT NULL, - roomID INTEGER NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name VARCHAR(50) NOT NULL, - naturalName VARCHAR(255) NOT NULL, - description VARCHAR(255), - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15), - canChangeSubject INTEGER NOT NULL, - maxUsers INTEGER NOT NULL, - publicRoom INTEGER NOT NULL, - moderated INTEGER NOT NULL, - membersOnly INTEGER NOT NULL, - canInvite INTEGER NOT NULL, - roomPassword VARCHAR(50), - canDiscoverJID INTEGER NOT NULL, - logEnabled INTEGER NOT NULL, - preserveHistOnRoomDeletion INTEGER NOT NULL, - subject VARCHAR(100), - rolesToBroadcast INTEGER NOT NULL, - useReservedNick INTEGER NOT NULL, - canChangeNick INTEGER NOT NULL, - canRegister INTEGER NOT NULL, - allowpm INTEGER NULL, - fmucEnabled INTEGER NULL, - fmucOutboundNode VARCHAR(255) NULL, - fmucOutboundMode INTEGER NULL, - fmucInboundNodes VARCHAR(2000) NULL, + serviceID INTEGER NOT NULL, + roomID INTEGER NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name VARCHAR(50) NOT NULL, + naturalName VARCHAR(255) NOT NULL, + description VARCHAR(255), + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15), + canChangeSubject INTEGER NOT NULL, + maxUsers INTEGER NOT NULL, + publicRoom INTEGER NOT NULL, + moderated INTEGER NOT NULL, + membersOnly INTEGER NOT NULL, + canInvite INTEGER NOT NULL, + roomPassword VARCHAR(50), + canDiscoverJID INTEGER NOT NULL, + logEnabled INTEGER NOT NULL, + preserveHistOnDel INTEGER NOT NULL, + subject VARCHAR(100), + rolesToBroadcast INTEGER NOT NULL, + useReservedNick INTEGER NOT NULL, + canChangeNick INTEGER NOT NULL, + canRegister INTEGER NOT NULL, + allowpm INTEGER NULL, + fmucEnabled INTEGER NULL, + fmucOutboundNode VARCHAR(255) NULL, + fmucOutboundMode INTEGER NULL, + fmucInboundNodes VARCHAR(2000) NULL, CONSTRAINT ofMucRoom_pk PRIMARY KEY (serviceID, name) ); CREATE INDEX ofMucRoom_roomid_idx ON ofMucRoom (roomID); @@ -393,7 +393,7 @@ INSERT INTO ofID (idType, id) VALUES (23, 1); INSERT INTO ofID (idType, id) VALUES (26, 2); INSERT INTO ofID (idType, id) VALUES (27, 1); -INSERT INTO ofVersion (name, version) VALUES ('openfire', 34); +INSERT INTO ofVersion (name, version) VALUES ('openfire', 35); -- Entry for admin user INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate) diff --git a/distribution/src/database/openfire_hsqldb.sql b/distribution/src/database/openfire_hsqldb.sql index 1938c32fb7..938df0ff0d 100644 --- a/distribution/src/database/openfire_hsqldb.sql +++ b/distribution/src/database/openfire_hsqldb.sql @@ -188,35 +188,35 @@ CREATE TABLE ofMucServiceProp ( ); CREATE TABLE ofMucRoom ( - serviceID BIGINT NOT NULL, - roomID BIGINT NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name VARCHAR(50) NOT NULL, - naturalName VARCHAR(255) NOT NULL, - description VARCHAR(255), - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15) NULL, - canChangeSubject INTEGER NOT NULL, - maxUsers INTEGER NOT NULL, - publicRoom INTEGER NOT NULL, - moderated INTEGER NOT NULL, - membersOnly INTEGER NOT NULL, - canInvite INTEGER NOT NULL, - roomPassword VARCHAR(50) NULL, - canDiscoverJID INTEGER NOT NULL, - logEnabled INTEGER NOT NULL, - preserveHistOnRoomDeletion INTEGER NOT NULL, - subject VARCHAR(100) NULL, - rolesToBroadcast INTEGER NOT NULL, - useReservedNick INTEGER NOT NULL, - canChangeNick INTEGER NOT NULL, - canRegister INTEGER NOT NULL, - allowpm INTEGER NULL, - fmucEnabled INTEGER NULL, - fmucOutboundNode VARCHAR(255) NULL, - fmucOutboundMode INTEGER NULL, - fmucInboundNodes VARCHAR(4000) NULL, + serviceID BIGINT NOT NULL, + roomID BIGINT NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name VARCHAR(50) NOT NULL, + naturalName VARCHAR(255) NOT NULL, + description VARCHAR(255), + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15) NULL, + canChangeSubject INTEGER NOT NULL, + maxUsers INTEGER NOT NULL, + publicRoom INTEGER NOT NULL, + moderated INTEGER NOT NULL, + membersOnly INTEGER NOT NULL, + canInvite INTEGER NOT NULL, + roomPassword VARCHAR(50) NULL, + canDiscoverJID INTEGER NOT NULL, + logEnabled INTEGER NOT NULL, + preserveHistOnDel INTEGER NOT NULL, + subject VARCHAR(100) NULL, + rolesToBroadcast INTEGER NOT NULL, + useReservedNick INTEGER NOT NULL, + canChangeNick INTEGER NOT NULL, + canRegister INTEGER NOT NULL, + allowpm INTEGER NULL, + fmucEnabled INTEGER NULL, + fmucOutboundNode VARCHAR(255) NULL, + fmucOutboundMode INTEGER NULL, + fmucInboundNodes VARCHAR(4000) NULL, CONSTRAINT ofMucRoom_pk PRIMARY KEY (serviceID, name) ); CREATE INDEX ofMucRoom_roomid_idx ON ofMucRoom (roomID); @@ -379,7 +379,7 @@ INSERT INTO ofID (idType, id) VALUES (23, 1); INSERT INTO ofID (idType, id) VALUES (26, 2); INSERT INTO ofID (idType, id) VALUES (27, 1); -INSERT INTO ofVersion (name, version) VALUES ('openfire', 34); +INSERT INTO ofVersion (name, version) VALUES ('openfire', 35); // Entry for admin user INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate) diff --git a/distribution/src/database/openfire_mysql.sql b/distribution/src/database/openfire_mysql.sql index 6931262265..8be85e0266 100644 --- a/distribution/src/database/openfire_mysql.sql +++ b/distribution/src/database/openfire_mysql.sql @@ -178,35 +178,35 @@ CREATE TABLE ofMucServiceProp ( ); CREATE TABLE ofMucRoom ( - serviceID BIGINT NOT NULL, - roomID BIGINT NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name VARCHAR(50) NOT NULL, - naturalName VARCHAR(255) NOT NULL, - description VARCHAR(255), - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15) NULL, - canChangeSubject TINYINT NOT NULL, - maxUsers INTEGER NOT NULL, - publicRoom TINYINT NOT NULL, - moderated TINYINT NOT NULL, - membersOnly TINYINT NOT NULL, - canInvite TINYINT NOT NULL, - roomPassword VARCHAR(50) NULL, - canDiscoverJID TINYINT NOT NULL, - logEnabled TINYINT NOT NULL, - preserveHistOnRoomDeletion TINYINT NOT NULL, - subject VARCHAR(100) NULL, - rolesToBroadcast TINYINT NOT NULL, - useReservedNick TINYINT NOT NULL, - canChangeNick TINYINT NOT NULL, - canRegister TINYINT NOT NULL, - allowpm TINYINT NULL, - fmucEnabled TINYINT NULL, - fmucOutboundNode VARCHAR(255) NULL, - fmucOutboundMode TINYINT NULL, - fmucInboundNodes VARCHAR(4000) NULL, + serviceID BIGINT NOT NULL, + roomID BIGINT NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name VARCHAR(50) NOT NULL, + naturalName VARCHAR(255) NOT NULL, + description VARCHAR(255), + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15) NULL, + canChangeSubject TINYINT NOT NULL, + maxUsers INTEGER NOT NULL, + publicRoom TINYINT NOT NULL, + moderated TINYINT NOT NULL, + membersOnly TINYINT NOT NULL, + canInvite TINYINT NOT NULL, + roomPassword VARCHAR(50) NULL, + canDiscoverJID TINYINT NOT NULL, + logEnabled TINYINT NOT NULL, + preserveHistOnDel TINYINT NOT NULL, + subject VARCHAR(100) NULL, + rolesToBroadcast TINYINT NOT NULL, + useReservedNick TINYINT NOT NULL, + canChangeNick TINYINT NOT NULL, + canRegister TINYINT NOT NULL, + allowpm TINYINT NULL, + fmucEnabled TINYINT NULL, + fmucOutboundNode VARCHAR(255) NULL, + fmucOutboundMode TINYINT NULL, + fmucInboundNodes VARCHAR(4000) NULL, PRIMARY KEY (serviceID,name), INDEX ofMucRoom_roomid_idx (roomID), INDEX ofMucRoom_serviceid_idx (serviceID) @@ -369,7 +369,7 @@ INSERT INTO ofID (idType, id) VALUES (23, 1); INSERT INTO ofID (idType, id) VALUES (26, 2); INSERT INTO ofID (idType, id) VALUES (27, 1); -INSERT INTO ofVersion (name, version) VALUES ('openfire', 34); +INSERT INTO ofVersion (name, version) VALUES ('openfire', 35); # Entry for admin user INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate) diff --git a/distribution/src/database/openfire_oracle.sql b/distribution/src/database/openfire_oracle.sql index 5b254d7112..9651f757c4 100644 --- a/distribution/src/database/openfire_oracle.sql +++ b/distribution/src/database/openfire_oracle.sql @@ -185,35 +185,35 @@ CREATE TABLE ofMucServiceProp ( ); CREATE TABLE ofMucRoom( - serviceID INT NOT NULL, - roomID INT NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name VARCHAR2(50) NOT NULL, - naturalName VARCHAR2(255) NOT NULL, - description VARCHAR2(255), - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15) NULL, - canChangeSubject INTEGER NOT NULL, - maxUsers INTEGER NOT NULL, - publicRoom INTEGER NOT NULL, - moderated INTEGER NOT NULL, - membersOnly INTEGER NOT NULL, - canInvite INTEGER NOT NULL, - roomPassword VARCHAR2(50) NULL, - canDiscoverJID INTEGER NOT NULL, - logEnabled INTEGER NOT NULL, - preserveHistOnRoomDeletion INTEGER NOT NULL, - subject VARCHAR2(100) NULL, - rolesToBroadcast INTEGER NOT NULL, - useReservedNick INTEGER NOT NULL, - canChangeNick INTEGER NOT NULL, - canRegister INTEGER NOT NULL, - allowpm INTEGER NULL, - fmucEnabled INTEGER NULL, - fmucOutboundNode VARCHAR2(255) NULL, - fmucOutboundMode INTEGER NULL, - fmucInboundNodes VARCHAR2(4000) NULL, + serviceID INT NOT NULL, + roomID INT NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name VARCHAR2(50) NOT NULL, + naturalName VARCHAR2(255) NOT NULL, + description VARCHAR2(255), + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15) NULL, + canChangeSubject INTEGER NOT NULL, + maxUsers INTEGER NOT NULL, + publicRoom INTEGER NOT NULL, + moderated INTEGER NOT NULL, + membersOnly INTEGER NOT NULL, + canInvite INTEGER NOT NULL, + roomPassword VARCHAR2(50) NULL, + canDiscoverJID INTEGER NOT NULL, + logEnabled INTEGER NOT NULL, + preserveHistOnDel INTEGER NOT NULL, + subject VARCHAR2(100) NULL, + rolesToBroadcast INTEGER NOT NULL, + useReservedNick INTEGER NOT NULL, + canChangeNick INTEGER NOT NULL, + canRegister INTEGER NOT NULL, + allowpm INTEGER NULL, + fmucEnabled INTEGER NULL, + fmucOutboundNode VARCHAR2(255) NULL, + fmucOutboundMode INTEGER NULL, + fmucInboundNodes VARCHAR2(4000) NULL, CONSTRAINT ofMucRoom_pk PRIMARY KEY (serviceID, name) ); CREATE INDEX ofMucRoom_roomid_idx ON ofMucRoom (roomID); @@ -377,7 +377,7 @@ INSERT INTO ofID (idType, id) VALUES (23, 1); INSERT INTO ofID (idType, id) VALUES (26, 2); INSERT INTO ofID (idType, id) VALUES (27, 1); -INSERT INTO ofVersion (name, version) VALUES ('openfire', 34); +INSERT INTO ofVersion (name, version) VALUES ('openfire', 35); -- Entry for admin user INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate) diff --git a/distribution/src/database/openfire_postgresql.sql b/distribution/src/database/openfire_postgresql.sql index 2d25a06252..6cdb7aa853 100644 --- a/distribution/src/database/openfire_postgresql.sql +++ b/distribution/src/database/openfire_postgresql.sql @@ -193,35 +193,35 @@ CREATE TABLE ofMucServiceProp ( ); CREATE TABLE ofMucRoom ( - serviceID INTEGER NOT NULL, - roomID INTEGER NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name VARCHAR(50) NOT NULL, - naturalName VARCHAR(255) NOT NULL, - description VARCHAR(255), - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15) NULL, - canChangeSubject INTEGER NOT NULL, - maxUsers INTEGER NOT NULL, - publicRoom INTEGER NOT NULL, - moderated INTEGER NOT NULL, - membersOnly INTEGER NOT NULL, - canInvite INTEGER NOT NULL, - roomPassword VARCHAR(50) NULL, - canDiscoverJID INTEGER NOT NULL, - logEnabled INTEGER NOT NULL, - preserveHistOnRoomDeletion INTEGER NOT NULL, - subject VARCHAR(100) NULL, - rolesToBroadcast INTEGER NOT NULL, - useReservedNick INTEGER NOT NULL, - canChangeNick INTEGER NOT NULL, - canRegister INTEGER NOT NULL, - allowpm INTEGER NULL, - fmucEnabled INTEGER NULL, - fmucOutboundNode TEXT NULL, - fmucOutboundMode INTEGER NULL, - fmucInboundNodes TEXT NULL, + serviceID INTEGER NOT NULL, + roomID INTEGER NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name VARCHAR(50) NOT NULL, + naturalName VARCHAR(255) NOT NULL, + description VARCHAR(255), + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15) NULL, + canChangeSubject INTEGER NOT NULL, + maxUsers INTEGER NOT NULL, + publicRoom INTEGER NOT NULL, + moderated INTEGER NOT NULL, + membersOnly INTEGER NOT NULL, + canInvite INTEGER NOT NULL, + roomPassword VARCHAR(50) NULL, + canDiscoverJID INTEGER NOT NULL, + logEnabled INTEGER NOT NULL, + preserveHistOnDel INTEGER NOT NULL, + subject VARCHAR(100) NULL, + rolesToBroadcast INTEGER NOT NULL, + useReservedNick INTEGER NOT NULL, + canChangeNick INTEGER NOT NULL, + canRegister INTEGER NOT NULL, + allowpm INTEGER NULL, + fmucEnabled INTEGER NULL, + fmucOutboundNode TEXT NULL, + fmucOutboundMode INTEGER NULL, + fmucInboundNodes TEXT NULL, CONSTRAINT ofMucRoom_pk PRIMARY KEY (serviceID, name) ); CREATE INDEX ofMucRoom_roomid_idx ON ofMucRoom(roomID); @@ -385,7 +385,7 @@ INSERT INTO ofID (idType, id) VALUES (23, 1); INSERT INTO ofID (idType, id) VALUES (26, 2); INSERT INTO ofID (idType, id) VALUES (27, 1); -INSERT INTO ofVersion (name, version) VALUES ('openfire', 34); +INSERT INTO ofVersion (name, version) VALUES ('openfire', 35); -- Entry for admin user INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate) diff --git a/distribution/src/database/openfire_sqlserver.sql b/distribution/src/database/openfire_sqlserver.sql index a57834f993..2690dfdbea 100644 --- a/distribution/src/database/openfire_sqlserver.sql +++ b/distribution/src/database/openfire_sqlserver.sql @@ -191,35 +191,35 @@ CREATE TABLE ofMucServiceProp ( ); CREATE TABLE ofMucRoom ( - serviceID INT NOT NULL, - roomID INT NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name NVARCHAR(50) NOT NULL, - naturalName NVARCHAR(255) NOT NULL, - description NVARCHAR(255), - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15) NULL, - canChangeSubject INT NOT NULL, - maxUsers INT NOT NULL, - publicRoom INT NOT NULL, - moderated INT NOT NULL, - membersOnly INT NOT NULL, - canInvite INT NOT NULL, - roomPassword NVARCHAR(50) NULL, - canDiscoverJID INT NOT NULL, - logEnabled INT NOT NULL, - preserveHistOnRoomDeletion INT NOT NULL, - subject NVARCHAR(100) NULL, - rolesToBroadcast INT NOT NULL, - useReservedNick INT NOT NULL, - canChangeNick INT NOT NULL, - canRegister INT NOT NULL, - allowpm INT NULL, - fmucEnabled INT NULL, - fmucOutboundNode NVARCHAR(255) NULL, - fmucOutboundMode INT NULL, - fmucInboundNodes NVARCHAR(2000) NULL, + serviceID INT NOT NULL, + roomID INT NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name NVARCHAR(50) NOT NULL, + naturalName NVARCHAR(255) NOT NULL, + description NVARCHAR(255), + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15) NULL, + canChangeSubject INT NOT NULL, + maxUsers INT NOT NULL, + publicRoom INT NOT NULL, + moderated INT NOT NULL, + membersOnly INT NOT NULL, + canInvite INT NOT NULL, + roomPassword NVARCHAR(50) NULL, + canDiscoverJID INT NOT NULL, + logEnabled INT NOT NULL, + preserveHistOnDel INT NOT NULL, + subject NVARCHAR(100) NULL, + rolesToBroadcast INT NOT NULL, + useReservedNick INT NOT NULL, + canChangeNick INT NOT NULL, + canRegister INT NOT NULL, + allowpm INT NULL, + fmucEnabled INT NULL, + fmucOutboundNode NVARCHAR(255) NULL, + fmucOutboundMode INT NULL, + fmucInboundNodes NVARCHAR(2000) NULL, CONSTRAINT ofMucRoom_pk PRIMARY KEY (serviceID, name) ); CREATE INDEX ofMucRoom_roomid_idx on ofMucRoom(roomID); @@ -382,7 +382,7 @@ INSERT INTO ofID (idType, id) VALUES (23, 1); INSERT INTO ofID (idType, id) VALUES (26, 2); INSERT INTO ofID (idType, id) VALUES (27, 1); -INSERT INTO ofVersion (name, version) VALUES ('openfire', 34); +INSERT INTO ofVersion (name, version) VALUES ('openfire', 35); /* Entry for admin user */ INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate) diff --git a/distribution/src/database/openfire_sybase.sql b/distribution/src/database/openfire_sybase.sql index d775ad468c..46b5c72ba6 100644 --- a/distribution/src/database/openfire_sybase.sql +++ b/distribution/src/database/openfire_sybase.sql @@ -190,35 +190,35 @@ CREATE TABLE ofMucServiceProp ( ) CREATE TABLE ofMucRoom ( - serviceID INT NOT NULL, - roomID INT NOT NULL, - creationDate CHAR(15) NOT NULL, - modificationDate CHAR(15) NOT NULL, - name NVARCHAR(50) NOT NULL, - naturalName NVARCHAR(255) NOT NULL, - description NVARCHAR(255) NULL, - lockedDate CHAR(15) NOT NULL, - emptyDate CHAR(15) NULL, - canChangeSubject INT NOT NULL, - maxUsers INT NOT NULL, - publicRoom INT NOT NULL, - moderated INT NOT NULL, - membersOnly INT NOT NULL, - canInvite INT NOT NULL, - roomPassword NVARCHAR(50) NULL, - canDiscoverJID INT NOT NULL, - logEnabled INT NOT NULL, - preserveHistOnRoomDeletion INT NOT NULL, - subject NVARCHAR(100) NULL, - rolesToBroadcast INT NOT NULL, - useReservedNick INT NOT NULL, - canChangeNick INT NOT NULL, - canRegister INT NOT NULL, - allowpm INT NULL, - fmucEnabled INT NULL, - fmucOutboundNode NVARCHAR(255) NULL, - fmucOutboundMode INT NULL, - fmucInboundNodes NVARCHAR(2000) NULL, + serviceID INT NOT NULL, + roomID INT NOT NULL, + creationDate CHAR(15) NOT NULL, + modificationDate CHAR(15) NOT NULL, + name NVARCHAR(50) NOT NULL, + naturalName NVARCHAR(255) NOT NULL, + description NVARCHAR(255) NULL, + lockedDate CHAR(15) NOT NULL, + emptyDate CHAR(15) NULL, + canChangeSubject INT NOT NULL, + maxUsers INT NOT NULL, + publicRoom INT NOT NULL, + moderated INT NOT NULL, + membersOnly INT NOT NULL, + canInvite INT NOT NULL, + roomPassword NVARCHAR(50) NULL, + canDiscoverJID INT NOT NULL, + logEnabled INT NOT NULL, + preserveHistOnDel INT NOT NULL, + subject NVARCHAR(100) NULL, + rolesToBroadcast INT NOT NULL, + useReservedNick INT NOT NULL, + canChangeNick INT NOT NULL, + canRegister INT NOT NULL, + allowpm INT NULL, + fmucEnabled INT NULL, + fmucOutboundNode NVARCHAR(255) NULL, + fmucOutboundMode INT NULL, + fmucInboundNodes NVARCHAR(2000) NULL, CONSTRAINT ofMucRoom_pk PRIMARY KEY (serviceID, name) ) CREATE INDEX ofMucRoom_roomid_idx on ofMucRoom(roomID) @@ -382,7 +382,7 @@ INSERT INTO ofID (idType, id) VALUES (23, 1) INSERT INTO ofID (idType, id) VALUES (26, 2) INSERT INTO ofID (idType, id) VALUES (27, 1) -INSERT INTO ofVersion (name, version) VALUES ('openfire', 34) +INSERT INTO ofVersion (name, version) VALUES ('openfire', 35) /* Entry for admin user */ INSERT INTO ofUser (username, plainPassword, name, email, creationDate, modificationDate) diff --git a/distribution/src/database/upgrade/35/openfire_db2.sql b/distribution/src/database/upgrade/35/openfire_db2.sql new file mode 100644 index 0000000000..bb42fb7513 --- /dev/null +++ b/distribution/src/database/upgrade/35/openfire_db2.sql @@ -0,0 +1,3 @@ +ALTER TABLE ofMucRoom ADD COLUMN preserveHistOnDel INTEGER DEFAULT 1 NOT NULL; + +UPDATE ofVersion SET version = 35 WHERE name = 'openfire'; diff --git a/distribution/src/database/upgrade/35/openfire_hsqldb.sql b/distribution/src/database/upgrade/35/openfire_hsqldb.sql new file mode 100644 index 0000000000..bb42fb7513 --- /dev/null +++ b/distribution/src/database/upgrade/35/openfire_hsqldb.sql @@ -0,0 +1,3 @@ +ALTER TABLE ofMucRoom ADD COLUMN preserveHistOnDel INTEGER DEFAULT 1 NOT NULL; + +UPDATE ofVersion SET version = 35 WHERE name = 'openfire'; diff --git a/distribution/src/database/upgrade/35/openfire_mysql.sql b/distribution/src/database/upgrade/35/openfire_mysql.sql new file mode 100644 index 0000000000..1d863c3b90 --- /dev/null +++ b/distribution/src/database/upgrade/35/openfire_mysql.sql @@ -0,0 +1,3 @@ +ALTER TABLE ofMucRoom ADD COLUMN preserveHistOnDel TINYINT NOT NULL DEFAULT 1; + +UPDATE ofVersion SET version = 35 WHERE name = 'openfire'; diff --git a/distribution/src/database/upgrade/35/openfire_oracle.sql b/distribution/src/database/upgrade/35/openfire_oracle.sql new file mode 100644 index 0000000000..9d61220d00 --- /dev/null +++ b/distribution/src/database/upgrade/35/openfire_oracle.sql @@ -0,0 +1,3 @@ +ALTER TABLE ofMucRoom ADD preserveHistOnDel INTEGER DEFAULT 1 NOT NULL; + +UPDATE ofVersion SET version = 35 WHERE name = 'openfire'; diff --git a/distribution/src/database/upgrade/35/openfire_postgresql.sql b/distribution/src/database/upgrade/35/openfire_postgresql.sql new file mode 100644 index 0000000000..bb42fb7513 --- /dev/null +++ b/distribution/src/database/upgrade/35/openfire_postgresql.sql @@ -0,0 +1,3 @@ +ALTER TABLE ofMucRoom ADD COLUMN preserveHistOnDel INTEGER DEFAULT 1 NOT NULL; + +UPDATE ofVersion SET version = 35 WHERE name = 'openfire'; diff --git a/distribution/src/database/upgrade/35/openfire_sqlserver.sql b/distribution/src/database/upgrade/35/openfire_sqlserver.sql new file mode 100644 index 0000000000..4f96192a2f --- /dev/null +++ b/distribution/src/database/upgrade/35/openfire_sqlserver.sql @@ -0,0 +1,3 @@ +ALTER TABLE ofMucRoom ADD preserveHistOnDel INT DEFAULT 1 NOT NULL; + +UPDATE ofVersion SET version = 35 WHERE name = 'openfire'; diff --git a/distribution/src/database/upgrade/35/openfire_sybase.sql b/distribution/src/database/upgrade/35/openfire_sybase.sql new file mode 100644 index 0000000000..4f96192a2f --- /dev/null +++ b/distribution/src/database/upgrade/35/openfire_sybase.sql @@ -0,0 +1,3 @@ +ALTER TABLE ofMucRoom ADD preserveHistOnDel INT DEFAULT 1 NOT NULL; + +UPDATE ofVersion SET version = 35 WHERE name = 'openfire'; diff --git a/xmppserver/src/main/java/org/jivesoftware/database/SchemaManager.java b/xmppserver/src/main/java/org/jivesoftware/database/SchemaManager.java index af5a999903..9c2e75ecd1 100644 --- a/xmppserver/src/main/java/org/jivesoftware/database/SchemaManager.java +++ b/xmppserver/src/main/java/org/jivesoftware/database/SchemaManager.java @@ -68,7 +68,7 @@ public class SchemaManager { /** * Current Openfire database schema version. */ - private static final int DATABASE_VERSION = 34; + private static final int DATABASE_VERSION = 35; /** * Checks the Openfire database schema to ensure that it's installed and up to date. diff --git a/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/MUCPersistenceManager.java b/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/MUCPersistenceManager.java index ba7f4cd4df..b3b46fd120 100644 --- a/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/MUCPersistenceManager.java +++ b/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/MUCPersistenceManager.java @@ -61,7 +61,7 @@ public class MUCPersistenceManager { private static final String LOAD_ROOM = "SELECT roomID, creationDate, modificationDate, naturalName, description, lockedDate, " + "emptyDate, canChangeSubject, maxUsers, publicRoom, moderated, membersOnly, canInvite, " + - "roomPassword, canDiscoverJID, logEnabled, preserveHistOnRoomDeletion, subject, rolesToBroadcast, useReservedNick, " + + "roomPassword, canDiscoverJID, logEnabled, preserveHistOnDel, subject, rolesToBroadcast, useReservedNick, " + "canChangeNick, canRegister, allowpm, fmucEnabled, fmucOutboundNode, fmucOutboundMode, " + "fmucInboundNodes " + " FROM ofMucRoom WHERE serviceID=? AND name=?"; @@ -75,14 +75,14 @@ public class MUCPersistenceManager { private static final String RELOAD_ALL_ROOMS_WITH_RECENT_ACTIVITY = "SELECT roomID, creationDate, modificationDate, name, naturalName, description, " + "lockedDate, emptyDate, canChangeSubject, maxUsers, publicRoom, moderated, membersOnly, " + - "canInvite, roomPassword, canDiscoverJID, logEnabled, preserveHistOnRoomDeletion, subject, rolesToBroadcast, " + + "canInvite, roomPassword, canDiscoverJID, logEnabled, preserveHistOnDel, subject, rolesToBroadcast, " + "useReservedNick, canChangeNick, canRegister, allowpm, fmucEnabled, fmucOutboundNode, " + "fmucOutboundMode, fmucInboundNodes " + "FROM ofMucRoom WHERE serviceID=? AND (emptyDate IS NULL or emptyDate > ?)"; private static final String LOAD_ALL_ROOMS = "SELECT roomID, creationDate, modificationDate, name, naturalName, description, " + "lockedDate, emptyDate, canChangeSubject, maxUsers, publicRoom, moderated, membersOnly, " + - "canInvite, roomPassword, canDiscoverJID, logEnabled, preserveHistOnRoomDeletion, subject, rolesToBroadcast, " + + "canInvite, roomPassword, canDiscoverJID, logEnabled, preserveHistOnDel, subject, rolesToBroadcast, " + "useReservedNick, canChangeNick, canRegister, allowpm, fmucEnabled, fmucOutboundNode, " + "fmucOutboundMode, fmucInboundNodes " + "FROM ofMucRoom WHERE serviceID=?"; @@ -105,14 +105,14 @@ public class MUCPersistenceManager { private static final String UPDATE_ROOM = "UPDATE ofMucRoom SET modificationDate=?, naturalName=?, description=?, " + "canChangeSubject=?, maxUsers=?, publicRoom=?, moderated=?, membersOnly=?, " + - "canInvite=?, roomPassword=?, canDiscoverJID=?, logEnabled=?, preserveHistOnRoomDeletion=?, rolesToBroadcast=?, " + + "canInvite=?, roomPassword=?, canDiscoverJID=?, logEnabled=?, preserveHistOnDel=?, rolesToBroadcast=?, " + "useReservedNick=?, canChangeNick=?, canRegister=?, allowpm=?, fmucEnabled=?, " + "fmucOutboundNode=?, fmucOutboundMode=?, fmucInboundNodes=? " + "WHERE roomID=?"; private static final String ADD_ROOM = "INSERT INTO ofMucRoom (serviceID, roomID, creationDate, modificationDate, name, naturalName, " + "description, lockedDate, emptyDate, canChangeSubject, maxUsers, publicRoom, moderated, " + - "membersOnly, canInvite, roomPassword, canDiscoverJID, logEnabled, preserveHistOnRoomDeletion, subject, " + + "membersOnly, canInvite, roomPassword, canDiscoverJID, logEnabled, preserveHistOnDel, subject, " + "rolesToBroadcast, useReservedNick, canChangeNick, canRegister, allowpm, fmucEnabled, fmucOutboundNode, " + "fmucOutboundMode, fmucInboundNodes) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; private static final String UPDATE_SUBJECT = @@ -260,7 +260,7 @@ public static void loadFromDB(MUCRoom room) { room.setPassword(rs.getString("roomPassword")); room.setCanAnyoneDiscoverJID(rs.getInt("canDiscoverJID") == 1); room.setLogEnabled(rs.getInt("logEnabled") == 1); - room.setPreserveHistOnRoomDeletionEnabled(rs.getInt("preserveHistOnRoomDeletion") == 1); + room.setPreserveHistOnRoomDeletionEnabled(rs.getInt("preserveHistOnDel") == 1); room.setSubject(rs.getString("subject")); List rolesToBroadcast = new ArrayList<>(); String roles = StringUtils.zeroPadString(Integer.toBinaryString(rs.getInt("rolesToBroadcast")), 3); @@ -689,7 +689,7 @@ private static Map loadRooms(Long serviceID, Date cleanupDate, Mu room.setPassword(resultSet.getString("roomPassword")); room.setCanAnyoneDiscoverJID(resultSet.getInt("canDiscoverJID") == 1); room.setLogEnabled(resultSet.getInt("logEnabled") == 1); - room.setPreserveHistOnRoomDeletionEnabled(resultSet.getInt("preserveHistOnRoomDeletion") == 1); + room.setPreserveHistOnRoomDeletionEnabled(resultSet.getInt("preserveHistOnDel") == 1); room.setSubject(resultSet.getString("subject")); List rolesToBroadcast = new ArrayList<>(); String roles = StringUtils.zeroPadString(Integer.toBinaryString(resultSet.getInt("rolesToBroadcast")), 3); From a114f0b1cea40c3611ebd32f6a887481441df956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CHuy?= Date: Wed, 27 Nov 2024 15:15:02 +0000 Subject: [PATCH 7/7] OF-2916 and OF-2917: Add the option to control MUC history preservation Changing muc#roomconfig_preservehistondel to {http://igniterealtime.org}muc#roomconfig_preservehistondel as it is a third party field. --- .../org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java | 6 +++--- xmppserver/src/main/webapp/muc-room-edit-form.jsp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java b/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java index a44d106e0f..c1c79395f8 100644 --- a/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java +++ b/xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java @@ -278,7 +278,7 @@ private void processConfigurationForm(@Nonnull final DataForm completedForm, @No room.setPublicRoom( parseFirstValueAsBoolean( field, true ) ); } - field = completedForm.getField("muc#roomconfig_preservehistondel"); + field = completedForm.getField("{http://igniterealtime.org}muc#roomconfig_preservehistondel"); if (field != null) { final boolean newValue = parseFirstValueAsBoolean(field, true); room.setPreserveHistOnRoomDeletionEnabled(newValue); @@ -576,7 +576,7 @@ private Element generateProbeResult(Locale preferredLocale) { LocaleUtils.getLocalizedString("muc.form.conf.owner_enablelogging", preferredLocale), Type.boolean_type); - configurationForm.addField("muc#roomconfig_preservehistondel", + configurationForm.addField("{http://igniterealtime.org}muc#roomconfig_preservehistondel", LocaleUtils.getLocalizedString("muc.form.conf.owner_preservehistondel", preferredLocale), Type.boolean_type); @@ -673,7 +673,7 @@ private Element generateProbeResult(Locale preferredLocale) { field.clearValues(); field.addValue((room.isLogEnabled() ? "1" : "0")); - field = configurationForm.getField("muc#roomconfig_preservehistondel"); + field = configurationForm.getField("{http://igniterealtime.org}muc#roomconfig_preservehistondel"); field.clearValues(); field.addValue((room.isPreserveHistOnRoomDeletionEnabled() ? "1" : "0")); diff --git a/xmppserver/src/main/webapp/muc-room-edit-form.jsp b/xmppserver/src/main/webapp/muc-room-edit-form.jsp index 3278091906..70548b30aa 100644 --- a/xmppserver/src/main/webapp/muc-room-edit-form.jsp +++ b/xmppserver/src/main/webapp/muc-room-edit-form.jsp @@ -247,7 +247,7 @@ dataForm.addField("muc#roomconfig_whois", null, null).addValue(whois); dataForm.addField("muc#roomconfig_allowpm", null, null).addValue(allowpm); dataForm.addField("muc#roomconfig_enablelogging", null, null).addValue(enableLog ? "1": "0"); - dataForm.addField("muc#roomconfig_preservehistondel", null, null).addValue(preserveHistOnRoomDeletion ? "1": "0"); + dataForm.addField("{http://igniterealtime.org}muc#roomconfig_preservehistondel", null, null).addValue(preserveHistOnRoomDeletion ? "1": "0"); dataForm.addField("x-muc#roomconfig_reservednick", null, null).addValue(reservedNick ? "1": "0"); dataForm.addField("x-muc#roomconfig_canchangenick", null, null).addValue(canchangenick ? "1": "0"); dataForm.addField("x-muc#roomconfig_registration", null, null).addValue(registration ? "1": "0");