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


Java ServiceDiscoveryManager.addFeature方法代码示例

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


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

示例1: setServiceEnabled

import org.jivesoftware.smackx.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.
 */
public static void setServiceEnabled(final Connection connection,
        final boolean isEnabled) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (isEnabled) {
            if (!manager.includesFeature(namespace)) {
                manager.addFeature(namespace);
            }
        } else {
            manager.removeFeature(namespace);
        }
    }
    
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:31,代码来源:FileTransferNegotiator.java

示例2: setServiceEnabled

import org.jivesoftware.smackx.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.
 */
public static void setServiceEnabled(final Connection connection,
		final boolean isEnabled) {
	ServiceDiscoveryManager manager = ServiceDiscoveryManager
			.getInstanceFor(connection);

	List<String> namespaces = new ArrayList<String>();
	namespaces.addAll(Arrays.asList(NAMESPACE));
	namespaces.add(InBandBytestreamManager.NAMESPACE);
	if (!IBB_ONLY) {
		namespaces.add(Socks5BytestreamManager.NAMESPACE);
	}

	for (String namespace : namespaces) {
		if (isEnabled) {
			if (!manager.includesFeature(namespace)) {
				manager.addFeature(namespace);
			}
		} else {
			manager.removeFeature(namespace);
		}
	}

}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:33,代码来源:FileTransferNegotiator.java

示例3: enableService

import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
 * Adds the SOCKS5 Bytestream feature to the service discovery.
 */
private void enableService() {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager.getInstanceFor(this.connection);
    if (!manager.includesFeature(NAMESPACE)) {
        manager.addFeature(NAMESPACE);
    }
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:10,代码来源:Socks5BytestreamManager.java

示例4: DeliveryReceiptManager

import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
private DeliveryReceiptManager(Connection connection) {
    ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
    sdm.addFeature(DeliveryReceipt.NAMESPACE);
    this.connection = connection;
    instances.put(connection, this);

    // register listener for delivery receipts and requests
    connection.addPacketListener(this, new PacketExtensionFilter(DeliveryReceipt.NAMESPACE));
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:10,代码来源:DeliveryReceiptManager.java

示例5: enableService

import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
 * Adds the SOCKS5 Bytestream feature to the service discovery.
 */
private void enableService() {
	ServiceDiscoveryManager manager = ServiceDiscoveryManager
			.getInstanceFor(this.connection);
	if (!manager.includesFeature(NAMESPACE)) {
		manager.addFeature(NAMESPACE);
	}
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:11,代码来源:Socks5BytestreamManager.java

示例6: addFeature

import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:13,代码来源:SparkManager.java

示例7: CarbonManager

import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
private CarbonManager(Connection connection) {
    ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
    sdm.addFeature(Carbon.NAMESPACE);
    this.connection = connection;
    instances.put(connection, this);
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:7,代码来源:CarbonManager.java

示例8: PingManager

import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
private PingManager(final Connection connection) {
    this.connection = connection;
    instances.put(connection, this);

    ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
    sdm.addFeature(NAMESPACE);

    PacketFilter pingPacketFilter = new PacketTypeFilter(Ping.class);
    connection.addPacketListener(new PacketListener() {
        /**
         * Sends a Pong for every Ping
         */
        public void processPacket(Packet packet) {
            if (pingMinDelta > 0) {
                // Ping flood protection enabled
                long currentMillies = System.currentTimeMillis();
                long delta = currentMillies - lastPingStamp;
                lastPingStamp = currentMillies;
                if (delta < pingMinDelta) {
                    return;
                }
            }
            Pong pong = new Pong((Ping)packet);
            connection.sendPacket(pong);
        }
    }
    , pingPacketFilter);
    connection.addConnectionListener(new ConnectionListener() {

        @Override
        public void connectionClosed() {
            maybeStopPingServerTask();
        }

        @Override
        public void connectionClosedOnError(Exception arg0) {
            maybeStopPingServerTask();
        }

        @Override
        public void reconnectionSuccessful() {
            maybeSchedulePingServerTask();
        }

        @Override
        public void reconnectingIn(int seconds) {
        }

        @Override
        public void reconnectionFailed(Exception e) {
        }
    });
    maybeSchedulePingServerTask();
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:55,代码来源:PingManager.java

示例9: EntityCapsManager

import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
public EntityCapsManager(ServiceDiscoveryManager sdm) {
	// Add Entity Capabilities (XEP-0115) feature node.
	sdm.addFeature("http://jabber.org/protocol/caps");

	this.sdm = sdm;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:7,代码来源:EntityCapsManager.java

示例10: EntityCapsManager

import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
public EntityCapsManager(ServiceDiscoveryManager sdm) {
    // Add Entity Capabilities (XEP-0115) feature node.
    sdm.addFeature("http://jabber.org/protocol/caps");
    
    this.sdm = sdm;
}
 
开发者ID:jtietema,项目名称:telegraph,代码行数:7,代码来源:EntityCapsManager.java

示例11: PingManager

import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
private PingManager(Connection connection) {
    ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
    sdm.addFeature(NAMESPACE);
    this.connection = connection;
    init();
}
 
开发者ID:xtang,项目名称:asmack-mini,代码行数:7,代码来源:PingManager.java


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