Search in sources :

Example 1 with ConnectionCreationListener

use of org.jivesoftware.smack.ConnectionCreationListener in project Smack by igniterealtime.

the class JingleManager method setJingleServiceEnabled.

/**
     * Setup the jingle system to let the remote clients know we support Jingle.
     * (This used to be a static part of construction.  The problem is a remote client might
     * attempt a Jingle connection to us after we've created an XMPPConnection, but before we've
     * setup an instance of a JingleManager.  We will appear to not support Jingle.  With the new
     * method you just call it once and all new connections will report Jingle support.)
     */
public static void setJingleServiceEnabled() {
    ProviderManager.addIQProvider("jingle", "urn:xmpp:tmp:jingle", new JingleProvider());
    // Enable the Jingle support on every established connection
    // The ServiceDiscoveryManager class should have been already
    // initialized
    XMPPConnectionRegistry.addConnectionCreationListener(new ConnectionCreationListener() {

        @Override
        public void connectionCreated(XMPPConnection connection) {
            JingleManager.setServiceEnabled(connection, true);
        }
    });
}
Also used : ConnectionCreationListener(org.jivesoftware.smack.ConnectionCreationListener) XMPPConnection(org.jivesoftware.smack.XMPPConnection) JingleProvider(org.jivesoftware.smackx.jingleold.provider.JingleProvider)

Aggregations

ConnectionCreationListener (org.jivesoftware.smack.ConnectionCreationListener)1 XMPPConnection (org.jivesoftware.smack.XMPPConnection)1 JingleProvider (org.jivesoftware.smackx.jingleold.provider.JingleProvider)1