Java Code Examples for org.jivesoftware.smackx.disco.ServiceDiscoveryManager#addFeature()
The following examples show how to use
org.jivesoftware.smackx.disco.ServiceDiscoveryManager#addFeature() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileTransferNegotiator.java From Smack with Apache License 2.0 | 6 votes |
/** * Enable the Jabber services related to file transfer on the particular * connection. * * @param connection The connection on which to enable or disable the services. * @param isEnabled True to enable, false to disable. */ private static void setServiceEnabled(final XMPPConnection connection, final boolean isEnabled) { ServiceDiscoveryManager manager = ServiceDiscoveryManager .getInstanceFor(connection); List<String> namespaces = new ArrayList<>(); namespaces.addAll(Arrays.asList(NAMESPACE)); namespaces.add(DataPacketExtension.NAMESPACE); if (!IBB_ONLY) { namespaces.add(Bytestream.NAMESPACE); } for (String namespace : namespaces) { if (isEnabled) { manager.addFeature(namespace); } else { manager.removeFeature(namespace); } } }
Example 2
Source File: VersionManager.java From Smack with Apache License 2.0 | 6 votes |
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); } }); }
Example 3
Source File: BoBManager.java From Smack with Apache License 2.0 | 6 votes |
private BoBManager(XMPPConnection connection) { super(connection); ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); serviceDiscoveryManager.addFeature(NAMESPACE); connection.registerIQRequestHandler( new AbstractIqRequestHandler(BoBIQ.ELEMENT, BoBIQ.NAMESPACE, Type.get, Mode.async) { @Override public IQ handleIQRequest(IQ iqRequest) { BoBIQ bobIQRequest = (BoBIQ) iqRequest; BoBInfo bobInfo = bobs.get(bobIQRequest.getBoBHash()); if (bobInfo == null) { // TODO return item-not-found return null; } BoBData bobData = bobInfo.getData(); BoBIQ responseBoBIQ = new BoBIQ(bobIQRequest.getBoBHash(), bobData); responseBoBIQ.setType(Type.result); responseBoBIQ.setTo(bobIQRequest.getFrom()); return responseBoBIQ; } }); }
Example 4
Source File: HashManager.java From Smack with Apache License 2.0 | 5 votes |
/** * Constructor of the HashManager. * * @param connection connection */ private HashManager(XMPPConnection connection) { super(connection); ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection); sdm.addFeature(NAMESPACE.V2.toString()); addAlgorithmsToFeatures(RECOMMENDED); }
Example 5
Source File: HashManager.java From Smack with Apache License 2.0 | 5 votes |
/** * Announce support for the given list of algorithms. * @param algorithms TODO javadoc me please */ public void addAlgorithmsToFeatures(List<ALGORITHM> algorithms) { ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection()); for (ALGORITHM algo : algorithms) { sdm.addFeature(asFeature(algo)); } }
Example 6
Source File: EntityTimeManager.java From Smack with Apache License 2.0 | 5 votes |
public synchronized void enable() { if (enabled) return; ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection()); sdm.addFeature(Time.NAMESPACE); enabled = true; }
Example 7
Source File: EntityCapsTest.java From Smack with Apache License 2.0 | 5 votes |
/** * Adds 'feature' to conB and waits until conA observes a presence form conB. * * @param conA the connection to observe the presence on. * @param conB the connection to add the feature to. * @param feature the feature to add. * @throws Exception in case of an exception. */ private void addFeatureAndWaitForPresence(XMPPConnection conA, XMPPConnection conB, String feature) throws Exception { final ServiceDiscoveryManager sdmB = ServiceDiscoveryManager.getInstanceFor(conB); ThrowingRunnable action = new ThrowingRunnable() { @Override public void runOrThrow() throws Exception { sdmB.addFeature(feature); } }; performActionAndWaitForPresence(conA, conB, action); }
Example 8
Source File: SparkManager.java From Spark with Apache License 2.0 | 5 votes |
/** * Adds a feature that can be discovered through Disco. * * @param namespace the namespace of the feature. */ public static void addFeature(String namespace) { // Obtain the ServiceDiscoveryManager associated with my XMPPConnection ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(getConnection()); // Register that a new feature is supported by this XMPP entity discoManager.addFeature(namespace); }
Example 9
Source File: ExplicitMessageEncryptionManager.java From Smack with Apache License 2.0 | 4 votes |
private ExplicitMessageEncryptionManager(XMPPConnection connection) { ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection); sdm.addFeature(NAMESPACE_V0); }
Example 10
Source File: MessageFasteningManager.java From Smack with Apache License 2.0 | 4 votes |
/** * Announce support for Message Fastening via Service Discovery. */ public void announceSupport() { ServiceDiscoveryManager discoveryManager = ServiceDiscoveryManager.getInstanceFor(connection()); discoveryManager.addFeature(NAMESPACE); }
Example 11
Source File: Socks5BytestreamManager.java From Smack with Apache License 2.0 | 4 votes |
/** * Adds the SOCKS5 Bytestream feature to the service discovery. */ private void enableService() { ServiceDiscoveryManager manager = ServiceDiscoveryManager.getInstanceFor(connection()); manager.addFeature(Bytestream.NAMESPACE); }
Example 12
Source File: XDataManager.java From Smack with Apache License 2.0 | 4 votes |
private XDataManager(XMPPConnection connection) { super(connection); ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); serviceDiscoveryManager.addFeature(NAMESPACE); }
Example 13
Source File: XDataValidationManager.java From Smack with Apache License 2.0 | 4 votes |
@Override public void connectionCreated(XMPPConnection connection) { ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); serviceDiscoveryManager.addFeature(ValidateElement.NAMESPACE); }
Example 14
Source File: XDataLayoutManager.java From Smack with Apache License 2.0 | 4 votes |
@Override public void connectionCreated(XMPPConnection connection) { ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); serviceDiscoveryManager.addFeature(DataLayout.NAMESPACE); }