当前位置: 首页>>代码示例>>Java>>正文


Java ServiceDiscoveryManager.removeFeature方法代码示例

本文整理汇总了Java中org.jivesoftware.smackx.disco.ServiceDiscoveryManager.removeFeature方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceDiscoveryManager.removeFeature方法的具体用法?Java ServiceDiscoveryManager.removeFeature怎么用?Java ServiceDiscoveryManager.removeFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.smackx.disco.ServiceDiscoveryManager的用法示例。


在下文中一共展示了ServiceDiscoveryManager.removeFeature方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setServiceEnabled

import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
 * 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<String>();
    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);
        }
    }
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:28,代码来源:FileTransferNegotiator.java

示例2: disable

import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
public synchronized void disable() {
    if (!enabled)
        return;
    ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection());
    sdm.removeFeature(Time.NAMESPACE);
    enabled = false;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:8,代码来源:EntityTimeManager.java

示例3: disableService

import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
 * Disables the SOCKS5 Bytestream manager by removing the SOCKS5 Bytestream feature from the
 * service discovery, disabling the listener for SOCKS5 Bytestream initiation requests and
 * resetting its internal state, which includes removing this instance from the managers map.
 * <p>
 * To re-enable the SOCKS5 Bytestream feature invoke {@link #getBytestreamManager(XMPPConnection)}.
 * Using the file transfer API will automatically re-enable the SOCKS5 Bytestream feature.
 */
public synchronized void disableService() {
    XMPPConnection connection = connection();
    // remove initiation packet listener
    connection.unregisterIQRequestHandler(initiationListener);

    // shutdown threads
    this.initiationListener.shutdown();

    // clear listeners
    this.allRequestListeners.clear();
    this.userListeners.clear();

    // reset internal state
    this.lastWorkingProxy = null;
    this.proxyBlacklist.clear();
    this.ignoredBytestreamRequests.clear();

    // remove manager from static managers map
    managers.remove(connection);

    // shutdown local SOCKS5 proxy if there are no more managers for other connections
    if (managers.size() == 0) {
        Socks5Proxy.getSocks5Proxy().stop();
    }

    // remove feature from service discovery
    ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);

    // check if service discovery is not already disposed by connection shutdown
    if (serviceDiscoveryManager != null) {
        serviceDiscoveryManager.removeFeature(Bytestream.NAMESPACE);
    }

}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:43,代码来源:Socks5BytestreamManager.java


注:本文中的org.jivesoftware.smackx.disco.ServiceDiscoveryManager.removeFeature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。