Refine search
@Override public void connectionCreated(XMPPConnection connection) { ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); serviceDiscoveryManager.addFeature(ValidateElement.NAMESPACE); } });
/** * Gets the supported features of the servers pubsub implementation * as a standard {@link DiscoverInfo} instance. * * @return The supported features * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public DiscoverInfo getSupportedFeatures() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { ServiceDiscoveryManager mgr = ServiceDiscoveryManager.getInstanceFor(connection()); return mgr.discoverInfo(pubSubService); }
/** * Discover the commands of an specific JID. The <code>jid</code> is a * full JID. * * @param jid the full JID to retrieve the commands for. * @return the discovered items. * @throws XMPPException if the operation failed for some reason. * @throws SmackException if there was no response from the server. * @throws InterruptedException */ public DiscoverItems discoverCommands(Jid jid) throws XMPPException, SmackException, InterruptedException { return serviceDiscoveryManager.discoverItems(jid, NAMESPACE); }
/** * Returns true if the XHTML support is enabled for the given connection. * * @param connection the connection to look for XHTML support * @return a boolean indicating if the XHTML support is enabled for the given connection */ public static boolean isServiceEnabled(XMPPConnection connection) { return ServiceDiscoveryManager.getInstanceFor(connection).includesFeature(XHTMLExtension.NAMESPACE); }
private static boolean isFeatureSupportedByServer(XMPPConnection connection, String featureName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return ServiceDiscoveryManager.getInstanceFor(connection).serverSupportsFeature(featureName); } }
XMPPErrorException, NotConnectedException, InterruptedException { if (!connection.isConnected()) { return false; .getInstanceFor(connection); DiscoverInfo discoInfo = disco.discoverInfo(connection.getXMPPServiceDomain()); for (DiscoverInfo.Identity identity : discoInfo.getIdentities()) { if (identity.getName() != null && identity.getName().startsWith("rtpbridge")) {
/** * Private constructor. * * @param connection connection * @param deviceId deviceId */ private OmemoManager(XMPPConnection connection, Integer deviceId) { super(connection); service = OmemoService.getInstance(); this.deviceId = deviceId; if (connection.isAuthenticated()) { initBareJidAndDeviceId(this); } else { connection.addConnectionListener(new AbstractConnectionListener() { @Override public void authenticated(XMPPConnection connection, boolean resumed) { initBareJidAndDeviceId(OmemoManager.this); } }); } service.registerRatchetForManager(this); // StanzaListeners resumeStanzaAndPEPListeners(); // Announce OMEMO support ServiceDiscoveryManager.getInstanceFor(connection).addFeature(PEP_NODE_DEVICE_LIST_NOTIFY); }
/** * Returns true if the given entity understands the HTTP ove XMPP transport format and allows the exchange of such. * * @param jid jid * @param connection connection * @return true if the given entity understands the HTTP ove XMPP transport format and exchange. * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public static boolean isSupported(Jid jid, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(jid, NAMESPACE); } }
private PingManager(XMPPConnection connection) { super(connection); ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection); sdm.addFeature(Ping.NAMESPACE); connection.registerIQRequestHandler(new AbstractIqRequestHandler(Ping.ELEMENT, Ping.NAMESPACE, Type.get, Mode.async) { @Override public IQ handleIQRequest(IQ iqRequest) { Ping ping = (Ping) iqRequest; return ping.getPong(); } }); connection.addConnectionListener(new AbstractConnectionClosedListener() { @Override public void authenticated(XMPPConnection connection, boolean resumed) { maybeSchedulePingServerTask(); } @Override public void connectionTerminated() { maybeStopPingServerTask(); } }); maybeSchedulePingServerTask(); }
/** * Enables or disables the AMP support on a given connection.<p> * * Before starting to send AMP messages to a user, check that the user can handle XHTML * messages. Enable the AMP support to indicate that this client handles XHTML messages. * * @param connection the connection where the service will be enabled or disabled * @param enabled indicates if the service will be enabled or disabled */ public static synchronized void setServiceEnabled(XMPPConnection connection, boolean enabled) { if (isServiceEnabled(connection) == enabled) return; if (enabled) { ServiceDiscoveryManager.getInstanceFor(connection).addFeature(AMPExtension.NAMESPACE); } else { ServiceDiscoveryManager.getInstanceFor(connection).removeFeature(AMPExtension.NAMESPACE); } }
@Override public boolean evaluate() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { DiscoverInfo info = sdmOne.discoverInfo(conTwo.getUser()); return info.containsFeature(dummyFeature); } });
/** * Initializes the OmemoManager. This method must be called before the manager can be used. * * @throws CorruptedOmemoKeyException * @throws InterruptedException * @throws SmackException.NoResponseException * @throws SmackException.NotConnectedException * @throws XMPPException.XMPPErrorException * @throws SmackException.NotLoggedInException * @throws PubSubException.NotALeafNodeException */ public void initialize() throws SmackException.NotLoggedInException, CorruptedOmemoKeyException, InterruptedException, SmackException.NoResponseException, SmackException.NotConnectedException, XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException { synchronized (LOCK) { if (!connection().isAuthenticated()) { throw new SmackException.NotLoggedInException(); } if (getTrustCallback() == null) { throw new IllegalStateException("No TrustCallback set."); } getOmemoService().init(new LoggedInOmemoManager(this)); ServiceDiscoveryManager.getInstanceFor(connection()).addFeature(PEP_NODE_DEVICE_LIST_NOTIFY); } }
/** * Returns a List of <tt>OfflineMessageHeader</tt> that keep information about the * offline message. The OfflineMessageHeader includes a stamp that could be used to retrieve * the complete message or delete the specific message. * * @return a List of <tt>OfflineMessageHeader</tt> that keep information about the offline * message. * @throws XMPPErrorException If the user is not allowed to make this request or the server does * not support offline message retrieval. * @throws NoResponseException if there was no response from the server. * @throws NotConnectedException * @throws InterruptedException */ public List<OfflineMessageHeader> getHeaders() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { List<OfflineMessageHeader> answer = new ArrayList<>(); DiscoverItems items = ServiceDiscoveryManager.getInstanceFor(connection).discoverItems( null, namespace); for (DiscoverItems.Item item : items.getItems()) { answer.add(new OfflineMessageHeader(item)); } return answer; }
public boolean isSupported() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { XMPPConnection connection = connection(); ExtensionElement extensionElement = connection.getFeature(Registration.Feature.ELEMENT, Registration.Feature.NAMESPACE); if (extensionElement != null) { return true; } // Fallback to disco#info only if this connection is authenticated, as otherwise we won't have an full JID and // won't be able to do IQs. if (connection.isAuthenticated()) { return ServiceDiscoveryManager.getInstanceFor(connection).serverSupportsFeature(Registration.NAMESPACE); } return false; }
public boolean isSupported() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { XMPPConnection connection = connection(); ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); BareJid localBareJid = connection.getUser().asBareJid(); return serviceDiscoveryManager.supportsFeatures(localBareJid, REQUIRED_FEATURES); } }
private VersionManager(final XMPPConnection connection) { super(connection); ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection); sdm.addFeature(Version.NAMESPACE); connection.registerIQRequestHandler(new AbstractIqRequestHandler(Version.ELEMENT, Version.NAMESPACE, IQ.Type.get, Mode.async) { @Override public IQ handleIQRequest(IQ iqRequest) { if (ourVersion == null) { return IQ.createErrorResponse(iqRequest, Condition.not_acceptable); } return Version.createResultFor(iqRequest, ourVersion); } }); }
@Override public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception { String entID = sampler.getPropertyAsString(ENTITY_ID); res.setSamplerData("Entity ID: " + entID); ServiceDiscoveryManager discoMgr = ServiceDiscoveryManager.getInstanceFor(sampler.getXMPPConnection()); IQ info; if (Type.valueOf(sampler.getPropertyAsString(TYPE)) == Type.info) { info = discoMgr.discoverInfo(entID); } else { info = discoMgr.discoverItems(entID); } res.setResponseData(info.toXML().toString().getBytes()); return res; }
@SmackIntegrationTest public void testCapsChanged() { final String dummyFeature = getNewDummyFeature(); String nodeVerBefore = EntityCapsManager.getNodeVersionByJid(conTwo.getUser()); sdmTwo.addFeature(dummyFeature); String nodeVerAfter = EntityCapsManager.getNodeVersionByJid(conTwo.getUser()); assertFalse(nodeVerBefore.equals(nodeVerAfter)); }
/** * Returns true if the AMP support is enabled for the given connection. * * @param connection the connection to look for AMP support * @return a boolean indicating if the AMP support is enabled for the given connection */ public static boolean isServiceEnabled(XMPPConnection connection) { connection.getXMPPServiceDomain(); return ServiceDiscoveryManager.getInstanceFor(connection).includesFeature(AMPExtension.NAMESPACE); }
public ConferenceServices() { ServiceDiscoveryManager manager = ServiceDiscoveryManager.getInstanceFor(SparkManager.getConnection()); boolean mucSupported = manager.includesFeature("http://jabber.org/protocol/muc"); try SparkManager.getConnection().sendStanza(p);