Commit 9402f3a8 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

Mods to MUC service to allow for setting a delegate and adding extra...

Mods to MUC service to allow for setting a delegate and adding extra features/changing identity.  Also, CS manager now sets up/configures muc service with delegate.  Delegate itself still needs work.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10119 b35dd754-fafc-0310-a699-88a17e54d16e
parent b3c1b345
......@@ -423,8 +423,14 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM
Log.error("ClearspaceManager: Found no "+MUC_SUBDOMAIN+" service, but got already exists when creation attempted? Service probably not started!");
}
}
// TODO: Set up special delegate for Clearspace MUC service
// TODO: Set up additional identity/features for disco for Clearspace MUC service
if (muc != null) {
// Set up special delegate for Clearspace MUC service
muc.setMUCDelegate(new ClearspaceMUCEventDelegate());
// Set up additional features for Clearspace MUC service
muc.addExtraFeature("clearspace:service");
// Sets identity of conference service to Clearspace MUC service
muc.setDiscoIdentityType("clearspace");
}
// Starts the clearspace configuration task
startClearspaceConfig();
......
......@@ -208,6 +208,16 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
*/
protected MUCEventDelegate mucEventDelegate;
/**
* Additional features to be added to the disco response for the service.
*/
private List<String> extraDiscoFeatures = new ArrayList<String>();
/**
* Custom setting for "type" of conference service.
*/
private String discoIdentityType = "text";
/**
* Create a new group chat server.
*
......@@ -1093,7 +1103,7 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
Element identity = DocumentHelper.createElement("identity");
identity.addAttribute("category", "conference");
identity.addAttribute("name", getDescription());
identity.addAttribute("type", "text");
identity.addAttribute("type", discoIdentityType);
identities.add(identity);
......@@ -1102,7 +1112,7 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
searchId.addAttribute("category", "directory");
searchId.addAttribute("name", "Public Chatroom Search");
searchId.addAttribute("type", "chatroom");
identities.add(searchId);
identities.add(searchId);
}
else if (name != null && node == null) {
// Answer the identity of a given room
......@@ -1143,6 +1153,7 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
features.add("http://jabber.org/protocol/disco#items");
features.add("jabber:iq:search");
features.add(ResultSet.NAMESPACE_RESULT_SET_MANAGEMENT);
if (!extraDiscoFeatures.isEmpty()) features.addAll(extraDiscoFeatures);
}
else if (name != null && node == null) {
// Answer the features of a given room
......@@ -1229,6 +1240,38 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
return null;
}
/**
* Adds an extra Disco feature to the list of features returned for the conference service.
* @param feature Feature to add.
*/
public void addExtraFeature(String feature) {
extraDiscoFeatures.add(feature);
}
/**
* Removes an extra Disco feature from the list of features returned for the conference service.
* @param feature Feature to remove.
*/
public void removeExtraFeature(String feature) {
extraDiscoFeatures.remove(feature);
}
/**
* Sets the type of the conference service, typically "text".
* @param type The type of the conference service, "text" is the default.
*/
public void setDiscoIdentityType(String type) {
discoIdentityType = type;
}
/**
* Sets the MUC event delegate handler for this service.
* @param delegate Handler for MUC events.
*/
public void setMUCDelegate(MUCEventDelegate delegate) {
mucEventDelegate = delegate;
}
public boolean hasInfo(String name, String node, JID senderJID) {
// Check if the service is disabled. Info is not available when disabled.
if (!isServiceEnabled()) {
......
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