Search in sources :

Example 1 with NodeAffiliate

use of org.jivesoftware.openfire.pubsub.NodeAffiliate in project Openfire by igniterealtime.

the class AffiliationTask method run.

@Override
public void run() {
    log.debug("[TASK] New affiliation : {}", toString());
    Node node = getNode();
    NodeAffiliate affiliate = node.getAffiliate(jid);
    if (affiliate == null) {
        affiliate = new NodeAffiliate(node, jid);
        affiliate.setAffiliation(affiliation);
        node.addAffiliate(affiliate);
    } else {
        affiliate.setAffiliation(affiliation);
    }
}
Also used : Node(org.jivesoftware.openfire.pubsub.Node) NodeAffiliate(org.jivesoftware.openfire.pubsub.NodeAffiliate)

Example 2 with NodeAffiliate

use of org.jivesoftware.openfire.pubsub.NodeAffiliate in project Openfire by igniterealtime.

the class NewSubscriptionTask method run.

@Override
public void run() {
    log.debug("[TASK] New subscription : {}", toString());
    Node node = getNode();
    // case since any changes will get loaded from the db when it is loaded.
    if (node == null)
        return;
    if (node.getAffiliate(getOwner()) == null) {
        // add the missing 'none' affiliation
        NodeAffiliate affiliate = new NodeAffiliate(node, getOwner());
        affiliate.setAffiliation(NodeAffiliate.Affiliation.none);
        node.addAffiliate(affiliate);
    }
    node.addSubscription(getSubscription());
    if (node.isPresenceBasedDelivery() && node.getSubscriptions(getSubscription().getOwner()).size() == 1) {
        if (getSubscription().getPresenceStates().isEmpty()) {
            // Subscribe to the owner's presence since the node is only
            // sending events to online subscribers and this is the first
            // subscription of the user and the subscription is not
            // filtering notifications based on presence show values.
            getService().presenceSubscriptionRequired(getNode(), getOwner());
        }
    }
}
Also used : Node(org.jivesoftware.openfire.pubsub.Node) NodeAffiliate(org.jivesoftware.openfire.pubsub.NodeAffiliate)

Aggregations

Node (org.jivesoftware.openfire.pubsub.Node)2 NodeAffiliate (org.jivesoftware.openfire.pubsub.NodeAffiliate)2