/** * Get the subscriptions currently associated with this node. * * @return List of {@link Subscription} * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException * */ public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getSubscriptions(null, null); }
/** * Get the subscriptions currently associated with this node. * <p> * {@code additionalExtensions} can be used e.g. to add a "Result Set Management" extension. * {@code returnedExtensions} will be filled with the stanza extensions found in the answer. * </p> * * @param additionalExtensions * @param returnedExtensions a collection that will be filled with the returned packet * extensions * @return List of {@link Subscription} * @throws NoResponseException * @throws XMPPErrorException * @throws NotConnectedException * @throws InterruptedException */ public List<Subscription> getSubscriptions(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getSubscriptions(SubscriptionsNamespace.basic, additionalExtensions, returnedExtensions); }
/** * Get the subscriptions currently associated with this node as owner. * <p> * Unlike {@link #getSubscriptions(List, Collection)}, which only retrieves the subscriptions of the current entity * ("user"), this method returns a list of <b>all</b> subscriptions. This requires the entity to have the sufficient * privileges to manage subscriptions. * </p> * <p> * {@code additionalExtensions} can be used e.g. to add a "Result Set Management" extension. * {@code returnedExtensions} will be filled with the stanza extensions found in the answer. * </p> * * @param additionalExtensions * @param returnedExtensions a collection that will be filled with the returned stanza extensions * @return List of {@link Subscription} * @throws NoResponseException * @throws XMPPErrorException * @throws NotConnectedException * @throws InterruptedException * @see <a href="http://www.xmpp.org/extensions/xep-0060.html#owner-subscriptions-retrieve">XEP-60 § 8.8.1 - * Retrieve Subscriptions List</a> * @since 4.1 */ public List<Subscription> getSubscriptionsAsOwner(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getSubscriptions(SubscriptionsNamespace.owner, additionalExtensions, returnedExtensions); }
/** * Checks if given <tt>jid</tt> is registered for PubSub updates on given * <tt>node</tt>. */ private boolean isSubscribed(EntityFullJid jid, Node node) throws XMPPException.XMPPErrorException, NotConnectedException, InterruptedException, NoResponseException { // FIXME: consider using local flag rather than getting the list // of subscriptions for (org.jivesoftware.smackx.pubsub.Subscription subscription : node.getSubscriptions()) { if (subscription.getJid().equals(jid.toString())) { return true; } } return false; }