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


Java Presence.isAvailable方法代码示例

本文整理汇总了Java中org.xmpp.packet.Presence.isAvailable方法的典型用法代码示例。如果您正苦于以下问题:Java Presence.isAvailable方法的具体用法?Java Presence.isAvailable怎么用?Java Presence.isAvailable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.xmpp.packet.Presence的用法示例。


在下文中一共展示了Presence.isAvailable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPresence

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
/**
 * 设置此会话的presence
 * 
 * @param presence
 */
public void setPresence(Presence presence) {
	Presence oldPresence = this.presence;
	this.presence = presence;
	if (oldPresence.isAvailable() && !this.presence.isAvailable()) {
		setInitialized(false);
	} else if (!oldPresence.isAvailable() && this.presence.isAvailable()) {
		wasAvailable = true;
	}
}
 
开发者ID:lijian17,项目名称:androidpn-server,代码行数:15,代码来源:ClientSession.java

示例2: isInitialized

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
public boolean isInitialized() {
    if (initialized == -1) {
        Presence presence = getPresence();
        if (presence != null && presence.isAvailable()) {
            // Optimization to avoid making a remote call
            initialized = 1;
        }
        else {
            ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.isInitialized);
            initialized = (Boolean) doSynchronousClusterTask(task) ? 1 : 0;
        }
    }
    return initialized == 1;
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:15,代码来源:RemoteClientSession.java

示例3: setPresence

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
/**
 * Set the presence of this session
 *
 * @param presence The presence for the session
 */
@Override
public void setPresence(Presence presence) {
    Presence oldPresence = this.presence;
    this.presence = presence;
    if (oldPresence.isAvailable() && !this.presence.isAvailable()) {
        // The client is no longer available
        sessionManager.sessionUnavailable(this);
        // Mark that the session is no longer initialized. This means that if the user sends
        // an available presence again the session will be initialized again thus receiving
        // offline messages and offline presence subscription requests
        setInitialized(false);
        // Notify listeners that the session is no longer available
        PresenceEventDispatcher.unavailableSession(this, presence);
    }
    else if (!oldPresence.isAvailable() && this.presence.isAvailable()) {
        // The client is available
        sessionManager.sessionAvailable(this, presence);
        wasAvailable = true;
        // Notify listeners that the session is now available
        PresenceEventDispatcher.availableSession(this, presence);
    }
    else if (this.presence.isAvailable() && oldPresence.getPriority() != this.presence.getPriority())
    {
        // The client has changed the priority of his presence
        sessionManager.changePriority(this, oldPresence.getPriority());
        // Notify listeners that the priority of the session/resource has changed
        PresenceEventDispatcher.presenceChanged(this, presence);
    }
    else if (this.presence.isAvailable()) {
        // Notify listeners that the show or status value of the presence has changed
        PresenceEventDispatcher.presenceChanged(this, presence);
    }
    if (ClusterManager.isClusteringStarted()) {
        // Track information about the session and share it with other cluster nodes
        Cache<String,ClientSessionInfo> cache = SessionManager.getInstance().getSessionInfoCache();
        cache.put(getAddress().toString(), new ClientSessionInfo(this));
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:44,代码来源:LocalClientSession.java

示例4: updatePresence

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
private void updatePresence(ClientSession session, Presence presence)
{
    Connection con = null;
    PreparedStatement pstmt = null;
    final String presenceText;

    if (!XMPPServer.getInstance().getUserManager().isRegisteredUser(session.getAddress()))
    {
        return;
    }

    if (Presence.Type.unavailable.equals(presence.getType()))
    {
        presenceText = presence.getType().toString();
    }
    else if (presence.getShow() != null)
    {
        presenceText = presence.getShow().toString();
    }
    else if (presence.isAvailable())
    {
        presenceText = "available";
    }
    else
    {
        return;
    }

    setPresence(session, presenceText);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:31,代码来源:UserStatusPlugin.java

示例5: processPacket

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
public void processPacket(Packet packet) {
    // Check that we are getting an answer to a presence probe
    if (packet instanceof Presence) {
        Presence presence = (Presence) packet;
        if (presence.isAvailable() || presence.getType() == Presence.Type.unavailable ||
                presence.getType() == Presence.Type.error) {
            // Store answer of presence probes
            probedPresence.put(presence.getFrom().toString(), presence);
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:12,代码来源:PresencePlugin.java

示例6: isInitialized

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
public boolean isInitialized() {
    if (initialized == -1) {
        Presence presence = getPresence();
        if (presence != null && presence.isAvailable()) {
            // Optimization to avoid making a remote call
            initialized = 1;
        }
        else {
            ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.isInitialized);
            Object result = doSynchronousClusterTask(task);
            initialized = result != null && (Boolean) result ? 1 : 0;
        }
    }
    return initialized == 1;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:16,代码来源:RemoteClientSession.java

示例7: setPresence

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
/**
 * Sets the presence of this session.
 * 
 * @param presence the presence
 */
public void setPresence(Presence presence) {
    Presence oldPresence = this.presence;
    this.presence = presence;
    if (oldPresence.isAvailable() && !this.presence.isAvailable()) {
        setInitialized(false);
    } else if (!oldPresence.isAvailable() && this.presence.isAvailable()) {
        wasAvailable = true;
    }
}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:15,代码来源:ClientSession.java

示例8: setPresence

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
public void setPresence(Presence presence) {
    Presence oldPresence = this.presence;
    this.presence = presence;
    if (oldPresence.isAvailable() && !this.presence.isAvailable()) {
        setInitialized(false);
    } else if (!oldPresence.isAvailable() && this.presence.isAvailable()) {
        wasAvailable = true;
    }
}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:10,代码来源:ClientSession.java

示例9: setPresence

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
/**
 * Set the presence of this session
 *
 * @param presence The presence for the session
 */
public void setPresence(Presence presence) {
    Presence oldPresence = this.presence;
    this.presence = presence;
    if (oldPresence.isAvailable() && !this.presence.isAvailable()) {
        // The client is no longer available
        sessionManager.sessionUnavailable(this);
        // Mark that the session is no longer initialized. This means that if the user sends
        // an available presence again the session will be initialized again thus receiving
        // offline messages and offline presence subscription requests
        setInitialized(false);
        // Notify listeners that the session is no longer available
        PresenceEventDispatcher.unavailableSession(this, presence);
    }
    else if (!oldPresence.isAvailable() && this.presence.isAvailable()) {
        // The client is available
        sessionManager.sessionAvailable(this);
        wasAvailable = true;
        // Notify listeners that the session is now available
        PresenceEventDispatcher.availableSession(this, presence);
    }
    else if (this.presence.isAvailable() && oldPresence.getPriority() != this.presence.getPriority())
    {
        // The client has changed the priority of his presence
        sessionManager.changePriority(this, oldPresence.getPriority());
        // Notify listeners that the priority of the session/resource has changed
        PresenceEventDispatcher.presenceChanged(this, presence);
    }
    else if (this.presence.isAvailable()) {
        // Notify listeners that the show or status value of the presence has changed
        PresenceEventDispatcher.presenceChanged(this, presence);
    }
    if (ClusterManager.isClusteringStarted()) {
        // Track information about the session and share it with other cluster nodes
        Cache<String,ClientSessionInfo> cache = SessionManager.getInstance().getSessionInfoCache();
        cache.put(getAddress().toString(), new ClientSessionInfo(this));
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:43,代码来源:LocalClientSession.java


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