diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/PushNotificationsManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/PushNotificationsManager.java
index 0a9e2303b..c3afb086e 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/PushNotificationsManager.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/PushNotificationsManager.java
@@ -87,13 +87,32 @@ public final class PushNotificationsManager extends Manager {
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
+ * @deprecated Use {@link #isSupported()} instead.
*/
+ @Deprecated
+ // TODO: Remove in Smack 4.3
public boolean isSupportedByServer()
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection())
.serverSupportsFeature(PushNotificationsElements.NAMESPACE);
}
+ /**
+ * Returns true if Push Notifications are supported by this account.
+ *
+ * @return true if Push Notifications are supported by this account.
+ * @throws NoResponseException
+ * @throws XMPPErrorException
+ * @throws NotConnectedException
+ * @throws InterruptedException
+ * @since 4.2.2
+ */
+ public boolean isSupported()
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
+ return ServiceDiscoveryManager.getInstanceFor(connection()).accountSupportsFeatures(
+ PushNotificationsElements.NAMESPACE);
+ }
+
/**
* Enable push notifications.
*
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java
index f67f16a5c..2d3b7b83e 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java
@@ -52,6 +52,7 @@ import org.jivesoftware.smackx.disco.packet.DiscoverItems;
import org.jivesoftware.smackx.xdata.packet.DataForm;
import org.jxmpp.jid.DomainBareJid;
+import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.Jid;
import org.jxmpp.util.cache.Cache;
import org.jxmpp.util.cache.ExpirationCache;
@@ -680,6 +681,41 @@ public final class ServiceDiscoveryManager extends Manager {
return supportsFeatures(connection().getXMPPServiceDomain(), features);
}
+ /**
+ * Check if the given features are supported by the connection account. This means that the discovery information
+ * lookup will be performed on the bare JID of the connection managed by this ServiceDiscoveryManager.
+ *
+ * @param features the features to check
+ * @return true
if all features are supported by the connection account, false
otherwise
+ * @throws NoResponseException
+ * @throws XMPPErrorException
+ * @throws NotConnectedException
+ * @throws InterruptedException
+ * @since 4.2.2
+ */
+ public boolean accountSupportsFeatures(CharSequence... features)
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
+ return accountSupportsFeatures(Arrays.asList(features));
+ }
+
+ /**
+ * Check if the given collection of features are supported by the connection account. This means that the discovery
+ * information lookup will be performed on the bare JID of the connection managed by this ServiceDiscoveryManager.
+ *
+ * @param features a collection of features
+ * @return true
if all features are supported by the connection account, false
otherwise
+ * @throws NoResponseException
+ * @throws XMPPErrorException
+ * @throws NotConnectedException
+ * @throws InterruptedException
+ * @since 4.2.2
+ */
+ public boolean accountSupportsFeatures(Collection extends CharSequence> features)
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
+ EntityBareJid accountJid = connection().getUser().asEntityBareJid();
+ return supportsFeatures(accountJid, features);
+ }
+
/**
* Queries the remote entity for it's features and returns true if the given feature is found.
*