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 ) ; } } }
Enable the Jabber services related to file transfer on the particular connection .