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


Java LocalClientSession.process方法代码示例

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


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

示例1: broadcastPresenceOfOtherResource

import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
/**
 * Sends the presences of other connected resources to the resource that just connected.
 * 
 * @param session the newly created session.
 */
private void broadcastPresenceOfOtherResource(LocalClientSession session) {
    Presence presence;
    // Get list of sessions of the same user
    JID searchJID = new JID(session.getAddress().getNode(), session.getAddress().getDomain(), null);
    List<JID> addresses = routingTable.getRoutes(searchJID, null);
    for (JID address : addresses) {
        if (address.equals(session.getAddress())) {
            continue;
        }
        // Send the presence of an existing session to the session that has just changed
        // the presence
        ClientSession userSession = routingTable.getClientRoute(address);
        presence = userSession.getPresence().createCopy();
        presence.setTo(session.getAddress());
        session.process(presence);
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:23,代码来源:SessionManager.java

示例2: broadcastPresenceOfOtherResource

import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
/**
 * Sends the presences of other connected resources to the resource that just connected.
 *
 * @param session the newly created session.
 */
private void broadcastPresenceOfOtherResource(LocalClientSession session) {
    if (!SessionManager.isOtherResourcePresenceEnabled()) {
        return;
    }
    Presence presence;
    // Get list of sessions of the same user
    JID searchJID = new JID(session.getAddress().getNode(), session.getAddress().getDomain(), null);
    List<JID> addresses = routingTable.getRoutes(searchJID, null);
    for (JID address : addresses) {
        if (address.equals(session.getAddress())) {
            continue;
        }
        // Send the presence of an existing session to the session that has just changed
        // the presence
        ClientSession userSession = routingTable.getClientRoute(address);
        presence = userSession.getPresence().createCopy();
        presence.setTo(session.getAddress());
        session.process(presence);
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:26,代码来源:SessionManager.java

示例3: changePriority

import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
/**
 * Change the priority of a session, that was already available, associated with the sender.
 *
 * @param session   The session whose presence priority has been modified
 * @param oldPriority The old priority for the session
 */
public void changePriority(LocalClientSession session, int oldPriority) {
    if (session.getAuthToken().isAnonymous()) {
        // Do nothing if the session belongs to an anonymous user
        return;
    }
    int newPriority = session.getPresence().getPriority();
    if (newPriority < 0 || oldPriority >= 0) {
        // Do nothing if new presence priority is not positive and old presence negative
        return;
    }

    // Check presence's priority of other available resources
    JID searchJID = new JID(session.getAddress().toBareJID());
    for (JID address : routingTable.getRoutes(searchJID, null)) {
        if (address.equals(session.getAddress())) {
            continue;
        }
        ClientSession otherSession = routingTable.getClientRoute(address);
        if (otherSession.getPresence().getPriority() >= 0) {
            return;
        }
    }

    // User sessions had negative presence before this change so deliver messages
    if (session.canFloodOfflineMessages()) {
        OfflineMessageStore messageStore = server.getOfflineMessageStore();
        Collection<OfflineMessage> messages = messageStore.getMessages(session.getAuthToken().getUsername(), true);
        for (Message message : messages) {
            session.process(message);
        }
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:39,代码来源:SessionManager.java

示例4: changePriority

import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
/**
 * Change the priority of a session, that was already available, associated with the sender.
 *
 * @param session   The session whose presence priority has been modified
 * @param oldPriority The old priority for the session
 */
public void changePriority(LocalClientSession session, int oldPriority) {
    if (session.getAuthToken().isAnonymous()) {
        // Do nothing if the session belongs to an anonymous user
        return;
    }
    int newPriority = session.getPresence().getPriority();
    if (newPriority < 0 || oldPriority >= 0) {
        // Do nothing if new presence priority is not positive and old presence negative
        return;
    }

    // Check presence's priority of other available resources
    JID searchJID = session.getAddress().asBareJID();
    for (JID address : routingTable.getRoutes(searchJID, null)) {
        if (address.equals(session.getAddress())) {
            continue;
        }
        ClientSession otherSession = routingTable.getClientRoute(address);
        if (otherSession.getPresence().getPriority() >= 0) {
            return;
        }
    }

    // User sessions had negative presence before this change so deliver messages
    if (session.canFloodOfflineMessages()) {
        OfflineMessageStore messageStore = server.getOfflineMessageStore();
        Collection<OfflineMessage> messages = messageStore.getMessages(session.getAuthToken().getUsername(), true);
        for (Message message : messages) {
            session.process(message);
        }
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:39,代码来源:SessionManager.java

示例5: changePriority

import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
/**
 * Change the priority of a session, that was already available, associated with the sender.
 *
 * @param session   The session whose presence priority has been modified
 * @param oldPriority The old priority for the session
 */
public void changePriority(LocalClientSession session, int oldPriority) {
    if (session.getAuthToken().isAnonymous()) {
        // Do nothing if the session belongs to an anonymous user
        return;
    }
    int newPriority = session.getPresence().getPriority();
    if (newPriority < 0 || oldPriority >= 0) {
        // Do nothing if new presence priority is not positive and old presence negative
        return;
    }

    // Check presence's priority of other available resources
    JID searchJID = new JID(session.getAddress().toBareJID());
    for (JID address : routingTable.getRoutes(searchJID, null)) {
        if (address.equals(session.getAddress())) {
            continue;
        }
        ClientSession otherSession = routingTable.getClientRoute(address);
        if (otherSession.getPresence().getPriority() >= 0) {
            return;
        }
    }

    // User sessions had negative presence before this change so deliver messages
    if (session.canFloodOfflineMessages()) {
        OfflineMessageStore messageStore = server.getOfflineMessageStore();
        Collection<OfflineMessage> messages = messageStore.getMessages(session.getAuthToken().getUsername(), true);
   		Log.info("Delivering " + messages.size() + " offline messages to " + session.getAddress());
        for (Message message : messages) {
            session.process(message);
        }
    }
}
 
开发者ID:surevine,项目名称:openfire-bespoke,代码行数:40,代码来源:SessionManager.java


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