/** * Returns true if the given message qualifies as a subject change request for * the target MUC room, per XEP-0045. Note that this does not validate whether * the sender has permission to make the change, because subject change requests * may be loaded from history or processed "live" during a user's session. * * Refer to http://xmpp.org/extensions/xep-0045.html#subject-mod for details. * * @return true if the given packet is a subject change request */ public boolean isSubjectChangeRequest(Message message) { // 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 // 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. return Message.Type.groupchat == message.getType() && message.getSubject() != null && (!isSubjectChangeStrict() || (message.getBody() == null && message.getThread() == null)); }
/** * Returns true if the given message qualifies as a subject change request for * the target MUC room, per XEP-0045. Note that this does not validate whether * the sender has permission to make the change, because subject change requests * may be loaded from history or processed "live" during a user's session. * * Refer to http://xmpp.org/extensions/xep-0045.html#subject-mod for details. * * @return true if the given packet is a subject change request */ public boolean isSubjectChangeRequest(Message message) { // 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 // 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. return Message.Type.groupchat == message.getType() && message.getSubject() != null && (!isSubjectChangeStrict() || (message.getBody() == null && message.getThread() == null)); }