Commit c62fa09d authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Fixed creation of rooms.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10517 b35dd754-fafc-0310-a699-88a17e54d16e
parent 05e6ec4e
package org.jivesoftware.openfire.clearspace;
import org.dom4j.Attribute;
import org.dom4j.Element;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.muc.MUCEventDelegate;
import org.jivesoftware.openfire.muc.MUCRoom;
import org.jivesoftware.util.StringUtils;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.StringUtils;
import org.xmpp.packet.IQ;
import org.xmpp.packet.JID;
import org.xmpp.packet.PacketError;
import org.dom4j.Element;
import org.dom4j.Attribute;
import java.util.HashMap;
import java.util.Map;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* Handles checking with Clearspace regarding whether a user can join a particular MUC room (based
......@@ -126,6 +126,10 @@ public class ClearspaceMUCEventDelegate extends MUCEventDelegate {
return false;
}
public boolean shouldRecreate(String roomName, JID userjid) {
return !(roomName + "@" + csComponentAddress).equals(userjid.toBareJID());
}
public Map<String, String> getRoomConfig(String roomName) {
Map<String, String> roomConfig = new HashMap<String, String>();
......
......@@ -65,6 +65,17 @@ public abstract class MUCEventDelegate {
*/
public abstract boolean destroyingRoom(String roomName, JID userjid);
/**
* Returns true if the room that is not present in the server should have existed and needs
* to be recreated.
*
* @param roomName name of the room.
* @param userjid JID Of the user trying to join/create the room.
* @return true if the room that is not present in the server should have existed and needs
* to be recreated.
*/
public abstract boolean shouldRecreate(String roomName, JID userjid);
/**
* Loads a delegate provided room configuration for the room specified.
*
......
......@@ -480,7 +480,7 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
catch (IllegalArgumentException e) {
// Check if room needs to be recreated in case it failed to be created previously
// (or was deleted somehow and is expected to exist by a delegate).
if (mucEventDelegate != null) {
if (mucEventDelegate != null && mucEventDelegate.shouldRecreate(roomName, userjid)) {
if (mucEventDelegate.loadConfig(room)) {
loaded = true;
if (room.isPersistent()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment