Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
6124ac93
Unverified
Commit
6124ac93
authored
Jun 14, 2016
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-1150: muc#roomconfig_allowpm
parent
e3dee9e5
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
169 additions
and
16 deletions
+169
-16
openfire_db2.sql
src/database/openfire_db2.sql
+2
-1
openfire_hsqldb.sql
src/database/openfire_hsqldb.sql
+2
-1
openfire_mysql.sql
src/database/openfire_mysql.sql
+2
-1
openfire_oracle.sql
src/database/openfire_oracle.sql
+2
-1
openfire_postgresql.sql
src/database/openfire_postgresql.sql
+2
-1
openfire_sqlserver.sql
src/database/openfire_sqlserver.sql
+2
-1
openfire_sybase.sql
src/database/openfire_sybase.sql
+1
-0
openfire_db2.sql
src/database/upgrade/23/openfire_db2.sql
+2
-0
openfire_hsqldb.sql
src/database/upgrade/23/openfire_hsqldb.sql
+2
-0
openfire_mysql.sql
src/database/upgrade/23/openfire_mysql.sql
+2
-0
openfire_oracle.sql
src/database/upgrade/23/openfire_oracle.sql
+3
-0
openfire_postgresql.sql
src/database/upgrade/23/openfire_postgresql.sql
+2
-0
openfire_sqlserver.sql
src/database/upgrade/23/openfire_sqlserver.sql
+2
-0
openfire_sybase.sql
src/database/upgrade/23/openfire_sybase.sql
+2
-0
openfire_i18n_en.properties
src/i18n/openfire_i18n_en.properties
+1
-0
SchemaManager.java
src/java/org/jivesoftware/database/SchemaManager.java
+1
-1
MUCEventDelegate.java
src/java/org/jivesoftware/openfire/muc/MUCEventDelegate.java
+1
-0
MUCRoom.java
src/java/org/jivesoftware/openfire/muc/MUCRoom.java
+18
-1
IQOwnerHandler.java
...ava/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java
+19
-0
LocalMUCRoom.java
src/java/org/jivesoftware/openfire/muc/spi/LocalMUCRoom.java
+40
-1
LocalMUCUser.java
src/java/org/jivesoftware/openfire/muc/spi/LocalMUCUser.java
+1
-1
MUCPersistenceManager.java
.../jivesoftware/openfire/muc/spi/MUCPersistenceManager.java
+38
-6
muc-room-edit-form.jsp
src/web/muc-room-edit-form.jsp
+22
-0
No files found.
src/database/openfire_db2.sql
View file @
6124ac93
...
...
@@ -223,6 +223,7 @@ CREATE TABLE ofMucRoom (
useReservedNick
INTEGER
NOT
NULL
,
canChangeNick
INTEGER
NOT
NULL
,
canRegister
INTEGER
NOT
NULL
,
allowpm
INTEGER
NULL
,
CONSTRAINT
ofMucRoom_pk
PRIMARY
KEY
(
serviceID
,
name
)
);
CREATE
INDEX
ofMucRoom_roomid_idx
ON
ofMucRoom
(
roomID
);
...
...
@@ -390,7 +391,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT
INTO
ofID
(
idType
,
id
)
VALUES
(
23
,
1
);
INSERT
INTO
ofID
(
idType
,
id
)
VALUES
(
26
,
2
);
INSERT
INTO
ofVersion
(
name
,
version
)
VALUES
(
'openfire'
,
2
2
);
INSERT
INTO
ofVersion
(
name
,
version
)
VALUES
(
'openfire'
,
2
3
);
-- Entry for admin user
INSERT
INTO
ofUser
(
username
,
plainPassword
,
name
,
email
,
creationDate
,
modificationDate
)
...
...
src/database/openfire_hsqldb.sql
View file @
6124ac93
...
...
@@ -219,6 +219,7 @@ CREATE TABLE ofMucRoom (
useReservedNick
INTEGER
NOT
NULL
,
canChangeNick
INTEGER
NOT
NULL
,
canRegister
INTEGER
NOT
NULL
,
allowpm
INTEGER
NULL
,
CONSTRAINT
ofMucRoom_pk
PRIMARY
KEY
(
serviceID
,
name
)
);
CREATE
INDEX
ofMucRoom_roomid_idx
ON
ofMucRoom
(
roomID
);
...
...
@@ -376,7 +377,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT
INTO
ofID
(
idType
,
id
)
VALUES
(
23
,
1
);
INSERT
INTO
ofID
(
idType
,
id
)
VALUES
(
26
,
2
);
INSERT
INTO
ofVersion
(
name
,
version
)
VALUES
(
'openfire'
,
2
2
);
INSERT
INTO
ofVersion
(
name
,
version
)
VALUES
(
'openfire'
,
2
3
);
//
Entry
for
admin
user
INSERT
INTO
ofUser
(
username
,
plainPassword
,
name
,
email
,
creationDate
,
modificationDate
)
...
...
src/database/openfire_mysql.sql
View file @
6124ac93
...
...
@@ -208,6 +208,7 @@ CREATE TABLE ofMucRoom (
useReservedNick
TINYINT
NOT
NULL
,
canChangeNick
TINYINT
NOT
NULL
,
canRegister
TINYINT
NOT
NULL
,
allowpm
TINYINT
NULL
,
PRIMARY
KEY
(
serviceID
,
name
),
INDEX
ofMucRoom_roomid_idx
(
roomID
),
INDEX
ofMucRoom_serviceid_idx
(
serviceID
)
...
...
@@ -365,7 +366,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT
INTO
ofID
(
idType
,
id
)
VALUES
(
23
,
1
);
INSERT
INTO
ofID
(
idType
,
id
)
VALUES
(
26
,
2
);
INSERT
INTO
ofVersion
(
name
,
version
)
VALUES
(
'openfire'
,
2
2
);
INSERT
INTO
ofVersion
(
name
,
version
)
VALUES
(
'openfire'
,
2
3
);
#
Entry
for
admin
user
INSERT
INTO
ofUser
(
username
,
plainPassword
,
name
,
email
,
creationDate
,
modificationDate
)
...
...
src/database/openfire_oracle.sql
View file @
6124ac93
...
...
@@ -216,6 +216,7 @@ CREATE TABLE ofMucRoom(
useReservedNick
INTEGER
NOT
NULL
,
canChangeNick
INTEGER
NOT
NULL
,
canRegister
INTEGER
NOT
NULL
,
allowpm
INTEGER
NULL
,
CONSTRAINT
ofMucRoom_pk
PRIMARY
KEY
(
serviceID
,
name
)
);
CREATE
INDEX
ofMucRoom_roomid_idx
ON
ofMucRoom
(
roomID
);
...
...
@@ -373,7 +374,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT
INTO
ofID
(
idType
,
id
)
VALUES
(
23
,
1
);
INSERT
INTO
ofID
(
idType
,
id
)
VALUES
(
26
,
2
);
INSERT
INTO
ofVersion
(
name
,
version
)
VALUES
(
'openfire'
,
2
2
);
INSERT
INTO
ofVersion
(
name
,
version
)
VALUES
(
'openfire'
,
2
3
);
-- Entry for admin user
INSERT
INTO
ofUser
(
username
,
plainPassword
,
name
,
email
,
creationDate
,
modificationDate
)
...
...
src/database/openfire_postgresql.sql
View file @
6124ac93
...
...
@@ -224,6 +224,7 @@ CREATE TABLE ofMucRoom (
useReservedNick
INTEGER
NOT
NULL
,
canChangeNick
INTEGER
NOT
NULL
,
canRegister
INTEGER
NOT
NULL
,
allowpm
INTEGER
NULL
,
CONSTRAINT
ofMucRoom_pk
PRIMARY
KEY
(
serviceID
,
name
)
);
CREATE
INDEX
ofMucRoom_roomid_idx
ON
ofMucRoom
(
roomID
);
...
...
@@ -381,7 +382,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT
INTO
ofID
(
idType
,
id
)
VALUES
(
23
,
1
);
INSERT
INTO
ofID
(
idType
,
id
)
VALUES
(
26
,
2
);
INSERT
INTO
ofVersion
(
name
,
version
)
VALUES
(
'openfire'
,
2
2
);
INSERT
INTO
ofVersion
(
name
,
version
)
VALUES
(
'openfire'
,
2
3
);
-- Entry for admin user
INSERT
INTO
ofUser
(
username
,
plainPassword
,
name
,
email
,
creationDate
,
modificationDate
)
...
...
src/database/openfire_sqlserver.sql
View file @
6124ac93
...
...
@@ -222,6 +222,7 @@ CREATE TABLE ofMucRoom (
useReservedNick
INT
NOT
NULL
,
canChangeNick
INT
NOT
NULL
,
canRegister
INT
NOT
NULL
,
allowpm
INT
NULL
,
CONSTRAINT
ofMucRoom_pk
PRIMARY
KEY
(
serviceID
,
name
)
);
CREATE
INDEX
ofMucRoom_roomid_idx
on
ofMucRoom
(
roomID
);
...
...
@@ -379,7 +380,7 @@ INSERT INTO ofID (idType, id) VALUES (19, 1);
INSERT
INTO
ofID
(
idType
,
id
)
VALUES
(
23
,
1
);
INSERT
INTO
ofID
(
idType
,
id
)
VALUES
(
26
,
2
);
INSERT
INTO
ofVersion
(
name
,
version
)
VALUES
(
'openfire'
,
2
2
);
INSERT
INTO
ofVersion
(
name
,
version
)
VALUES
(
'openfire'
,
2
3
);
/* Entry for admin user */
INSERT
INTO
ofUser
(
username
,
plainPassword
,
name
,
email
,
creationDate
,
modificationDate
)
...
...
src/database/openfire_sybase.sql
View file @
6124ac93
...
...
@@ -222,6 +222,7 @@ CREATE TABLE ofMucRoom (
useReservedNick
INT
NOT
NULL
,
canChangeNick
INT
NOT
NULL
,
canRegister
INT
NOT
NULL
,
allowpm
INT
NULL
,
CONSTRAINT
ofMucRoom_pk
PRIMARY
KEY
(
serviceID
,
name
)
);
CREATE
INDEX
ofMucRoom_roomid_idx
on
ofMucRoom
(
roomID
);
...
...
src/database/upgrade/23/openfire_db2.sql
0 → 100644
View file @
6124ac93
ALTER
TABLE
ofMucRoom
ADD
COLUMN
allowpm
INTEGER
NULL
;
UPDATE
ofVersion
SET
version
=
23
WHERE
name
=
'openfire'
;
src/database/upgrade/23/openfire_hsqldb.sql
0 → 100644
View file @
6124ac93
ALTER
TABLE
ofMucRoom
ADD
COLUMN
allowpm
INTEGER
NULL
;
UPDATE
ofVersion
SET
version
=
23
WHERE
name
=
'openfire'
;
\ No newline at end of file
src/database/upgrade/23/openfire_mysql.sql
0 → 100644
View file @
6124ac93
ALTER
TABLE
ofMucRoom
ADD
COLUMN
allowpm
TINYINT
NULL
;
UPDATE
ofVersion
SET
version
=
23
WHERE
name
=
'openfire'
;
src/database/upgrade/23/openfire_oracle.sql
0 → 100644
View file @
6124ac93
ALTER
TABLE
ofMucRoom
ADD
COLUMN
allowpm
INTEGER
NULL
;
UPDATE
ofVersion
SET
version
=
23
WHERE
name
=
'openfire'
;
COMMIT
;
src/database/upgrade/23/openfire_postgresql.sql
0 → 100644
View file @
6124ac93
ALTER
TABLE
ofMucRoom
ADD
COLUMN
allowpm
INTEGER
NULL
;
UPDATE
ofVersion
SET
version
=
23
WHERE
name
=
'openfire'
;
src/database/upgrade/23/openfire_sqlserver.sql
0 → 100644
View file @
6124ac93
ALTER
TABLE
ofMucRoom
ADD
COLUMN
allowpm
INT
NULL
;
UPDATE
ofVersion
SET
version
=
23
WHERE
name
=
'openfire'
;
src/database/upgrade/23/openfire_sybase.sql
0 → 100644
View file @
6124ac93
ALTER
TABLE
ofMucRoom
ADD
COLUMN
allowpm
INT
NULL
;
UPDATE
ofVersion
SET
version
=
23
WHERE
name
=
'openfire'
;
src/i18n/openfire_i18n_en.properties
View file @
6124ac93
...
...
@@ -1227,6 +1227,7 @@ muc.room.edit.form.required_password=Password Required to Enter
muc.room.edit.form.confirm_password
=
Confirm Password
muc.room.edit.form.new_password
=
Please make sure to enter the same new password.
muc.room.edit.form.discover_jid
=
Show Real JIDs of Occupants to
muc.room.edit.form.allowpm
=
Allowed to Send Private Messages
muc.room.edit.form.anyone
=
Anyone
muc.room.edit.form.role
=
Please select a role.
muc.room.edit.form.room_options
=
Room Options
...
...
src/java/org/jivesoftware/database/SchemaManager.java
View file @
6124ac93
...
...
@@ -68,7 +68,7 @@ public class SchemaManager {
/**
* Current Openfire database schema version.
*/
private
static
final
int
DATABASE_VERSION
=
2
2
;
private
static
final
int
DATABASE_VERSION
=
2
3
;
/**
* Checks the Openfire database schema to ensure that it's installed and up to date.
...
...
src/java/org/jivesoftware/openfire/muc/MUCEventDelegate.java
View file @
6124ac93
...
...
@@ -126,6 +126,7 @@ public abstract class MUCEventDelegate {
room
.
setPublicRoom
(
"1"
.
equals
(
roomConfig
.
get
(
"muc#roomconfig_publicroom"
)));
room
.
setCanOccupantsInvite
(
"1"
.
equals
(
roomConfig
.
get
(
"muc#roomconfig_allowinvites"
)));
room
.
setCanAnyoneDiscoverJID
(
"anyone"
.
equals
(
roomConfig
.
get
(
"muc#roomconfig_whois"
)));
room
.
setCanSendPrivateMessage
(
roomConfig
.
get
(
"muc#roomconfig_allowpm"
)
);
room
.
setChangeNickname
(
"1"
.
equals
(
roomConfig
.
get
(
"x-muc#roomconfig_canchangenick"
)));
room
.
setRegistrationEnabled
(
"1"
.
equals
(
roomConfig
.
get
(
"x-muc#roomconfig_registration"
)));
room
.
setPersistent
(
"1"
.
equals
(
roomConfig
.
get
(
"muc#roomconfig_persistentroom"
)));
...
...
src/java/org/jivesoftware/openfire/muc/MUCRoom.java
View file @
6124ac93
...
...
@@ -525,8 +525,9 @@ public interface MUCRoom extends Externalizable, Result {
* @param packet The packet to send.
* @param senderRole the role of the user that is trying to send a public message.
* @throws NotFoundException If the user is sending a packet to a room JID that does not exist.
* @throws ForbiddenException If a user of this role is not permitted to send private messages in this room.
*/
public
void
sendPrivatePacket
(
Packet
packet
,
MUCRole
senderRole
)
throws
NotFoundException
;
public
void
sendPrivatePacket
(
Packet
packet
,
MUCRole
senderRole
)
throws
NotFoundException
,
ForbiddenException
;
/**
* Kicks a user from the room. If the user was in the room, the returned updated presence will
...
...
@@ -621,6 +622,22 @@ public interface MUCRoom extends Externalizable, Result {
*/
public
void
setCanAnyoneDiscoverJID
(
boolean
canAnyoneDiscoverJID
);
/**
* Returns the minimal role of persons that are allowed to send private messages in the room. The returned value is
* any one of: "anyone", "moderators", "participants", "none".
*
* @return The minimal role of persons that are allowed to send private messages in the room (never null).
*/
public
String
canSendPrivateMessage
();
/**
* Sets the minimal role of persons that are allowed to send private messages in the room. The provided value is
* any one of: "anyone", "moderators", "participants", "none". If another value is set, "anyone" is used instead.
*
* @role The minimal role of persons that are allowed to send private messages in the room (never null).
*/
public
void
setCanSendPrivateMessage
(
String
role
);
/**
* Returns true if participants are allowed to change the room's subject.
*
...
...
src/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java
View file @
6124ac93
...
...
@@ -349,6 +349,12 @@ public class IQOwnerHandler {
room
.
setCanAnyoneDiscoverJID
((
"anyone"
.
equals
(
booleanValue
)));
}
field
=
completedForm
.
getField
(
"muc#roomconfig_allowpm"
);
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
room
.
setCanSendPrivateMessage
(
value
);
}
field
=
completedForm
.
getField
(
"muc#roomconfig_enablelogging"
);
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
...
...
@@ -486,6 +492,10 @@ public class IQOwnerHandler {
field
.
clearValues
();
field
.
addValue
((
room
.
canAnyoneDiscoverJID
()
?
"anyone"
:
"moderators"
));
field
=
configurationForm
.
getField
(
"muc#roomconfig_allowpm"
);
field
.
clearValues
();
field
.
addValue
((
room
.
canSendPrivateMessage
()
));
field
=
configurationForm
.
getField
(
"muc#roomconfig_enablelogging"
);
field
.
clearValues
();
field
.
addValue
((
room
.
isLogEnabled
()
?
"1"
:
"0"
));
...
...
@@ -634,6 +644,15 @@ public class IQOwnerHandler {
whois
.
addOption
(
LocaleUtils
.
getLocalizedString
(
"muc.form.conf.moderator"
),
"moderators"
);
whois
.
addOption
(
LocaleUtils
.
getLocalizedString
(
"muc.form.conf.anyone"
),
"anyone"
);
final
FormField
allowpm
=
configurationForm
.
addField
(
"muc#roomconfig_allowpm"
,
LocaleUtils
.
getLocalizedString
(
"muc.form.conf.owner_allowpm"
),
Type
.
list_single
);
allowpm
.
addOption
(
LocaleUtils
.
getLocalizedString
(
"muc.form.conf.anyone"
),
"anyone"
);
allowpm
.
addOption
(
LocaleUtils
.
getLocalizedString
(
"muc.form.conf.moderator"
),
"moderators"
);
allowpm
.
addOption
(
LocaleUtils
.
getLocalizedString
(
"muc.form.conf.participant"
),
"participants"
);
allowpm
.
addOption
(
LocaleUtils
.
getLocalizedString
(
"muc.form.conf.none"
),
"none"
);
configurationForm
.
addField
(
"muc#roomconfig_enablelogging"
,
LocaleUtils
.
getLocalizedString
(
"muc.form.conf.owner_enablelogging"
),
Type
.
boolean_type
);
...
...
src/java/org/jivesoftware/openfire/muc/spi/LocalMUCRoom.java
View file @
6124ac93
...
...
@@ -268,6 +268,11 @@ public class LocalMUCRoom implements MUCRoom, GroupEventListener {
*/
private
boolean
canAnyoneDiscoverJID
;
/**
* The minimal role of persons that are allowed to send private messages in the room.
*/
private
String
canSendPrivateMessage
;
/**
* Enables the logging of the conversation. The conversation in the room will be saved to the
* database.
...
...
@@ -1061,7 +1066,18 @@ public class LocalMUCRoom implements MUCRoom, GroupEventListener {
}
@Override
public
void
sendPrivatePacket
(
Packet
packet
,
MUCRole
senderRole
)
throws
NotFoundException
{
public
void
sendPrivatePacket
(
Packet
packet
,
MUCRole
senderRole
)
throws
NotFoundException
,
ForbiddenException
{
switch
(
senderRole
.
getRole
())
{
// intended fall-through
case
none:
throw
new
ForbiddenException
();
default
:
case
visitor:
if
(
canSendPrivateMessage
.
equals
(
"participants"
))
throw
new
ForbiddenException
();
case
participant:
if
(
canSendPrivateMessage
.
equals
(
"moderators"
))
throw
new
ForbiddenException
();
case
moderator:
if
(
canSendPrivateMessage
.
equals
(
"none"
))
throw
new
ForbiddenException
();
}
String
resource
=
packet
.
getTo
().
getResource
();
List
<
MUCRole
>
occupants
=
occupantsByNickname
.
get
(
resource
.
toLowerCase
());
if
(
occupants
==
null
||
occupants
.
size
()
==
0
)
{
...
...
@@ -2329,6 +2345,29 @@ public class LocalMUCRoom implements MUCRoom, GroupEventListener {
this
.
canAnyoneDiscoverJID
=
canAnyoneDiscoverJID
;
}
@Override
public
String
canSendPrivateMessage
()
{
return
canSendPrivateMessage
==
null
?
"anyone"
:
canSendPrivateMessage
;
}
@Override
public
void
setCanSendPrivateMessage
(
String
role
)
{
if
(
role
==
null
)
{
role
=
"(null)"
;
}
switch
(
role
.
toLowerCase
()
)
{
case
"none"
:
case
"moderators"
:
case
"participants"
:
case
"anyone"
:
this
.
canSendPrivateMessage
=
role
.
toLowerCase
();
break
;
default
:
Log
.
warn
(
"Illegal value for muc#roomconfig_allowpm: '{}'. Defaulting to 'anyone'"
,
role
.
toLowerCase
()
);
this
.
canSendPrivateMessage
=
"anyone"
;
}
}
@Override
public
boolean
canOccupantsChangeSubject
()
{
return
canOccupantsChangeSubject
;
...
...
src/java/org/jivesoftware/openfire/muc/spi/LocalMUCUser.java
View file @
6124ac93
...
...
@@ -394,7 +394,7 @@ public class LocalMUCUser implements MUCUser {
// User is sending an IQ result packet to another room occupant
role
.
getChatRoom
().
sendPrivatePacket
(
packet
,
role
);
}
catch
(
NotFoundException
e
)
{
catch
(
NotFoundException
|
ForbiddenException
e
)
{
// Do nothing. No error will be sent to the sender of the IQ result packet
}
}
...
...
src/java/org/jivesoftware/openfire/muc/spi/MUCPersistenceManager.java
View file @
6124ac93
...
...
@@ -63,7 +63,7 @@ public class MUCPersistenceManager {
"SELECT roomID, creationDate, modificationDate, naturalName, description, lockedDate, "
+
"emptyDate, canChangeSubject, maxUsers, publicRoom, moderated, membersOnly, canInvite, "
+
"roomPassword, canDiscoverJID, logEnabled, subject, rolesToBroadcast, useReservedNick, "
+
"canChangeNick, canRegister FROM ofMucRoom WHERE serviceID=? AND name=?"
;
"canChangeNick, canRegister
, allowpm
FROM ofMucRoom WHERE serviceID=? AND name=?"
;
private
static
final
String
LOAD_AFFILIATIONS
=
"SELECT jid, affiliation FROM ofMucAffiliation WHERE roomID=?"
;
private
static
final
String
LOAD_MEMBERS
=
...
...
@@ -75,7 +75,7 @@ public class MUCPersistenceManager {
"SELECT roomID, creationDate, modificationDate, name, naturalName, description, "
+
"lockedDate, emptyDate, canChangeSubject, maxUsers, publicRoom, moderated, membersOnly, "
+
"canInvite, roomPassword, canDiscoverJID, logEnabled, subject, rolesToBroadcast, "
+
"useReservedNick, canChangeNick, canRegister "
+
"useReservedNick, canChangeNick, canRegister
, allowpm
"
+
"FROM ofMucRoom WHERE serviceID=? AND (emptyDate IS NULL or emptyDate > ?)"
;
private
static
final
String
LOAD_ALL_AFFILIATIONS
=
"SELECT ofMucAffiliation.roomID,ofMucAffiliation.jid,ofMucAffiliation.affiliation "
+
...
...
@@ -93,13 +93,13 @@ public class MUCPersistenceManager {
"UPDATE ofMucRoom SET modificationDate=?, naturalName=?, description=?, "
+
"canChangeSubject=?, maxUsers=?, publicRoom=?, moderated=?, membersOnly=?, "
+
"canInvite=?, roomPassword=?, canDiscoverJID=?, logEnabled=?, rolesToBroadcast=?, "
+
"useReservedNick=?, canChangeNick=?, canRegister=? WHERE roomID=?"
;
"useReservedNick=?, canChangeNick=?, canRegister=?
, allowpm=?
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, "
+
"rolesToBroadcast, useReservedNick, canChangeNick, canRegister) VALUES (?,?,?,?,?,?,?,?,?,"
+
"?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
;
"rolesToBroadcast, useReservedNick, canChangeNick, canRegister
, allowpm
) VALUES (?,?,?,?,?,?,?,?,?,"
+
"?,?,?,?,?,?,?,?,?,?,?,?,?,?
,?
)"
;
private
static
final
String
UPDATE_SUBJECT
=
"UPDATE ofMucRoom SET subject=? WHERE roomID=?"
;
private
static
final
String
UPDATE_LOCK
=
...
...
@@ -222,6 +222,14 @@ public class MUCPersistenceManager {
room
.
setLoginRestrictedToNickname
(
rs
.
getInt
(
19
)
==
1
);
room
.
setChangeNickname
(
rs
.
getInt
(
20
)
==
1
);
room
.
setRegistrationEnabled
(
rs
.
getInt
(
21
)
==
1
);
switch
(
rs
.
getInt
(
22
))
// null returns 0.
{
default
:
case
0
:
room
.
setCanSendPrivateMessage
(
"anyone"
);
break
;
case
1
:
room
.
setCanSendPrivateMessage
(
"participants"
);
break
;
case
2
:
room
.
setCanSendPrivateMessage
(
"moderators"
);
break
;
case
3
:
room
.
setCanSendPrivateMessage
(
"none"
);
break
;
}
room
.
setPersistent
(
true
);
DbConnectionManager
.
fastcloseStmt
(
rs
,
pstmt
);
...
...
@@ -342,7 +350,15 @@ public class MUCPersistenceManager {
pstmt
.
setInt
(
14
,
(
room
.
isLoginRestrictedToNickname
()
?
1
:
0
));
pstmt
.
setInt
(
15
,
(
room
.
canChangeNickname
()
?
1
:
0
));
pstmt
.
setInt
(
16
,
(
room
.
isRegistrationEnabled
()
?
1
:
0
));
pstmt
.
setLong
(
17
,
room
.
getID
());
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
;
}
pstmt
.
setLong
(
18
,
room
.
getID
());
pstmt
.
executeUpdate
();
}
else
{
...
...
@@ -376,6 +392,14 @@ public class MUCPersistenceManager {
pstmt
.
setInt
(
21
,
(
room
.
isLoginRestrictedToNickname
()
?
1
:
0
));
pstmt
.
setInt
(
22
,
(
room
.
canChangeNickname
()
?
1
:
0
));
pstmt
.
setInt
(
23
,
(
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
;
}
pstmt
.
executeUpdate
();
}
}
...
...
@@ -521,6 +545,14 @@ public class MUCPersistenceManager {
room
.
setLoginRestrictedToNickname
(
resultSet
.
getInt
(
20
)
==
1
);
room
.
setChangeNickname
(
resultSet
.
getInt
(
21
)
==
1
);
room
.
setRegistrationEnabled
(
resultSet
.
getInt
(
22
)
==
1
);
switch
(
resultSet
.
getInt
(
23
))
// null returns 0.
{
default
:
case
0
:
room
.
setCanSendPrivateMessage
(
"anyone"
);
break
;
case
1
:
room
.
setCanSendPrivateMessage
(
"participants"
);
break
;
case
2
:
room
.
setCanSendPrivateMessage
(
"moderators"
);
break
;
case
3
:
room
.
setCanSendPrivateMessage
(
"none"
);
break
;
}
room
.
setPersistent
(
true
);
rooms
.
put
(
room
.
getID
(),
room
);
}
catch
(
SQLException
e
)
{
...
...
src/web/muc-room-edit-form.jsp
View file @
6124ac93
...
...
@@ -68,6 +68,7 @@
String
password
=
ParamUtils
.
getParameter
(
request
,
"roomconfig_roomsecret"
);
String
confirmPassword
=
ParamUtils
.
getParameter
(
request
,
"roomconfig_roomsecret2"
);
String
whois
=
ParamUtils
.
getParameter
(
request
,
"roomconfig_whois"
);
String
allowpm
=
ParamUtils
.
getParameter
(
request
,
"roomconfig_allowpm"
);
String
publicRoom
=
ParamUtils
.
getParameter
(
request
,
"roomconfig_publicroom"
);
String
persistentRoom
=
ParamUtils
.
getParameter
(
request
,
"roomconfig_persistentroom"
);
String
moderatedRoom
=
ParamUtils
.
getParameter
(
request
,
"roomconfig_moderatedroom"
);
...
...
@@ -136,6 +137,9 @@
if
(
whois
==
null
)
{
errors
.
put
(
"roomconfig_whois"
,
"roomconfig_whois"
);
}
if
(
allowpm
==
null
||
!(
allowpm
.
equals
(
"anyone"
)
||
allowpm
.
equals
(
"moderators"
)
||
allowpm
.
equals
(
"participants"
)
||
allowpm
.
equals
(
"none"
))
)
{
errors
.
put
(
"roomconfig_allowpm"
,
"romconfig_allowpm"
);
}
if
(
create
&&
errors
.
size
()
==
0
)
{
if
(
roomName
==
null
||
roomName
.
contains
(
"@"
))
{
errors
.
put
(
"roomName"
,
"roomName"
);
...
...
@@ -244,6 +248,10 @@
field
.
addValue
(
whois
);
dataForm
.
addField
(
field
);
field
=
new
XFormFieldImpl
(
"muc#roomconfig_allowpm"
);
field
.
addValue
(
allowpm
);
dataForm
.
addField
(
field
);
field
=
new
XFormFieldImpl
(
"muc#roomconfig_enablelogging"
);
field
.
addValue
((
enableLog
==
null
)
?
"0"
:
"1"
);
dataForm
.
addField
(
field
);
...
...
@@ -316,6 +324,7 @@
broadcastParticipant
=
"true"
;
broadcastVisitor
=
"true"
;
whois
=
"moderator"
;
allowpm
=
"anyone"
;
publicRoom
=
"true"
;
// Rooms created from the admin console are always persistent
persistentRoom
=
"true"
;
...
...
@@ -333,6 +342,7 @@
password
=
room
.
getPassword
();
confirmPassword
=
room
.
getPassword
();
whois
=
(
room
.
canAnyoneDiscoverJID
()
?
"anyone"
:
"moderator"
);
allowpm
=
room
.
canSendPrivateMessage
();
publicRoom
=
Boolean
.
toString
(
room
.
isPublicRoom
());
persistentRoom
=
Boolean
.
toString
(
room
.
isPersistent
());
moderatedRoom
=
Boolean
.
toString
(
room
.
isModerated
());
...
...
@@ -383,6 +393,8 @@
<fmt:message
key=
"muc.room.edit.form.new_password"
/>
<%
}
else
if
(
errors
.
get
(
"roomconfig_whois"
)
!=
null
)
{
%>
<fmt:message
key=
"muc.room.edit.form.role"
/>
<%
}
else
if
(
errors
.
get
(
"roomconfig_allowpm"
)
!=
null
)
{
%>
<fmt:message
key=
"muc.room.edit.form.role"
/>
<%
}
else
if
(
errors
.
get
(
"roomName"
)
!=
null
)
{
%>
<fmt:message
key=
"muc.room.edit.form.valid_hint"
/>
<%
}
else
if
(
errors
.
get
(
"room_already_exists"
)
!=
null
)
{
%>
...
...
@@ -554,6 +566,16 @@
</select>
</td>
</tr>
<tr>
<td><fmt:message
key=
"muc.room.edit.form.allowpm"
/>
:
</td>
<td><select
name=
"roomconfig_allowpm"
>
<option
value=
"none"
<%
if
(
"none"
.
equals
(
allowpm
))
out
.
write
(
"selected"
);
%>><fmt:message
key=
"muc.form.conf.none"
/></option>
<option
value=
"moderators"
<%
if
(
"moderators"
.
equals
(
allowpm
))
out
.
write
(
"selected"
);
%>><fmt:message
key=
"muc.room.edit.form.moderator"
/></option>
<option
value=
"participants"
<%
if
(
"participants"
.
equals
(
allowpm
))
out
.
write
(
"selected"
);
%>><fmt:message
key=
"muc.room.edit.form.participant"
/></option>
<option
value=
"anyone"
<%
if
(
"anyone"
.
equals
(
allowpm
))
out
.
write
(
"selected"
);
%>><fmt:message
key=
"muc.room.edit.form.anyone"
/></option>
</select>
</td>
</tr>
</tbody>
</table>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment