• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Item类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jivesoftware.smackx.packet.DiscoverItems.Item的典型用法代码示例。如果您正苦于以下问题:Java Item类的具体用法?Java Item怎么用?Java Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Item类属于org.jivesoftware.smackx.packet.DiscoverItems包,在下文中一共展示了Item类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getConferenceServices

import org.jivesoftware.smackx.packet.DiscoverItems.Item; //导入依赖的package包/类
public Collection<String> getConferenceServices(String server) throws Exception {
    List<String> answer = new ArrayList<String>();
    ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(SparkManager.getConnection());
    DiscoverItems items = discoManager.discoverItems(server);
    for (Iterator<Item> it = items.getItems(); it.hasNext();) {
        Item item = it.next();
        if (item.getEntityID().startsWith("conference") || item.getEntityID().startsWith("private")) {
            answer.add(item.getEntityID());
        }
        else {
            try {
                DiscoverInfo info = discoManager.discoverInfo(item.getEntityID());
                if (info.containsFeature("http://jabber.org/protocol/muc")) {
                    answer.add(item.getEntityID());
                }
            }
            catch (XMPPException e) {
                // Nothing to do
            }
        }
    }
    return answer;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:24,代码来源:ConferenceServiceBrowser.java


示例2: loadLocalGateways

import org.jivesoftware.smackx.packet.DiscoverItems.Item; //导入依赖的package包/类
/**
 * Loads all gateways the users server offers
 * @throws XMPPException
 */
private void loadLocalGateways() throws XMPPException{
	DiscoverItems items = sdManager.discoverItems(connection.getHost());
	Iterator<Item> iter = items.getItems();
	while(iter.hasNext()){
		String itemJID = iter.next().getEntityID();
		discoverGateway(itemJID);
	}
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:13,代码来源:GatewayManager.java


示例3: loadLocalGateways

import org.jivesoftware.smackx.packet.DiscoverItems.Item; //导入依赖的package包/类
/**
 * Loads all gateways the users server offers
 * 
 * @throws XMPPException
 */
private void loadLocalGateways() throws XMPPException {
	DiscoverItems items = sdManager.discoverItems(connection.getHost());
	Iterator<Item> iter = items.getItems();
	while (iter.hasNext()) {
		String itemJID = iter.next().getEntityID();
		discoverGateway(itemJID);
	}
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:14,代码来源:GatewayManager.java


示例4: serviceDiscoveryRequest

import org.jivesoftware.smackx.packet.DiscoverItems.Item; //导入依赖的package包/类
public void serviceDiscoveryRequest() throws XMPPException {
	DiscoverItems discoItems = mServiceDiscoveryManager.discoverItems(connection.getServiceName());
	Iterator<Item> it = discoItems.getItems();
	while (it.hasNext()) {
		DiscoverItems.Item item = (DiscoverItems.Item) it.next();
		Logger.log("Service available:" + item.getEntityID() + " " + item.getName());
	}
}
 
开发者ID:snuk182,项目名称:aceim,代码行数:9,代码来源:XMPPServiceInternal.java


示例5: determineProxies

import org.jivesoftware.smackx.packet.DiscoverItems.Item; //导入依赖的package包/类
/**
 * Returns a list of JIDs of SOCKS5 proxies by querying the XMPP server. The SOCKS5 proxies are
 * in the same order as returned by the XMPP server.
 * 
 * @return list of JIDs of SOCKS5 proxies
 * @throws XMPPException if there was an error querying the XMPP server for SOCKS5 proxies
 */
private List<String> determineProxies() throws XMPPException {
    ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(this.connection);

    List<String> proxies = new ArrayList<String>();

    // get all items form XMPP server
    DiscoverItems discoverItems = serviceDiscoveryManager.discoverItems(this.connection.getServiceName());
    Iterator<Item> itemIterator = discoverItems.getItems();

    // query all items if they are SOCKS5 proxies
    while (itemIterator.hasNext()) {
        Item item = itemIterator.next();

        // skip blacklisted servers
        if (this.proxyBlacklist.contains(item.getEntityID())) {
            continue;
        }

        try {
            DiscoverInfo proxyInfo;
            proxyInfo = serviceDiscoveryManager.discoverInfo(item.getEntityID());
            Iterator<Identity> identities = proxyInfo.getIdentities();

            // item must have category "proxy" and type "bytestream"
            while (identities.hasNext()) {
                Identity identity = identities.next();

                if ("proxy".equalsIgnoreCase(identity.getCategory())
                                && "bytestreams".equalsIgnoreCase(identity.getType())) {
                    proxies.add(item.getEntityID());
                    break;
                }

                /*
                 * server is not a SOCKS5 proxy, blacklist server to skip next time a Socks5
                 * bytestream should be established
                 */
                this.proxyBlacklist.add(item.getEntityID());

            }
        }
        catch (XMPPException e) {
            // blacklist errornous server
            this.proxyBlacklist.add(item.getEntityID());
        }
    }

    return proxies;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:57,代码来源:Socks5BytestreamManager.java


示例6: updateLocalEntityCaps

import org.jivesoftware.smackx.packet.DiscoverItems.Item; //导入依赖的package包/类
/**
 * Updates the local user Entity Caps information with the data provided
 * 
 * If we are connected and there was already a presence send, another
 * presence is send to inform others about your new Entity Caps node string.
 * 
 * @param discoverInfo
 *            the local users discover info (mostly the service discovery
 *            features)
 * @param identityType
 *            the local users identity type
 * @param identityName
 *            the local users identity name
 * @param extendedInfo
 *            the local users extended info
 */
public void updateLocalEntityCaps() {
    Connection connection = weakRefConnection.get();

    DiscoverInfo discoverInfo = new DiscoverInfo();
    discoverInfo.setType(IQ.Type.RESULT);
    discoverInfo.setNode(getLocalNodeVer());
    if (connection != null)
        discoverInfo.setFrom(connection.getUser());
    sdm.addDiscoverInfoTo(discoverInfo);

    currentCapsVersion = generateVerificationString(discoverInfo, "sha-1");
    addDiscoverInfoByNode(ENTITY_NODE + '#' + currentCapsVersion, discoverInfo);
    if (lastLocalCapsVersions.size() > 10) {
        String oldCapsVersion = lastLocalCapsVersions.poll();
        sdm.removeNodeInformationProvider(ENTITY_NODE + '#' + oldCapsVersion);
    }
    lastLocalCapsVersions.add(currentCapsVersion);

    caps.put(currentCapsVersion, discoverInfo);
    if (connection != null)
        jidCaps.put(connection.getUser(), new NodeVerHash(ENTITY_NODE, currentCapsVersion, "sha-1"));

    final List<Identity> identities = new LinkedList<Identity>(ServiceDiscoveryManager.getInstanceFor(connection).getIdentities());
    sdm.setNodeInformationProvider(ENTITY_NODE + '#' + currentCapsVersion, new NodeInformationProvider() {
        List<String> features = sdm.getFeaturesList();
        List<PacketExtension> packetExtensions = sdm.getExtendedInfoAsList();

        @Override
        public List<Item> getNodeItems() {
            return null;
        }

        @Override
        public List<String> getNodeFeatures() {
            return features;
        }

        @Override
        public List<Identity> getNodeIdentities() {
            return identities;
        }

        @Override
        public List<PacketExtension> getNodePacketExtensions() {
            return packetExtensions;
        }
    });

    // Send an empty presence, and let the packet intercepter
    // add a <c/> node to it.
    // See http://xmpp.org/extensions/xep-0115.html#advertise
    // We only send a presence packet if there was already one send
    // to respect ConnectionConfiguration.isSendPresence()
    if (connection != null && connection.isAuthenticated() && presenceSend) {
        Presence presence = new Presence(Presence.Type.available);
        connection.sendPacket(presence);
    }
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:75,代码来源:EntityCapsManager.java


示例7: determineProxies

import org.jivesoftware.smackx.packet.DiscoverItems.Item; //导入依赖的package包/类
/**
 * Returns a list of JIDs of SOCKS5 proxies by querying the XMPP server. The
 * SOCKS5 proxies are in the same order as returned by the XMPP server.
 * 
 * @return list of JIDs of SOCKS5 proxies
 * @throws XMPPException
 *             if there was an error querying the XMPP server for SOCKS5
 *             proxies
 */
private List<String> determineProxies() throws XMPPException {
	ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager
			.getInstanceFor(this.connection);

	List<String> proxies = new ArrayList<String>();

	// get all items form XMPP server
	DiscoverItems discoverItems = serviceDiscoveryManager
			.discoverItems(this.connection.getServiceName());
	Iterator<Item> itemIterator = discoverItems.getItems();

	// query all items if they are SOCKS5 proxies
	while (itemIterator.hasNext()) {
		Item item = itemIterator.next();

		// skip blacklisted servers
		if (this.proxyBlacklist.contains(item.getEntityID())) {
			continue;
		}

		try {
			DiscoverInfo proxyInfo;
			proxyInfo = serviceDiscoveryManager.discoverInfo(item
					.getEntityID());
			Iterator<Identity> identities = proxyInfo.getIdentities();

			// item must have category "proxy" and type "bytestream"
			while (identities.hasNext()) {
				Identity identity = identities.next();

				if ("proxy".equalsIgnoreCase(identity.getCategory())
						&& "bytestreams".equalsIgnoreCase(identity
								.getType())) {
					proxies.add(item.getEntityID());
					break;
				}

				/*
				 * server is not a SOCKS5 proxy, blacklist server to skip
				 * next time a Socks5 bytestream should be established
				 */
				this.proxyBlacklist.add(item.getEntityID());

			}
		} catch (XMPPException e) {
			// blacklist errornous server
			this.proxyBlacklist.add(item.getEntityID());
		}
	}

	return proxies;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:62,代码来源:Socks5BytestreamManager.java


示例8: updateLocalEntityCaps

import org.jivesoftware.smackx.packet.DiscoverItems.Item; //导入依赖的package包/类
/**
 * Updates the local user Entity Caps information with the data provided
 * 
 * If we are connected and there was already a presence send, another
 * presence is send to inform others about your new Entity Caps node string.
 * 
 * @param discoverInfo
 *            the local users discover info (mostly the service discovery
 *            features)
 * @param identityType
 *            the local users identity type
 * @param identityName
 *            the local users identity name
 * @param extendedInfo
 *            the local users extended info
 */
public void updateLocalEntityCaps() {
    Connection connection = weakRefConnection.get();

    DiscoverInfo discoverInfo = new DiscoverInfo();
    discoverInfo.setType(IQ.Type.RESULT);
    discoverInfo.setNode(getLocalNodeVer());
    if (connection != null)
        discoverInfo.setFrom(connection.getUser());
    sdm.addDiscoverInfoTo(discoverInfo);

    currentCapsVersion = generateVerificationString(discoverInfo, "sha-1");
    addDiscoverInfoByNode(ENTITY_NODE + '#' + currentCapsVersion, discoverInfo);
    if (lastLocalCapsVersions.size() > 10) {
        String oldCapsVersion = lastLocalCapsVersions.poll();
        sdm.removeNodeInformationProvider(ENTITY_NODE + '#' + oldCapsVersion);
    }
    lastLocalCapsVersions.add(currentCapsVersion);

    caps.put(currentCapsVersion, discoverInfo);
    if (connection != null)
        jidCaps.put(connection.getUser(), new NodeVerHash(ENTITY_NODE, currentCapsVersion, "sha-1"));

    sdm.setNodeInformationProvider(ENTITY_NODE + '#' + currentCapsVersion, new NodeInformationProvider() {
        List<String> features = sdm.getFeaturesList();
        List<Identity> identities = new LinkedList<Identity>(ServiceDiscoveryManager.getIdentities());
        List<PacketExtension> packetExtensions = sdm.getExtendedInfoAsList();

        @Override
        public List<Item> getNodeItems() {
            return null;
        }

        @Override
        public List<String> getNodeFeatures() {
            return features;
        }

        @Override
        public List<Identity> getNodeIdentities() {
            return identities;
        }

        @Override
        public List<PacketExtension> getNodePacketExtensions() {
            return packetExtensions;
        }
    });

    // Send an empty presence, and let the packet intercepter
    // add a <c/> node to it.
    // See http://xmpp.org/extensions/xep-0115.html#advertise
    // We only send a presence packet if there was already one send
    // to respect ConnectionConfiguration.isSendPresence()
    if (connection != null && connection.isAuthenticated() && presenceSend) {
        Presence presence = new Presence(Presence.Type.available);
        connection.sendPacket(presence);
    }
}
 
开发者ID:bejayoharen,项目名称:java-bells,代码行数:75,代码来源:EntityCapsManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DeleteByExampleElementGenerator类代码示例发布时间:2022-05-22
下一篇:
Java RepositoryEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap