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

Java EntityCapsManager类代码示例

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

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



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

示例1: ServiceDiscoveryManager

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
/**
 * Creates a new ServiceDiscoveryManager for a given connection. This means
 * that the service manager will respond to any service discovery request
 * that the connection may receive.
 * 
 * @param connection
 *            the connection to which a ServiceDiscoveryManager is going to
 *            be created.
 */
public ServiceDiscoveryManager(Connection connection) {
	this.connection = connection;

	// For every XMPPConnection, add one EntityCapsManager.
	if (connection instanceof XMPPConnection
			&& ((XMPPConnection) connection).isEntityCapsEnabled()) {
		EntityCapsManager capsManager = new EntityCapsManager(this);
		setEntityCapsManager(capsManager);
		capsManager.addCapsVerListener(new CapsPresenceRenewer(
				(XMPPConnection) connection, capsManager));
	}

	renewEntityCapsVersion();

	init();
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:26,代码来源:ServiceDiscoveryManager.java


示例2: ServiceDiscoveryManager

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
/**
 * Creates a new ServiceDiscoveryManager for a given connection. This means that the 
 * service manager will respond to any service discovery request that the connection may
 * receive. 
 * 
 * @param connection the connection to which a ServiceDiscoveryManager is going to be created.
 */
public ServiceDiscoveryManager(Connection connection) {
    this.connection = connection;

    // For every XMPPConnection, add one EntityCapsManager.
    if (connection instanceof XMPPConnection
            && ((XMPPConnection) connection).isEntityCapsEnabled()) {
        EntityCapsManager capsManager = new EntityCapsManager(this);
        setEntityCapsManager(capsManager);
        capsManager.addCapsVerListener(new CapsPresenceRenewer((XMPPConnection) connection, capsManager));
    }

    renewEntityCapsVersion();

    init();
}
 
开发者ID:jtietema,项目名称:telegraph,代码行数:23,代码来源:ServiceDiscoveryManager.java


示例3: replay

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
@Override
public void replay() throws IOException {
    File[] files = cacheDir.listFiles();
    for (File f : files) {
        String node = filenameEncoder.decode(f.getName());
        DiscoverInfo info = restoreInfoFromFile(f);
        if (info == null)
            continue;

        EntityCapsManager.addDiscoverInfoByNode(node, info);
    }
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:13,代码来源:SimpleDirectoryPersistentCache.java


示例4: parseExtension

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
public PacketExtension parseExtension(XmlPullParser parser) throws XmlPullParserException, IOException,
        XMPPException {
    String hash = null;
    String version = null;
    String node = null;
    if (parser.getEventType() == XmlPullParser.START_TAG
            && parser.getName().equalsIgnoreCase(EntityCapsManager.ELEMENT)) {
        hash = parser.getAttributeValue(null, "hash");
        version = parser.getAttributeValue(null, "ver");
        node = parser.getAttributeValue(null, "node");
    } else {
        throw new XMPPException("Malformed Caps element");
    }

    parser.next();

    if (!(parser.getEventType() == XmlPullParser.END_TAG
            && parser.getName().equalsIgnoreCase(EntityCapsManager.ELEMENT))) {
        throw new XMPPException("Malformed nested Caps element");
    }

    if (hash != null && version != null && node != null) {
        return new CapsExtension(node, version, hash);
    } else {
        throw new XMPPException("Caps elment with missing attributes");
    }
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:28,代码来源:CapsExtensionProvider.java


示例5: toXML

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
public String toXML() {
    String xml = "<" + EntityCapsManager.ELEMENT + " xmlns=\"" + EntityCapsManager.NAMESPACE + "\" " +
        "hash=\"" + hash + "\" " +
        "node=\"" + node + "\" " +
        "ver=\"" + ver + "\"/>";

    return xml;
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:9,代码来源:CapsExtension.java


示例6: discoverInfo

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
/**
 * Returns the discovered information of a given XMPP entity addressed by its JID.
 * Use null as entityID to query the server
 * 
 * @param entityID the address of the XMPP entity or null.
 * @return the discovered information.
 * @throws XMPPException if the operation failed for some reason.
 */
public DiscoverInfo discoverInfo(String entityID) throws XMPPException {
    if (entityID == null)
        return discoverInfo(null, null);

    // Check if the have it cached in the Entity Capabilities Manager
    DiscoverInfo info = EntityCapsManager.getDiscoverInfoByUser(entityID);

    if (info != null) {
        // We were able to retrieve the information from Entity Caps and
        // avoided a disco request, hurray!
        return info;
    }

    // Try to get the newest node#version if it's known, otherwise null is
    // returned
    EntityCapsManager.NodeVerHash nvh = EntityCapsManager.getNodeVerHashByJid(entityID);

    // Discover by requesting the information from the remote entity
    // Note that wee need to use NodeVer as argument for Node if it exists
    info = discoverInfo(entityID, nvh != null ? nvh.getNodeVer() : null);

    // If the node version is known, store the new entry.
    if (nvh != null) {
        if (EntityCapsManager.verifyDiscoverInfoVersion(nvh.getVer(), nvh.getHash(), info))
            EntityCapsManager.addDiscoverInfoByNode(nvh.getNodeVer(), info);
    }

    return info;
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:38,代码来源:ServiceDiscoveryManager.java


示例7: discoverInfo

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
/**
 * Returns the discovered information of a given XMPP entity addressed by
 * its JID.
 * 
 * @param entityID
 *            the address of the XMPP entity.
 * @return the discovered information.
 * @throws XMPPException
 *             if the operation failed for some reason.
 */
public DiscoverInfo discoverInfo(String entityID) throws XMPPException {
	// Check if the have it cached in the Entity Capabilities Manager
	DiscoverInfo info = discoverInfoByCaps(entityID);

	if (info != null) {
		return info;
	} else {
		// If the caps node is known, use it in the request.
		String node = null;

		if (capsManager != null) {
			// Get the newest node#version
			node = capsManager.getNodeVersionByUser(entityID);
		}

		// Check if we cached DiscoverInfo for nonCaps entity
		if (cacheNonCaps && node == null
				&& nonCapsCache.containsKey(entityID)) {
			return nonCapsCache.get(entityID);
		}
		// Discover by requesting from the remote client
		info = discoverInfo(entityID, node);

		// If the node version is known, store the new entry.
		if (node != null && capsManager != null) {
			EntityCapsManager.addDiscoverInfoByNode(node, info);
		}
		// If this is a non caps entity store the discover in nonCapsCache
		// map
		else if (cacheNonCaps && node == null) {
			nonCapsCache.put(entityID, info);
		}
		return info;
	}
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:46,代码来源:ServiceDiscoveryManager.java


示例8: setEntityCapsManager

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
/**
 * Entity Capabilities
 */

public void setEntityCapsManager(EntityCapsManager manager) {
	capsManager = manager;
	if (connection.getCapsNode() != null && connection.getHost() != null) {
		capsManager.addUserCapsNode(connection.getHost(),
				connection.getCapsNode());
	}
	capsManager.addPacketListener(connection);
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:13,代码来源:ServiceDiscoveryManager.java


示例9: initServiceDiscovery

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
private void initServiceDiscovery() {
	// register connection features
	ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mXMPPConnection);

	// init Entity Caps manager with storage in app's cache dir
	try {
		if (capsCacheDir == null) {
			capsCacheDir = new File(mService.getCacheDir(), "entity-caps-cache");
			capsCacheDir.mkdirs();
			EntityCapsManager.setPersistentCache(new SimpleDirectoryPersistentCache(capsCacheDir));
		}
	} catch (java.io.IOException e) {
		Log.e(TAG, "Could not init Entity Caps cache: " + e.getLocalizedMessage());
	}

	// reference PingManager, set ping flood protection to 10s
	PingManager.getInstanceFor(mXMPPConnection).setPingMinimumInterval(10*1000);

	// set Version for replies
	String app_name = mService.getString(org.yaxim.androidclient.R.string.app_name);
	String build_version[] = mService.getString(org.yaxim.androidclient.R.string.build_version).split(" ");
	Version.Manager.getInstanceFor(mXMPPConnection).setVersion(
			new Version(app_name, build_version[1], "Android"));

	// reference DeliveryReceiptManager, add listener
	DeliveryReceiptManager dm = DeliveryReceiptManager.getInstanceFor(mXMPPConnection);
	dm.enableAutoReceipts();
	dm.addReceiptReceivedListener(new ReceiptReceivedListener() { // DOES NOT WORK IN CARBONS
		public void onReceiptReceived(String fromJid, String toJid, String receiptId) {
			Log.d(TAG, "got delivery receipt for " + receiptId);
			changeMessageDeliveryStatus(receiptId, ChatConstants.DS_ACKED);
		}});
}
 
开发者ID:ufo22940268,项目名称:maven-yaxim,代码行数:34,代码来源:SmackableImp.java


示例10: discoverInfo

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
/**
  * Returns the discovered information of a given XMPP entity addressed by its JID.
  * 
  * @param entityID the address of the XMPP entity.
  * @return the discovered information.
  * @throws XMPPException if the operation failed for some reason.
  */
 public DiscoverInfo discoverInfo(String entityID) throws XMPPException {
     // Check if the have it cached in the Entity Capabilities Manager
     DiscoverInfo info = discoverInfoByCaps(entityID);

     if (info != null) {
         return info;
     } else {
         // If the caps node is known, use it in the request.
         String node = null;

         if (capsManager != null) {
             // Get the newest node#version
             node = capsManager.getNodeVersionByUser(entityID);
         }

// Check if we cached DiscoverInfo for nonCaps entity
if (cacheNonCaps 
		&& node == null
		&& nonCapsCache.containsKey(entityID)) {
	return nonCapsCache.get(entityID);
}
         // Discover by requesting from the remote client
         info = discoverInfo(entityID, node);

         // If the node version is known, store the new entry.
         if (node != null && capsManager != null) {
             EntityCapsManager.addDiscoverInfoByNode(node, info);
         }
         // If this is a non caps entity store the discover in nonCapsCache map
         else if (cacheNonCaps && node == null) {
         	nonCapsCache.put(entityID, info);
         }
         return info;
     }
 }
 
开发者ID:jtietema,项目名称:telegraph,代码行数:43,代码来源:ServiceDiscoveryManager.java


示例11: setEntityCapsManager

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
/**
 * Entity Capabilities
 */

public void setEntityCapsManager(EntityCapsManager manager) {
    capsManager = manager;
    if (connection.getCapsNode() != null 
    		&& connection.getHost() != null) {
    	capsManager.addUserCapsNode(connection.getHost(), connection.getCapsNode());
    }
    capsManager.addPacketListener(connection);
}
 
开发者ID:jtietema,项目名称:telegraph,代码行数:13,代码来源:ServiceDiscoveryManager.java


示例12: getElementName

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
public String getElementName() {
    return EntityCapsManager.ELEMENT;
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:4,代码来源:CapsExtension.java


示例13: getNamespace

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
public String getNamespace() {
    return EntityCapsManager.NAMESPACE;
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:4,代码来源:CapsExtension.java


示例14: getEntityCapsManager

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
public EntityCapsManager getEntityCapsManager() {
	return capsManager;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:4,代码来源:ServiceDiscoveryManager.java


示例15: getEntityCapsManager

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
public EntityCapsManager getEntityCapsManager(){
	return capsManager;
}
 
开发者ID:jtietema,项目名称:telegraph,代码行数:4,代码来源:ServiceDiscoveryManager.java


示例16: setEntityCapsManager

import org.jivesoftware.smackx.entitycaps.EntityCapsManager; //导入依赖的package包/类
/**
 * Loads the ServiceDiscoveryManager with an EntityCapsManger
 * that speeds up certain lookups
 * @param manager
 */
public void setEntityCapsManager(EntityCapsManager manager) {
    capsManager = manager;
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:9,代码来源:ServiceDiscoveryManager.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Scheduler类代码示例发布时间:2022-05-22
下一篇:
Java ExecUtil类代码示例发布时间: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