本文整理汇总了Java中org.jivesoftware.smackx.disco.ServiceDiscoveryManager.addFeature方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceDiscoveryManager.addFeature方法的具体用法?Java ServiceDiscoveryManager.addFeature怎么用?Java ServiceDiscoveryManager.addFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smackx.disco.ServiceDiscoveryManager
的用法示例。
在下文中一共展示了ServiceDiscoveryManager.addFeature方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例2: VersionManager
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
private VersionManager(final XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(Version.NAMESPACE);
connection.registerIQRequestHandler(new AbstractIqRequestHandler(Version.ELEMENT, Version.NAMESPACE, IQ.Type.get,
Mode.async) {
@Override
public IQ handleIQRequest(IQ iqRequest) {
if (ourVersion == null) {
return IQ.createErrorResponse(iqRequest, new XMPPError(Condition.not_acceptable));
}
return Version.createResultFor(iqRequest, ourVersion);
}
});
}
示例3: initServiceDiscovery
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
private void initServiceDiscovery() {
debug(TAG, "init service discovery");
// register connection features
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mConnection);
if (!sdm.includesFeature(DISCO_FEATURE))
sdm.addFeature(DISCO_FEATURE);
if (!sdm.includesFeature(DeliveryReceipt.NAMESPACE))
sdm.addFeature(DeliveryReceipt.NAMESPACE);
sdm.addFeature(HttpFileUploadManager.NAMESPACE);
DeliveryReceiptManager.getInstanceFor(mConnection).dontAutoAddDeliveryReceiptRequests();
DeliveryReceiptManager.getInstanceFor(mConnection).setAutoReceiptMode(DeliveryReceiptManager.AutoReceiptMode.disabled);
}
示例4: DisplayedManager
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
private DisplayedManager(XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(Displayed.NAMESPACE);
connection.addAsyncStanzaListener(packet -> {
Displayed receipt = Displayed.from((Message) packet);
for (ReceiptReceivedListener listener : receiptReceivedListeners) {
listener.onReceiptReceived(packet.getFrom(), packet.getTo(), receipt.getId(), packet);
}
}, MESSAGES_WITH_DISPLAYED);
}
示例5: ReceivedManager
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
private ReceivedManager(XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(Received.NAMESPACE);
connection.addAsyncStanzaListener(packet -> {
Received receipt = Received.from((Message) packet);
for (ReceiptReceivedListener listener : receiptReceivedListeners) {
listener.onReceiptReceived(packet.getFrom(), packet.getTo(), receipt.getId(), packet);
}
}, MESSAGES_WITH_RECEIVED);
}
示例6: DeliveredReceiptManager
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
private DeliveredReceiptManager(XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(DeliveredReceipt.NAMESPACE);
connection.addAsyncStanzaListener(packet -> {
DeliveredReceipt receipt = DeliveredReceipt.from((Message) packet);
for (ReceiptReceivedListener listener : receiptReceivedListeners) {
listener.onReceiptReceived(packet.getFrom(), packet.getTo(), receipt.getId(), packet);
}
}, MESSAGES_WITH_DELIVERED_RECEIPT);
}
示例7: ReadReceiptManager
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
private ReadReceiptManager(XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
sdm.addFeature(ReadReceipt.NAMESPACE);
connection.addAsyncStanzaListener(packet -> {
ReadReceipt receipt = ReadReceipt.from((Message) packet);
for (ReceiptReceivedListener listener : receiptReceivedListeners) {
listener.onReceiptReceived(packet.getFrom(), packet.getTo(), receipt.getId(), packet);
}
}, MESSAGES_WITH_READ_RECEIPT);
}
示例8: enable
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
public synchronized void enable() {
if (enabled)
return;
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection());
sdm.addFeature(Time.NAMESPACE);
enabled = true;
}
示例9: enableService
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
* Adds the SOCKS5 Bytestream feature to the service discovery.
*/
private void enableService() {
ServiceDiscoveryManager manager = ServiceDiscoveryManager.getInstanceFor(connection());
manager.addFeature(Bytestream.NAMESPACE);
}
示例10: XDataManager
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
private XDataManager(XMPPConnection connection) {
super(connection);
ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);
serviceDiscoveryManager.addFeature(NAMESPACE);
}
示例11: connectionCreated
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
@Override
public void connectionCreated(XMPPConnection connection) {
ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);
serviceDiscoveryManager.addFeature(ValidateElement.NAMESPACE);
}
示例12: connectionCreated
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
@Override
public void connectionCreated(XMPPConnection connection) {
ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);
serviceDiscoveryManager.addFeature(DataLayout.NAMESPACE);
}