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


Java ServiceDiscoveryManager.includesFeature方法代码示例

本文整理汇总了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);
        }
    }
    
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:31,代码来源:FileTransferNegotiator.java

示例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;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:26,代码来源:FileTransferNegotiator.java

示例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);
		}
	}

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

示例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;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:27,代码来源:FileTransferNegotiator.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:ice-coffee,项目名称:EIM,代码行数:10,代码来源:Socks5BytestreamManager.java

示例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);
	}
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:11,代码来源:Socks5BytestreamManager.java

示例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);
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:49,代码来源:ConferenceServices.java


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