1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-08 06:01:07 +01:00

Added pubsub Node.modifySubscriptionsAsOwner with test

This commit is contained in:
Timothy Pitt 2018-03-20 11:49:32 +01:00
parent 476fdf99a1
commit 832c0a92aa
3 changed files with 105 additions and 0 deletions

View file

@ -217,6 +217,31 @@ public abstract class Node {
return subElem.getSubscriptions();
}
/**
* Modify the subscriptions for this PubSub node as owner.
* <p>
* Note that the subscriptions are _not_ checked against the existing subscriptions
* since these are not cached (and indeed could change asynchronously)
* </p>
*
* @param changedSubs subscriptions that have changed
* @return <code>null</code> or a PubSub stanza with additional information on success.
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
* @see <a href="https://xmpp.org/extensions/xep-0060.html#owner-subscriptions-modify">XEP-60 § 8.8.2 Modify Subscriptions</a>
* @since 4.3
*/
public PubSub modifySubscriptionsAsOwner(List<Subscription> changedSubs)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub pubSub = createPubsubPacket(Type.set,
new SubscriptionsExtension(getId(), changedSubs),
PubSubNamespace.OWNER);
return sendPubsubPacket(pubSub);
}
/**
* Get the affiliations of this node.
*

View file

@ -56,6 +56,16 @@ public class Subscription extends NodeExtension {
this(subscriptionJid, nodeId, null, null);
}
/**
* Construct a subscription change request to the specified state.
*
* @param subscriptionJid The subscriber JID
* @param state The requested new state
*/
public Subscription(Jid subscriptionJid, State state) {
this(subscriptionJid, null, null, state);
}
/**
* Constructs a representation of a subscription reply to the specified node
* and JID. The server will have supplied the subscription id and current state.