本文整理汇总了Java中org.jivesoftware.smackx.ServiceDiscoveryManager.includesFeature方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceDiscoveryManager.includesFeature方法的具体用法?Java ServiceDiscoveryManager.includesFeature怎么用?Java ServiceDiscoveryManager.includesFeature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smackx.ServiceDiscoveryManager
的用法示例。
在下文中一共展示了ServiceDiscoveryManager.includesFeature方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: isServiceEnabled
import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
* Checks to see if all file transfer related services are enabled on the
* connection.
*
* @param connection The connection to check
* @return True if all related services are enabled, false if they are not.
*/
public static boolean isServiceEnabled(final Connection connection) {
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 (!manager.includesFeature(namespace)) {
return false;
}
}
return true;
}
示例3: 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);
}
}
}
示例4: isServiceEnabled
import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
* Checks to see if all file transfer related services are enabled on the
* connection.
*
* @param connection
* The connection to check
* @return True if all related services are enabled, false if they are not.
*/
public static boolean isServiceEnabled(final Connection connection) {
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 (!manager.includesFeature(namespace)) {
return false;
}
}
return true;
}
示例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: 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);
}
}
示例7: ConferenceServices
import org.jivesoftware.smackx.ServiceDiscoveryManager; //导入方法依赖的package包/类
public ConferenceServices() {
ServiceDiscoveryManager manager = ServiceDiscoveryManager.getInstanceFor(SparkManager.getConnection());
boolean mucSupported = manager.includesFeature("http://jabber.org/protocol/muc");
if (mucSupported) {
// Add an invitation listener.
addInvitationListener();
addChatRoomListener();
addPopupListeners();
// Add Join Conference Button to ActionMenu
final JMenu actionsMenu = SparkManager.getMainWindow().getMenuByName(Res.getString("menuitem.actions"));
JMenuItem actionMenuItem = new JMenuItem(Res.getString("message.join.conference.room"), SparkRes.getImageIcon(SparkRes.CONFERENCE_IMAGE_16x16));
actionsMenu.add(actionMenuItem,1);
actionMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ConferenceRoomBrowser rooms = new ConferenceRoomBrowser(bookmarksUI, getDefaultServiceName());
rooms.invoke();
}
});
// Add Presence Listener to send directed presence to Group Chat Rooms.
PresenceListener presenceListener = new PresenceListener() {
public void presenceChanged(final Presence presence) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
for (ChatRoom room : SparkManager.getChatManager().getChatContainer().getChatRooms()) {
if (room instanceof GroupChatRoom) {
final Presence p = new Presence(presence.getType(), presence.getStatus(), presence.getPriority(), presence.getMode());
GroupChatRoom groupChatRoom = (GroupChatRoom)room;
String jid = groupChatRoom.getMultiUserChat().getRoom();
p.setTo(jid);
SparkManager.getConnection().sendPacket(p);
}
}
}
});
}
};
SparkManager.getSessionManager().addPresenceListener(presenceListener);
}
}