Commit 5fd0f9ed authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Multiple subscriptions feature can now be enabled or disabled. JM-913

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6395 b35dd754-fafc-0310-a699-88a17e54d16e
parent 11f63f6b
...@@ -1068,7 +1068,7 @@ public abstract class Node { ...@@ -1068,7 +1068,7 @@ public abstract class Node {
* @return true if a user may have more than one subscription with the node. * @return true if a user may have more than one subscription with the node.
*/ */
public boolean isMultipleSubscriptionsEnabled() { public boolean isMultipleSubscriptionsEnabled() {
return true; return service.isMultipleSubscriptionsEnabled();
} }
/** /**
......
...@@ -68,6 +68,13 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di ...@@ -68,6 +68,13 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di
*/ */
private boolean nodeCreationRestricted = false; private boolean nodeCreationRestricted = false;
/**
* Flag that indicates if a user may have more than one subscription with the node. When multiple
* subscriptions is enabled each subscription request, event notification and unsubscription request
* should include a subid attribute.
*/
private boolean multipleSubscriptionsEnabled = true;
/** /**
* Bare jids of users that are allowed to create nodes. An empty list means that anyone can * Bare jids of users that are allowed to create nodes. An empty list means that anyone can
* create nodes. * create nodes.
...@@ -267,6 +274,10 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di ...@@ -267,6 +274,10 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di
return nodeCreationRestricted; return nodeCreationRestricted;
} }
public boolean isMultipleSubscriptionsEnabled() {
return multipleSubscriptionsEnabled;
}
public void setNodeCreationRestricted(boolean nodeCreationRestricted) { public void setNodeCreationRestricted(boolean nodeCreationRestricted) {
this.nodeCreationRestricted = nodeCreationRestricted; this.nodeCreationRestricted = nodeCreationRestricted;
JiveGlobals.setProperty("xmpp.pubsub.create.anyone", Boolean.toString(nodeCreationRestricted)); JiveGlobals.setProperty("xmpp.pubsub.create.anyone", Boolean.toString(nodeCreationRestricted));
...@@ -306,8 +317,7 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di ...@@ -306,8 +317,7 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di
sysadmins.add(jid.trim().toLowerCase()); sysadmins.add(jid.trim().toLowerCase());
} }
} }
nodeCreationRestricted = nodeCreationRestricted = JiveGlobals.getBooleanProperty("xmpp.pubsub.create.anyone", false);
Boolean.parseBoolean(JiveGlobals.getProperty("xmpp.pubsub.create.anyone", "false"));
// Load the list of JIDs that are allowed to create nodes // Load the list of JIDs that are allowed to create nodes
property = JiveGlobals.getProperty("xmpp.pubsub.create.jid"); property = JiveGlobals.getProperty("xmpp.pubsub.create.jid");
if (property != null) { if (property != null) {
...@@ -317,6 +327,8 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di ...@@ -317,6 +327,8 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di
} }
} }
multipleSubscriptionsEnabled = JiveGlobals.getBooleanProperty("xmpp.pubsub.multiple-subscriptions", true);
routingTable = server.getRoutingTable(); routingTable = server.getRoutingTable();
router = server.getPacketRouter(); router = server.getPacketRouter();
......
...@@ -53,6 +53,7 @@ public interface PubSubService { ...@@ -53,6 +53,7 @@ public interface PubSubService {
/** /**
* Returns true if the pubsub service allows the specified user to create nodes. * Returns true if the pubsub service allows the specified user to create nodes.
* *
* @param creator the JID of the entity trying to create a new node.
* @return true if the pubsub service allows the specified user to create nodes. * @return true if the pubsub service allows the specified user to create nodes.
*/ */
boolean canCreateNode(JID creator); boolean canCreateNode(JID creator);
...@@ -212,4 +213,13 @@ public interface PubSubService { ...@@ -212,4 +213,13 @@ public interface PubSubService {
* @param user the JID of the affiliate to unsubscribe from his presence. * @param user the JID of the affiliate to unsubscribe from his presence.
*/ */
void presenceSubscriptionNotRequired(Node node, JID user); void presenceSubscriptionNotRequired(Node node, JID user);
/**
* Returns true if a user may have more than one subscription with the node. When
* multiple subscriptions is enabled each subscription request, event notification and
* unsubscription request should include a <tt>subid</tt> attribute.
*
* @return true if a user may have more than one subscription with the node.
*/
boolean isMultipleSubscriptionsEnabled();
} }
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