Commit bdef6ba7 authored by Tom Evans's avatar Tom Evans

Merge pull request #478 from tevans/OF-122

OF-122: MUC subject change policy
parents a1c498cd 7ef6b4a7
...@@ -29,6 +29,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; ...@@ -29,6 +29,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import org.jivesoftware.openfire.muc.cluster.UpdateHistoryStrategy; import org.jivesoftware.openfire.muc.cluster.UpdateHistoryStrategy;
import org.jivesoftware.openfire.muc.spi.MUCPersistenceManager; import org.jivesoftware.openfire.muc.spi.MUCPersistenceManager;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.cache.CacheFactory; import org.jivesoftware.util.cache.CacheFactory;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -334,12 +335,20 @@ public class HistoryStrategy { ...@@ -334,12 +335,20 @@ public class HistoryStrategy {
// The subject is changed by sending a message of type "groupchat" to the <room@service>, // The subject is changed by sending a message of type "groupchat" to the <room@service>,
// where the <message/> MUST contain a <subject/> element that specifies the new subject // where the <message/> MUST contain a <subject/> element that specifies the new subject
// but MUST NOT contain a <body/> element (or a <thread/> element). // but MUST NOT contain a <body/> element (or a <thread/> element).
// Unfortunately, many clients do not follow these strict guidelines from the specs, so we
// allow a lenient policy for detecting non-conforming subject change requests. This can be
// configured by setting the "xmpp.muc.subject.change.strict" property to false (true by default).
// An empty <subject/> value means that the room subject should be removed. // An empty <subject/> value means that the room subject should be removed.
return Message.Type.groupchat == message.getType() && return Message.Type.groupchat == message.getType() &&
message.getSubject() != null && message.getSubject() != null &&
message.getBody() == null && (!isSubjectChangeStrict() ||
message.getThread() == null; (message.getBody() == null &&
message.getThread() == null));
}
private boolean isSubjectChangeStrict() {
return JiveGlobals.getBooleanProperty("xmpp.muc.subject.change.strict", true);
} }
private static class MessageComparator implements Comparator<Message> { private static class MessageComparator implements Comparator<Message> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment