本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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));
}
示例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);
}
}
示例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);
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}
示例11: PingManager
import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
private PingManager(Connection connection) {
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(NAMESPACE);
this.connection = connection;
init();
}